I am running FFmpeg version 4.3.1 — as installed via Homebrew — on macOS Catalina (10.15.7). And this morning I was running a standard FFmpeg command to I use merge MP4 and SRT subtitles:
ffmpeg -y -i input.mp4 -i input.srt -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng output.mp4When it suddenly failed with these lines on the screen:
Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Stream #1:0 -> #0:2 (subrip (srt) -> mov_text (native))
Press [q] to stop, [?] for help
Segmentation fault: 11This is weird to me since I used the exact same command a few days back — and it the past even — without any issues.
Checking the output file itself only shows the following as content; seems to have died immediately on creating headers for the output file:
ftypisomisomiso2avc1mp4freemdatChecking a few of my usable MP4 files shows that ftypisomisomiso2avc1mp4freemdat is part of the initial content of those files as well. But the MP4 files that work clearly have headers and binary content past that.
Why the heck this this suddenly happening on such a simple content copy/merge command? This command does nothing more than merge an MP4 video with subtitles without transcoding content and should take less than a second or so to do its job.
The only thing of note is a regularly run brew update and brew upgrade with little to no issues. But I am assuming a recent FFmpeg upgrade caused this issue. Here is the full version output on my macOS machine for reference:
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers built with Apple clang version 12.0.0 (clang-1200.0.32.21) configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'What can be done to fix this? Simply wait for a new version/patch of FFmpeg to be released to address the issue? Is there perhaps a parameter that can be added to that command to ensure the command works as expected?
91 Answer
NOTE: Seems like there was an update to FFmpeg around November 6, 2020 from version 4.3.1_2 to 4.3.1_3 that solved this issue. So this was a transient bug that was cleared up. Leaving the answer up for future reference if someone else runs into similar issues.
The only solution I have to this is a workaround of using an earlier version of FFmpeg.
I know that FFmpeg 2.8.17 is two major versions behind version 4.3.1, but for the my purpose of quickly finding a solution to merging an MP4 with subtitles without transcoding, this solution was quick to implement and address my issue.
While I am hoping there is a parameter that can be added to the command to get past this issue, not knowing what else to do I launched an Ubuntu 16.04 VM I have setup in VirtualBox, installed FFmpeg on it, copied the video and subtitles to that Ubuntu 16.04 VM, ran the same command and all worked as expected.
The installed version of FFmpeg on Ubuntu 16.04 if you simply run sudo aptitude install ffmpeg is 2.8.17; which is definitely a lower version that I have via Homebrew (4.3.1) in macOS but for purely merging subtitles, it did the job.
Here is the full version output for FFmpeg on the Ubuntu 16.04 VM for reference:
ffmpeg version 2.8.17-0ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'