Search code examples
linuxffmpegvideo-processing

FFmpeg — segmentation fault when trying to replace audio


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


Solution

  • 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.