[FFmpeg-user] Segmentation fault for two-pass libx264, but not two-pass libx265

Laine llee040 at sbcglobal.net
Tue Feb 27 10:52:16 EET 2024


I believe this should be a viable routine for two-pass encoding using libx264, but it fails, as shown. A similar command to encode the same video source file using libx265 with Matroska output is successful, so I don’t think the source file is the culprit. Both the x264 and x265 encoding report 1475 frames encoded. Please help. Thanks.

Sincerely,
L. Lee

ffmpeg -i ~/Downloads/sgd.ts -map 0:0 -c:v:0 libx264 -b:v 2500k -pass 1 -vf fieldmatch=order=tff:combmatch=none,decimate,crop=1920:1072:0:4 -map 0:1 -an -f null /dev/null && ffmpeg -i ~/Downloads/sgd.ts -map 0:0 -c:v:0 libx264 -b:v 2500k -pass 2 -vf fieldmatch=order=tff:combmatch=none,decimate,crop=1920:1072:0:4 -map 0:1 -c:a ac3 -b:a 384k -movflags +faststart ~/Downloads/sgd.mp4
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.1.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --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-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, mpegts, from '/Users/llee/Downloads/sgd.ts':
  Duration: 00:01:02.11, start: 1.400000, bitrate: 14865 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 640 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x13c605d00] using SAR=1/1
[libx264 @ 0x13c605d00] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x13c605d00] profile Main, level 4.0, 4:2:0, 8-bit
Output #0, null, to '/dev/null':
  Metadata:
    encoder         : Lavf60.16.100
  Stream #0:0: Video: h264, yuv420p(tv, bt709, progressive), 1920x1072 [SAR 1:1 DAR 120:67], q=2-31, 2500 kb/s, 24 fps, 24 tbn
    Metadata:
      encoder         : Lavc60.31.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/2500000 buffer size: 0 vbv_delay: N/A
[out#0/null @ 0x6000004ac180] video:20127kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
frame= 1475 fps= 93 q=-1.0 Lsize=N/A time=00:01:01.37 bitrate=N/A speed=3.87x    
[libx264 @ 0x13c605d00] frame I:26    Avg QP:20.39  size: 77028
[libx264 @ 0x13c605d00] frame P:450   Avg QP:23.72  size: 23644
[libx264 @ 0x13c605d00] frame B:999   Avg QP:25.04  size:  7975
[libx264 @ 0x13c605d00] consecutive B-frames:  9.0%  1.4%  2.0% 87.6%
[libx264 @ 0x13c605d00] mb I  I16..4: 64.1%  0.0% 35.9%
[libx264 @ 0x13c605d00] mb P  I16..4: 33.0%  0.0%  0.0%  P16..4: 34.8%  0.0%  0.0%  0.0%  0.0%    skip:32.2%
[libx264 @ 0x13c605d00] mb B  I16..4:  5.5%  0.0%  0.0%  B16..8: 19.6%  0.0%  0.0%  direct: 9.1%  skip:65.8%  L0:39.4% L1:54.2% BI: 6.4%
[libx264 @ 0x13c605d00] final ratefactor: 24.22
[libx264 @ 0x13c605d00] coded y,uvDC,uvAC intra: 29.9% 40.3% 6.3% inter: 6.1% 10.3% 0.0%
[libx264 @ 0x13c605d00] i16 v,h,dc,p: 35% 23% 26% 17%
[libx264 @ 0x13c605d00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 20% 22%  3%  9%  6%  6%  5%  5%
[libx264 @ 0x13c605d00] i8c dc,h,v,p: 56% 20% 21%  3%
[libx264 @ 0x13c605d00] Weighted P-Frames: Y:2.0% UV:0.9%
[libx264 @ 0x13c605d00] kb/s:2682.78
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.1.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --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-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, mpegts, from '/Users/llee/Downloads/sgd.ts':
  Duration: 00:01:02.11, start: 1.400000, bitrate: 14865 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn
  Stream #0:1[0x101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 640 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native))
Press [q] to stop, [?] for help
[libx264 @ 0x159f07480] using SAR=1/1
[libx264 @ 0x159f07480] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x159f07480] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x159f07480] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=15 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=2pass mbtree=1 bitrate=2500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/Users/llee/Downloads/sgd.mp4':
  Metadata:
    encoder         : Lavf60.16.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1072 [SAR 1:1 DAR 120:67], q=2-31, 2500 kb/s, 24 fps, 12288 tbn
    Metadata:
      encoder         : Lavc60.31.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/2500000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Metadata:
      encoder         : Lavc60.31.102 ac3
[libx264 @ 0x159f07480] 2nd pass has more frames than 1st pass (1475)720.9kbits/s dup=15 drop=0 speed=3.88x    
[libx264 @ 0x159f07480] continuing anyway, at constant QP=26
[libx264 @ 0x159f07480] disabling adaptive B-frames
[1]    63630 segmentation fault  ffmpeg -i ~/Downloads/sgd.ts -map 0:0 -c:v:0 libx264 -b:v 2500k -pass 2 -vf  





More information about the ffmpeg-user mailing list