0

I have exactly this scenario: FFMPEG mux video and audio (from another video) - mapping issue. I want to mux the video stream from one file and the audio stream from another.

enter image description here

I have renamed the files accordingly and, when trying to follow the answer

ffmpeg -i input_0.mp4 -i input_1.mp4 -c copy -map 0:0 -map 1:1 -shortest out.mp4

or

ffmpeg -i input_0.mp4 -i input_1.mp4 -c copy -map 0:v:0 -map 1:a:0 -shortest out.mp4

I get

Segmentation fault (core dumped).

The same happens when I follow this answer under ffmpeg - replace audio in video, which tries to mux the audio (as a separate file) with the video stream.

ffmpeg -i input_0.mp4 -i a.aac -c:v copy -map 0:v:0 -map 1:a:0 new.mp4

What can I do?


In reply to comment:

ffmpeg -i input_0.mp4 -i input_1.mp4 -c copy -map 0:0 -map 1:1 -shortest out.mp4
ffmpeg version 4.2.1-0york0~18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=/usr --extra-version='0york0~18.04.1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-nonfree --enable-libfdk-aac --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
Segmentation fault (core dumped)

Looking at this answer under FFMPEG Segfault Solutions:

~$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

~$ ldd /usr/bin/ffmpeg | grep x264
    libx264.so.155 => /usr/lib/x86_64-linux-gnu/libx264.so.155 (0x00007f497f5f9000)
    libx264.so.152 => /usr/lib/x86_64-linux-gnu/libx264.so.152 (0x00007f496e837000)

~$ cat /usr/include/x264.h | grep X264_BUILD
cat: /usr/include/x264.h: No such file or directory

but in Synaptic I see this:

Synaptic libx264

cipricus
  • 103
  • 6
  • Have a look at - https://superuser.com/questions/85096/ffmpeg-segfault-solutions – l0k3ndr Mar 20 '20 at 18:58
  • @llogan - added what I see in terminal – cipricus Mar 20 '20 at 19:00
  • @llogan - as far as I remember I simply installed it with `apt`from Ubuntu/Mint repos. I have added some info in relation with the answer you linked. I'll try to use other ffmpeg and report back. – cipricus Mar 20 '20 at 19:10
  • @llogan - For the moment I have removed the installed ffmpeg and using the static johnvansickle package the first 2 commands give another error, but the last command seems to work. – cipricus Mar 20 '20 at 19:25
  • @llogan - thanks for posting your answer. I was about to post one only if you did not. – cipricus Mar 20 '20 at 19:38

1 Answers1

1

There is a problem with the ffmpeg package from the PPA you are using (jonathonf probably).

What you can try:

  • This package is outdated compared to what is currently available in that PPA, so you can try updating and see if that fixes the problem: sudo apt update.

  • Remove the PPA and install the ffmpeg package from the official Ubuntu repository, or from johnvansickle.com (see install FAQ), or follow a step-by-step guide to compile it yourself, or use snap.

llogan
  • 121,796
  • 28
  • 232
  • 243
  • `ffmpeg -i v.mp4 -i a.wav -c:v copy -map 0:v:0 -map 1:a:0 new.mp4` worked with the static johnvansickle version. I'll follow your advice above to check the other commands that gave error again, and then I'll report here to complete your answer. – cipricus Mar 20 '20 at 19:37
  • The non-working version (jonathonf, but the ppa was already removed at some point) was ffmpeg version 4.2.1. Installing the ubuntu version I get version 3.4.6 — *that has exactly the same problem as the 4.2.1*. The successful static version is **4.2.2**. I don't know if I need to compile the last version or keep the outdated ubuntu version. – cipricus Mar 20 '20 at 19:54
  • @cipricus So 3.4.6 also seg faults? – llogan Mar 20 '20 at 22:59
  • `ffmpeg version 3.4.6-0ubuntu0.18.04.1` gives the same errors as 4.2.1 (jonathonf) with the commands listed in my question here (it works otherwise). But maybe that is another issue, given that it also shows me `WARNING: library configuration mismatch`. On the other hand, for the purpose of [this](https://superuser.com/q/982342/1039759) (`ffmpeg -i "in.mp4" -itsoffset 0.20 -i "in.mp4" -map 0:v -map 1:a -c copy "out.mp4"`), the same 3.4.6 works ok. – cipricus Mar 21 '20 at 10:25
  • I cannot look further into this because I don't have anymore the original files, they were too big on my laptop, I only have the synced final version. Do you need those results? I could try experimenting with what I have. – cipricus Mar 22 '20 at 10:28
  • @cipricus No. I'm guessing the error was `Invalid input file index` or `Stream map '0:1' matches no streams` or similar due to wrong map index numbers (the second example in your question is less prone to that mistake). – llogan Mar 22 '20 at 17:40
  • Note that if you have the version from the ubuntu repository installed and it gives you a segfault, installing it from the ppa can help. – sisisisi May 26 '20 at 20:44