I followed your instruction and build the ffmpeg in my Ubuntu 16.04 server. I used «Linux with EGL» option. Everything went well and the build was successful.
Then I ran this command with the sample file you gave,
ffmpeg -loglevel debug -i media/0.mp4 -i media/1.mp4 -filter_complex gltransition -y out.mp4
It failed with «Segmentation fault (core dumped)» error and here is the debug log,
ffmpeg version N-91545-gd36b839 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/home/calicomadmin/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/calicomadmin/ffmpeg_build/include --extra-ldflags=-L/home/calicomadmin/ffmpeg_build/lib --extra-libs='-lpthread -lm -lGLEW -lEGL' --bindir=/home/calicomadmin/bin --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --enable-gpl --enable-opengl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-filter=gltransition --enable-nonfree
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 22.100 / 58. 22.100
libavformat 58. 17.101 / 58. 17.101
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 26.100 / 7. 26.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument 'media/0.mp4'.
Reading option '-i' ... matched as input url with argument 'media/1.mp4'.
Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument 'gltransition'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'out.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option filter_complex (create a complex filtergraph) with argument gltransition.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url media/0.mp4.
Successfully parsed a group of options.
Opening an input file: media/0.mp4.
[NULL @ 0x3cb17c0] Opening 'media/0.mp4' for reading
[file @ 0x3cb20c0] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cb17c0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cb17c0] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cb17c0] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cb17c0] Processing st: 0, edit list 0 - media time: 0, duration: 51200
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cb17c0] Before avformat_find_stream_info() pos: 1234 bytes read:32768 seeks:0 nb_streams:1[h264 @ 0x3cb3280] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x3cb3280] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x3cb3280] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x3cb3280] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x3cb3280] Format yuv420p chosen by get_format().
[h264 @ 0x3cb3280] Reinit context to 640x368, pix_fmt: yuv420p
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cb17c0] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cb17c0] After avformat_find_stream_info() pos: 7467 bytes read:32768 seeks:0 frames:1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'media/0.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:04.00, start: 0.000000, bitrate: 454 kb/s
Stream #0:0(und), 1, 1/12800: Video: h264 (Constrained Baseline), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x360 (640x368) [SAR 1:1 DAR 16:9], 0/1, 452 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Successfully opened the file.
Parsing a group of options: input url media/1.mp4.
Successfully parsed a group of options.
Opening an input file: media/1.mp4.
[NULL @ 0x3cdb500] Opening 'media/1.mp4' for reading
[file @ 0x3cb9bc0] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cdb500] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cdb500] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cdb500] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cdb500] Processing st: 0, edit list 0 - media time: 0, duration: 51200
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cdb500] Before avformat_find_stream_info() pos: 1217 bytes read:32768 seeks:0 nb_streams:1[h264 @ 0x3cdc800] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x3cdc800] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x3cdc800] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x3cdc800] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x3cdc800] Format yuv420p chosen by get_format().
[h264 @ 0x3cdc800] Reinit context to 640x368, pix_fmt: yuv420p
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cdb500] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cdb500] After avformat_find_stream_info() pos: 16010 bytes read:32768 seeks:0 frames:1
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'media/1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:04.00, start: 0.000000, bitrate: 530 kb/s
Stream #1:0(eng), 1, 1/12800: Video: h264 (Constrained Baseline), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x360 (640x368), 0/1, 528 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Successfully opened the file.
Parsing a group of options: output url out.mp4.
Successfully parsed a group of options.
Opening an output file: out.mp4.
[file @ 0x3cd2b40] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 6 logical cores
[h264 @ 0x3cd11c0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x3cd11c0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x3e16f80] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x3e16f80] nal_unit_type: 8(PPS), nal_ref_idc: 3
Stream mapping:
Stream #0:0 (h264) -> gltransition:from
Stream #1:0 (h264) -> gltransition:to
gltransition -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Last message repeated 1 times
[h264 @ 0x3cd11c0] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x3cd11c0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x3cd11c0] Format yuv420p chosen by get_format().
[h264 @ 0x3cd11c0] Reinit context to 640x368, pix_fmt: yuv420p
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3cd8a00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3d19680] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3da3e80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3dc02c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3ddca00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Last message repeated 1 times
[h264 @ 0x3df9200] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
[h264 @ 0x3e16f80] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x3e16f80] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x3e16f80] Format yuv420p chosen by get_format().
[h264 @ 0x3e16f80] Reinit context to 640x368, pix_fmt: yuv420p
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3e29100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3e6f240] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3e8b8c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3ea8040] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x3ec4780] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
[h264 @ 0x3ee0f00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
[graph 0 input from stream 0:0 @ 0x4030c40] Setting 'video_size' to value '640x360'
[graph 0 input from stream 0:0 @ 0x4030c40] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x4030c40] Setting 'time_base' to value '1/12800'
[graph 0 input from stream 0:0 @ 0x4030c40] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x4030c40] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x4030c40] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0x4030c40] w:640 h:360 pixfmt:yuv420p tb:1/12800 fr:25/1 sar:1/1 sws_param:flags=2
[graph 0 input from stream 1:0 @ 0x402ef40] Setting 'video_size' to value '640x360'
[graph 0 input from stream 1:0 @ 0x402ef40] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 1:0 @ 0x402ef40] Setting 'time_base' to value '1/12800'
[graph 0 input from stream 1:0 @ 0x402ef40] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 1:0 @ 0x402ef40] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 1:0 @ 0x402ef40] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 1:0 @ 0x402ef40] w:640 h:360 pixfmt:yuv420p tb:1/12800 fr:25/1 sar:0/1 sws_param:flags=2
[format @ 0x402f4c0] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21'
[auto_scaler_0 @ 0x40318c0] w:iw h:ih flags:'bilinear' interl:0
[Parsed_gltransition_0 @ 0x4030380] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_gltransition_0'
[auto_scaler_1 @ 0x4031dc0] w:iw h:ih flags:'bilinear' interl:0
[Parsed_gltransition_0 @ 0x4030380] auto-inserting filter 'auto_scaler_1' between the filter 'graph 0 input from stream 1:0' and the filter 'Parsed_gltransition_0'
[auto_scaler_2 @ 0x40316c0] w:iw h:ih flags:'bilinear' interl:0
[format @ 0x402f4c0] auto-inserting filter 'auto_scaler_2' between the filter 'Parsed_gltransition_0' and the filter 'format'
[AVFilterGraph @ 0x402f3c0] query_formats: 5 queried, 1 merged, 3 already done, 0 delayed
[auto_scaler_2 @ 0x40316c0] picking yuv444p out of 8 ref:rgb24 alpha:0
[auto_scaler_0 @ 0x40318c0] w:640 h:360 fmt:yuv420p sar:1/1 -> w:640 h:360 fmt:rgb24 sar:1/1 flags:0x2
[Parsed_gltransition_0 @ 0x4030380] 673005440Segmentation fault (core dumped)
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.
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:
Well, not same use-case, but looks like avconv
should be used instead. Incidentally, I haven’t had much luck with avconv
so far, but I suspect that’s because I’m using a Raspberry Pi and there may be codec issues.
ffmpeg -i *-00.jpg -r 25 movie.mp4
ffmpeg version 0.8.17-6:0.8.17-1+rpi1, Copyright (c) 2000-2014 the Libav developers
built on Mar 25 2015 00:39:58 with gcc 4.6.3
The ffmpeg program is only provided for script compatibility and will be removed
in a future release. **It has been deprecated in the Libav project to allow for
incompatible command line syntax improvements in its replacement called avconv**
(see Changelog for details). Please use avconv instead.
Input #0, image2, from '01-20150528100343-00.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj420p, 1024x576, 25 tbr, 25 tbn, 25 tbc
Segmentation fault
#5536
closed
defect
(needs_more_info)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | libx265 crash |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
I am using ffmpeg to compress some big images (about 3500 3000×8000 .tiff files) and I am using this command:
ffmpeg -y -framerate 30 -start_number 13244 -i sources/full/full_0%03d.tif -c:v libx265 -r 30 -x265-params crf=22 -pix_fmt yuv420p sources/full_brain.mp4
When I run it on small sets of small images, it works just fine, but on the big images it crashes after a few frames with messages like
Segmentation fault (core dumped) 0kB time=00:00:00.00 bitrate=N/A speed= 0x
I tried compressing fewer files, but it still segfaults. I don’t think that it is a memory problem, since I have 96 GB of RAM and the same amount of swap. Also I tried again the command on the smaller sets and it keeps going just fine.
I am running Ubuntu 14.04.4 LTS (school property, I don’t have sudo privileges) and using the static build.
I have included a log file generated with -report, please tell me if you need anything else.
Also, I just noticed that H.264 encoding through libx264 does not run into the problem, still I would need HEVC encoding if possible.
Thank you in advance,
Enrico
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.mp4
When 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: 11
This 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:
ftypisomisomiso2avc1mp4freemdat
Checking 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?