Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3109 closed defect (duplicate)

FFMPEG crashes after producing an error of more frames in 2nd pass

Reported by: ramitb Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: When doing a 2 pass encoding, at the END of the encoding ffmpeg throws an error about more frames in the 2nd pass than the first and then crashes.

The command line and output of the 2nd pass

ffmpeg -probesize 100M -analyzeduration 300M -threads 0 -drc_scale
0.8 -y -i "The Devil's Advocate_SCIFIHD_2013_10_29_10_58_00.ts" -ss 3 -vf yadif=0:-1,hqdn3d,crop=1904:1072:6:4,scale=720
:400 -vcodec libx264 -b 1800000 -x264opts me=hex:trellis=2:subq=8:partitions=all:8x8dct=1:ref=5:rc-lookahead=50:keyint=2
5:min-keyint=20:bframes=3:weightb=1:level=4.0:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no
-dct-decimate=1:b-adapt=2:threads=auto   -acodec libfdk_aac -ab 384k -cutoff 18000 -ac 2 -pass 2 -passlogfile "MCEBuddy2
Pass.log" "The Devil's Advocate_SCIFIHD_2013_10_29_10_58_00-converted.mp4"
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from 'The Devil's Advocate_SCIFIHD_2013_10_29_10_58_00.ts':
  Duration: 00:05:55.01, start: 1.424000, bitrate: 12974 kb/s
  Program 1
    Metadata:
      service_name    : Syfy HD
      service_provider: SCIFIHD
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 f
ps, 29.97 tbr, 90k tbn, 59.94 tbc
Please use -b:a or -b:v, -b is ambiguous
[libx264 @ 05531020] using SAR=595/603
[libx264 @ 05531020] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 05531020] profile High, level 4.0
[libx264 @ 05531020] 264 - core 136 r2350 3361d59 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.or
g/x264.html - options: cabac=1 ref=5 deblock=1:-1:-1 analyse=0x3:0x133 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1
 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=-2 threads=6 lookahead_th
reads=1 sliced_threads=0 nr=0 decimate=0 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=
1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=25 keyint_min=13 scenecut=40 intra_refresh=0 rc_lookahead=25 r
c=2pass mbtree=1 bitrate=1800 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 'The Devil's Advocate_SCIFIHD_2013_10_29_10_58_00-converted.mp4':
  Metadata:
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x400 [SAR 595:603 DAR 119:67], q=-1--1, pas
s 2, 1800 kb/s, 30k tbn, 29.97 tbc
    Stream #0:1(eng): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 384 kb/s
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video -> libx264)
  Stream #0:0 -> #0:1 (ac3 -> libfdk_aac)
Press [q] to stop, [?] for help
[ac3 @ 025af060] frame sync error
Error while decoding stream #0:0: Error number -1 occurred
[swscaler @ 03a3d840] Warning: data is not aligned! This can lead to a speedloss
2nd pass has more frames than 1st pass (10535)e=00:05:51.33 bitrate=2184.1kbits/s dup=1 drop=0
[libx264 @ 05531020] continuing anyway, at constant QP=21
[libx264 @ 05531020] disabling adaptive B-frames

Let me know if you want the original file uploaded - it is 600MB in size.

Change History (8)

comment:1 by ramitb, 11 years ago

I've uploaded a sample (20MB) 2ndpassfail.ts

Here is how to replicate the issue:

ffmpeg -probesize 100M -analyzeduration 300M -threads 0 -drc_scale
0.8 -y -i "2ndpassfail.ts" -ss 3 -vf yadif=0:-1,hqdn3d,crop=1904:1072:6:4,scale=720:400 -vcodec libx264 -b 1800000 -x264
opts partitions=none:rc-lookahead=50:keyint=25:min-keyint=20:bframes=3:weightb=0:level=4.0:b-pyramid=normal:direct=auto:
mixed-refs=0:deblock=-1,-1:no-fast-pskip=0:no-dct-decimate=1:threads=auto   -acodec libfdk_aac -ab 384k -cutoff 18000 -a
c 2 -subq 1 -refs 1 -trellis 0 -b_strategy 1 -me_method dia -pass 1 -passlogfile "2ndpassfail.log" -f rawvideo NUL
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 0327dc40] PES packet size mismatch
    Last message repeated 1 times
Input #0, mpegts, from '2ndpassfail.ts':
  Duration: 00:00:13.07, start: 1.424000, bitrate: 12839 kb/s
  Program 1
    Metadata:
      service_name    : Syfy HD
      service_provider: SCIFIHD
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 f
ps, 29.97 tbr, 90k tbn, 59.94 tbc
Please use -b:a or -b:v, -b is ambiguous
Codec AVOption cutoff (set cutoff bandwidth) specified for output file #0 (NUL) has not been used for any stream. The mo
st likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some
 encoder which was not actually used for any stream.
Codec AVOption ab (set bitrate (in bits/s)) specified for output file #0 (NUL) has not been used for any stream. The mos
t likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some
encoder which was not actually used for any stream.
[libx264 @ 0523b020] using SAR=595/603
[libx264 @ 0523b020] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0523b020] profile Main, level 4.0
Output #0, rawvideo, to 'NUL':
  Metadata:
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264), yuv420p, 720x400 [SAR 595:603 DAR 119:67], q=-1--1, pass 1, 1800 kb/s, 90k tbn,
29.97 tbc
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video -> libx264)
Press [q] to stop, [?] for help
[swscaler @ 056e8040] Warning: data is not aligned! This can lead to a speedloss
PES packet size mismatch.0 size=    1718kB time=00:00:07.74 bitrate=1818.2kbits/s
[mpeg2video @ 032ab500] Warning MVs not available
[mpeg2video @ 032ab500] concealing 7367 DC, 7367 AC, 7367 MV errors in B frame
frame=  287 fps= 19 q=-1.0 Lsize=    2222kB time=00:00:09.50 bitrate=1914.4kbits/s
video:2222kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.000000%
[libx264 @ 0523b020] frame I:12    Avg QP:14.62  size: 42740
[libx264 @ 0523b020] frame P:141   Avg QP:17.52  size: 10470
[libx264 @ 0523b020] frame B:134   Avg QP:21.67  size:  2138
[libx264 @ 0523b020] consecutive B-frames: 34.5%  4.2% 16.7% 44.6%
[libx264 @ 0523b020] mb I  I16..4: 12.1%  0.0% 87.9%
[libx264 @ 0523b020] mb P  I16..4:  7.8%  0.0%  0.0%  P16..4: 68.3%  0.0%  0.0%  0.0%  0.0%    skip:23.9%
[libx264 @ 0523b020] mb B  I16..4:  0.5%  0.0%  0.0%  B16..8: 23.5%  0.0%  0.0%  direct:13.7%  skip:62.3%  L0:32.3% L1:4
3.1% BI:24.7%
[libx264 @ 0523b020] final ratefactor: 17.02
[libx264 @ 0523b020] direct mvs  spatial:98.5% temporal:1.5%
[libx264 @ 0523b020] coded y,uvDC,uvAC intra: 75.8% 83.8% 70.1% inter: 28.6% 25.9% 14.3%
[libx264 @ 0523b020] i16 v,h,dc,p: 50% 24% 17% 10%
[libx264 @ 0523b020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 13%  8%  7%  6%  7%  6%  8%  8%
[libx264 @ 0523b020] i8c dc,h,v,p: 36% 19% 33% 12%
[libx264 @ 0523b020] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0523b020] kb/s:1901.07
ffmpeg -probesize 100M -analyzeduration 300M -threads 0 -drc_scale
 0.8 -y -i "2ndpassfail.ts" -ss 3 -vf yadif=0:-1,hqdn3d,crop=1904:1072:6:4,scale=720:400 -vcodec libx264 -b 1800000 -x26
4opts me=hex:trellis=2:subq=8:partitions=all:8x8dct=1:ref=5:rc-lookahead=50:keyint=25:min-keyint=20:bframes=3:weightb=1:
level=4.0:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=2:threads=au
to   -acodec libfdk_aac -ab 384k -cutoff 18000 -ac 2 -pass 2 -passlogfile "2ndpassfail.log" "2ndpassfail.mp4"
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 0255f340] PES packet size mismatch
    Last message repeated 1 times
Input #0, mpegts, from '2ndpassfail.ts':
  Duration: 00:00:13.07, start: 1.424000, bitrate: 12839 kb/s
  Program 1
    Metadata:
      service_name    : Syfy HD
      service_provider: SCIFIHD
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 f
ps, 29.97 tbr, 90k tbn, 59.94 tbc
Please use -b:a or -b:v, -b is ambiguous
[libx264 @ 05590b20] using SAR=595/603
[libx264 @ 05590b20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 05590b20] profile High, level 4.0
[libx264 @ 05590b20] 264 - core 136 r2350 3361d59 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.or
g/x264.html - options: cabac=1 ref=5 deblock=1:-1:-1 analyse=0x3:0x133 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1
 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=-2 threads=6 lookahead_th
reads=1 sliced_threads=0 nr=0 decimate=0 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=
1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=25 keyint_min=13 scenecut=40 intra_refresh=0 rc_lookahead=25 r
c=2pass mbtree=1 bitrate=1800 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 '2ndpassfail.mp4':
  Metadata:
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x400 [SAR 595:603 DAR 119:67], q=-1--1, pas
s 2, 1800 kb/s, 30k tbn, 29.97 tbc
    Stream #0:1(eng): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 384 kb/s
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video -> libx264)
  Stream #0:0 -> #0:1 (ac3 -> libfdk_aac)
Press [q] to stop, [?] for help
[ac3 @ 03b54cc0] frame sync error
Error while decoding stream #0:0: Error number -1 occurred
[swscaler @ 03b5ff20] Warning: data is not aligned! This can lead to a speedloss
2nd pass has more frames than 1st pass (287)ime=00:00:09.38 bitrate=2155.7kbits/s dup=1 drop=0
[libx264 @ 05590b20] continuing anyway, at constant QP=19
[libx264 @ 05590b20] disabling adaptive B-frames
[libx264 @ 05590b20] specified frame type is not compatible with max B-frames

comment:2 by ramitb, 11 years ago

Even if I use exactly the same parameters on the 1st and 2nd pass it crashes:

ffmpeg -probesize 100M -analyzeduration 300M -threads 0 -drc_scale
 0.8 -y -i "2ndpassfail.ts" -ss 3 -vf yadif=0:-1,hqdn3d,crop=1904:1072:6:4,scale=720:400 -vcodec libx264 -b 1800000 -x26
4opts me=hex:trellis=2:subq=8:partitions=all:8x8dct=1:ref=5:rc-lookahead=50:keyint=25:min-keyint=20:bframes=3:weightb=1:
level=4.0:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=2:threads=au
to   -acodec libfdk_aac -ab 384k -cutoff 18000 -ac 2 -pass 1 -passlogfile "2ndpassfail.log" -f rawvideo NUL
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 0034dbc0] PES packet size mismatch
    Last message repeated 1 times
Input #0, mpegts, from '2ndpassfail.ts':
  Duration: 00:00:13.07, start: 1.424000, bitrate: 12839 kb/s
  Program 1
    Metadata:
      service_name    : Syfy HD
      service_provider: SCIFIHD
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 f
ps, 29.97 tbr, 90k tbn, 59.94 tbc
Please use -b:a or -b:v, -b is ambiguous
Codec AVOption cutoff (set cutoff bandwidth) specified for output file #0 (NUL) has not been used for any stream. The mo
st likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some
 encoder which was not actually used for any stream.
Codec AVOption ab (set bitrate (in bits/s)) specified for output file #0 (NUL) has not been used for any stream. The mos
t likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some
encoder which was not actually used for any stream.
[libx264 @ 04cafae0] using SAR=595/603
[libx264 @ 04cafae0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 04cafae0] profile Main, level 4.0
Output #0, rawvideo, to 'NUL':
  Metadata:
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264), yuv420p, 720x400 [SAR 595:603 DAR 119:67], q=-1--1, pass 1, 1800 kb/s, 90k tbn,
29.97 tbc
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video -> libx264)
Press [q] to stop, [?] for help
[swscaler @ 044649a0] Warning: data is not aligned! This can lead to a speedloss
PES packet size mismatch.0 size=    1733kB time=00:00:07.67 bitrate=1849.6kbits/s
Warning MVs not available0 size=    1926kB time=00:00:08.24 bitrate=1914.4kbits/s
[mpeg2video @ 03c3c2c0] concealing 7367 DC, 7367 AC, 7367 MV errors in B frame
frame=  287 fps= 20 q=-1.0 Lsize=    2265kB time=00:00:09.50 bitrate=1951.5kbits/s
video:2265kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.000000%
[libx264 @ 04cafae0] frame I:14    Avg QP:14.12  size: 46244
[libx264 @ 04cafae0] frame P:96    Avg QP:17.20  size: 12694
[libx264 @ 04cafae0] frame B:177   Avg QP:20.03  size:  2564
[libx264 @ 04cafae0] consecutive B-frames: 12.2%  9.1% 23.0% 55.7%
[libx264 @ 04cafae0] mb I  I16..4: 13.7%  0.0% 86.3%
[libx264 @ 04cafae0] mb P  I16..4: 11.8%  0.0%  0.0%  P16..4: 71.1%  0.0%  0.0%  0.0%  0.0%    skip:17.0%
[libx264 @ 04cafae0] mb B  I16..4:  1.0%  0.0%  0.0%  B16..8: 27.2%  0.0%  0.0%  direct:14.5%  skip:57.4%  L0:30.3% L1:4
0.1% BI:29.6%
[libx264 @ 04cafae0] final ratefactor: 15.66
[libx264 @ 04cafae0] direct mvs  spatial:97.7% temporal:2.3%
[libx264 @ 04cafae0] coded y,uvDC,uvAC intra: 78.4% 85.3% 70.2% inter: 25.6% 24.9% 12.4%
[libx264 @ 04cafae0] i16 v,h,dc,p: 48% 23% 20%  9%
[libx264 @ 04cafae0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 15%  7%  6%  7%  7%  6%  8%  7%
[libx264 @ 04cafae0] i8c dc,h,v,p: 44% 17% 30%  9%
[libx264 @ 04cafae0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 04cafae0] kb/s:1937.94
ffmpeg -probesize 100M -analyzeduration 300M -threads 0 -drc_scale
 0.8 -y -i "2ndpassfail.ts" -ss 3 -vf yadif=0:-1,hqdn3d,crop=1904:1072:6:4,scale=720:400 -vcodec libx264 -b 1800000 -x26
4opts me=hex:trellis=2:subq=8:partitions=all:8x8dct=1:ref=5:rc-lookahead=50:keyint=25:min-keyint=20:bframes=3:weightb=1:
level=4.0:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=2:threads=au
to   -acodec libfdk_aac -ab 384k -cutoff 18000 -ac 2 -pass 2 -passlogfile "2ndpassfail.log" "2ndpassfail.mp4"
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 026ff340] PES packet size mismatch
    Last message repeated 1 times
Input #0, mpegts, from '2ndpassfail.ts':
  Duration: 00:00:13.07, start: 1.424000, bitrate: 12839 kb/s
  Program 1
    Metadata:
      service_name    : Syfy HD
      service_provider: SCIFIHD
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 f
ps, 29.97 tbr, 90k tbn, 59.94 tbc
Please use -b:a or -b:v, -b is ambiguous
[libx264 @ 05550b20] using SAR=595/603
[libx264 @ 05550b20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 05550b20] profile High, level 4.0
[libx264 @ 05550b20] 264 - core 136 r2350 3361d59 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.or
g/x264.html - options: cabac=1 ref=5 deblock=1:-1:-1 analyse=0x3:0x133 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1
 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=-2 threads=6 lookahead_th
reads=1 sliced_threads=0 nr=0 decimate=0 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=
2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=25 keyint_min=13 scenecut=40 intra_refresh=0 rc_lookahead=25 r
c=2pass mbtree=1 bitrate=1800 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 '2ndpassfail.mp4':
  Metadata:
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x400 [SAR 595:603 DAR 119:67], q=-1--1, pas
s 2, 1800 kb/s, 30k tbn, 29.97 tbc
    Stream #0:1(eng): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 384 kb/s
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video -> libx264)
  Stream #0:0 -> #0:1 (ac3 -> libfdk_aac)
Press [q] to stop, [?] for help
[ac3 @ 03a84cc0] frame sync error
Error while decoding stream #0:0: Error number -1 occurred
[swscaler @ 03a8ff20] Warning: data is not aligned! This can lead to a speedloss
2nd pass has more frames than 1st pass (287)ime=00:00:09.38 bitrate=2152.0kbits/s dup=1 drop=0
[libx264 @ 05550b20] continuing anyway, at constant QP=19
[libx264 @ 05550b20] disabling adaptive B-frames
[libx264 @ 05550b20] specified frame type is not compatible with max B-frames

comment:3 by ramitb, 11 years ago

Barebones version:

ffmpeg -threads 0 -y -i "2ndpassfail.ts" -vcodec libx264 -b 1800000
 -pass 1 -passlogfile "2ndpassfail.log" -f rawvideo NUL
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 03b2a620] PES packet size mismatch
Input #0, mpegts, from '2ndpassfail.ts':
  Duration: 00:00:13.07, start: 1.424000, bitrate: 12839 kb/s
  Program 1
    Metadata:
      service_name    : Syfy HD
      service_provider: SCIFIHD
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 f
ps, 29.97 tbr, 90k tbn, 59.94 tbc
Please use -b:a or -b:v, -b is ambiguous
[libx264 @ 047e05a0] using SAR=1/1
[libx264 @ 047e05a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 047e05a0] profile Main, level 4.0
Output #0, rawvideo, to 'NUL':
  Metadata:
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, pass 1, 1800 kb/s, 90k tbn, 29.9
7 tbc
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video -> libx264)
Press [q] to stop, [?] for help
PES packet size mismatch.0 size=    2215kB time=00:00:10.04 bitrate=1806.6kbits/s dup=1 drop=0
[mpeg2video @ 03b128c0] Warning MVs not available
[mpeg2video @ 03b128c0] concealing 7367 DC, 7367 AC, 7367 MV errors in B frame
frame=  377 fps= 31 q=-1.0 Lsize=    3073kB time=00:00:12.51 bitrate=2012.2kbits/s dup=1 drop=0
video:3073kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.000000%
[libx264 @ 047e05a0] frame I:9     Avg QP:27.02  size: 62523
[libx264 @ 047e05a0] frame P:163   Avg QP:29.43  size: 12393
[libx264 @ 047e05a0] frame B:205   Avg QP:31.54  size:  2754
[libx264 @ 047e05a0] consecutive B-frames: 18.3% 24.9%  8.0% 48.8%
[libx264 @ 047e05a0] mb I  I16..4: 65.2%  0.0% 34.8%
[libx264 @ 047e05a0] mb P  I16..4: 16.8%  0.0%  0.0%  P16..4: 22.7%  0.0%  0.0%  0.0%  0.0%    skip:60.4%
[libx264 @ 047e05a0] mb B  I16..4:  1.0%  0.0%  0.0%  B16..8:  6.2%  0.0%  0.0%  direct: 3.4%  skip:89.4%  L0:39.8% L1:5
0.2% BI:10.1%
[libx264 @ 047e05a0] final ratefactor: 28.92
[libx264 @ 047e05a0] coded y,uvDC,uvAC intra: 19.3% 47.9% 8.7% inter: 2.5% 5.3% 0.2%
[libx264 @ 047e05a0] i16 v,h,dc,p: 41% 29% 19% 11%
[libx264 @ 047e05a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 30% 16%  6%  3%  4%  4%  4%  4%
[libx264 @ 047e05a0] i8c dc,h,v,p: 55% 19% 21%  5%
[libx264 @ 047e05a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 047e05a0] kb/s:2001.54
ffmpeg -threads 0 -y -i "2ndpassfail.ts" -vcodec libx264 -b 1800000
 -pass 2 -passlogfile "2ndpassfail.log" 2ndpassfail.mp4
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 14 2013 09:33:16 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin
/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-lib
mp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enabl
e-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r
 --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable
-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-
libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++
--enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disab
le-shared --enable-libsoxr --enable-fontconfig --enable-libass   libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 03e5a500] PES packet size mismatch
Input #0, mpegts, from '2ndpassfail.ts':
  Duration: 00:00:13.07, start: 1.424000, bitrate: 12839 kb/s
  Program 1
    Metadata:
      service_name    : Syfy HD
      service_provider: SCIFIHD
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 f
ps, 29.97 tbr, 90k tbn, 59.94 tbc
Please use -b:a or -b:v, -b is ambiguous
[libx264 @ 043bf280] using SAR=1/1
[libx264 @ 043bf280] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 043bf280] profile High, level 4.0
[libx264 @ 043bf280] 264 - core 136 r2350 3361d59 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.or
g/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 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_thre
ads=1 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc
=2pass mbtree=1 bitrate=1800 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 '2ndpassfail.mp4':
  Metadata:
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, pass 2,
 1800 kb/s, 30k tbn, 29.97 tbc
    Stream #0:1(eng): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, 5.1, s16, 488 kb/s
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video -> libx264)
  Stream #0:0 -> #0:1 (ac3 -> libfdk_aac)
Press [q] to stop, [?] for help
[ac3 @ 03e44bc0] frame sync error
Error while decoding stream #0:0: Error number -1 occurred
[libfdk_aac @ 04ae4020] Queue input is backward in time
[mp4 @ 03e43d20] Non-monotonous DTS in output stream 0:1; previous: 2560, current: 2049; changing to 2561. This may resu
lt in incorrect timestamps in the output file.
2nd pass has more frames than 1st pass (377)ime=00:00:12.37 bitrate=2355.9kbits/s dup=17 drop=0
[libx264 @ 043bf280] continuing anyway, at constant QP=33
[libx264 @ 043bf280] disabling adaptive B-frames

comment:4 by ramitb, 11 years ago

Okay I isolated the issue, it's the audio codec, when enabled it causes ffmpeg to crash, when disabled it works fine:

ffmpeg.2314 -threads 0 -y -i "2ndpassfail.ts" -vcodec libx264 -b 1800000 -pass 2 -p
asslogfile "2ndpassfail.log" -acodec copy 2ndpassfail.mp4
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul 18 2013 18:01:33 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfi
g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopenco
re-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-lib
vpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 027d97e0] PES packet size mismatch
Input #0, mpegts, from '2ndpassfail.ts':
  Duration: 00:00:13.07, start: 1.424000, bitrate: 12839 kb/s
  Program 1
    Metadata:
      service_name    : Syfy HD
      service_provider: SCIFIHD
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 f
ps, 29.97 tbr, 90k tbn, 59.94 tbc
Please use -b:a or -b:v, -b is ambiguous
[libx264 @ 0472db20] using SAR=1/1
[libx264 @ 0472db20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0472db20] profile High, level 4.0
[libx264 @ 0472db20] 264 - core 135 r2345 f0c1c53 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.or
g/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 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_thre
ads=1 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc
=2pass mbtree=1 bitrate=1800 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
[mp4 @ 027debc0] track 1: codec frame size is not set
Output #0, mp4, to '2ndpassfail.mp4':
  Metadata:
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, pass 2,
 1800 kb/s, 30k tbn, 29.97 tbc
    Stream #0:1(eng): Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, 5.1(side), 384 kb/s
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video -> libx264)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
2nd pass has more frames than 1st pass (377)ime=00:00:12.51 bitrate=2277.1kbits/s dup=17 drop=0
[libx264 @ 0472db20] continuing anyway, at constant QP=33
[libx264 @ 0472db20] disabling adaptive B-frames

fine when disbaled

ffmpeg.2314 -threads 0 -y -i "2ndpassfail.ts" -vcodec libx264 -b 1800000 -pass 2 -p
asslogfile "2ndpassfail.log" -an 2ndpassfail.mp4
ffmpeg version N-54802-gfc6de70 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul 18 2013 18:01:33 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfi
g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopenco
re-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-lib
vpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 40.100 / 52. 40.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 81.101 /  3. 81.101
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 026e97e0] PES packet size mismatch
Input #0, mpegts, from '2ndpassfail.ts':
  Duration: 00:00:13.07, start: 1.424000, bitrate: 12839 kb/s
  Program 1
    Metadata:
      service_name    : Syfy HD
      service_provider: SCIFIHD
    Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 f
ps, 29.97 tbr, 90k tbn, 59.94 tbc
Please use -b:a or -b:v, -b is ambiguous
[libx264 @ 0462db20] using SAR=1/1
[libx264 @ 0462db20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0462db20] profile High, level 4.0
[libx264 @ 0462db20] 264 - core 135 r2345 f0c1c53 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.or
g/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 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_thre
ads=1 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc
=2pass mbtree=1 bitrate=1800 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 '2ndpassfail.mp4':
  Metadata:
    encoder         : Lavf55.12.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, pass 2,
 1800 kb/s, 30k tbn, 29.97 tbc
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video -> libx264)
Press [q] to stop, [?] for help
PES packet size mismatch.0 size=    2708kB time=00:00:12.01 bitrate=1846.7kbits/s dup=1 drop=0
[mpeg2video @ 026e3200] Warning MVs not available
[mpeg2video @ 026e3200] concealing 7367 DC, 7367 AC, 7367 MV errors in B frame
frame=  377 fps= 13 q=-1.0 Lsize=    2811kB time=00:00:12.51 bitrate=1840.6kbits/s dup=1 drop=0
video:2806kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.174997%
[libx264 @ 0462db20] frame I:9     Avg QP:29.25  size: 49049
[libx264 @ 0462db20] frame P:163   Avg QP:32.10  size: 11226
[libx264 @ 0462db20] frame B:205   Avg QP:35.20  size:  2935
[libx264 @ 0462db20] consecutive B-frames: 18.3% 24.9%  8.0% 48.8%
[libx264 @ 0462db20] mb I  I16..4: 39.0% 59.1%  1.9%
[libx264 @ 0462db20] mb P  I16..4:  4.7%  6.3%  0.4%  P16..4: 27.3%  2.0%  1.1%  0.0%  0.0%    skip:58.2%
[libx264 @ 0462db20] mb B  I16..4:  0.1%  0.3%  0.0%  B16..8: 18.5%  0.5%  0.1%  direct: 0.3%  skip:80.2%  L0:41.2% L1:5
7.9% BI: 0.9%
[libx264 @ 0462db20] 8x8 transform intra:56.8% inter:94.2%
[libx264 @ 0462db20] coded y,uvDC,uvAC intra: 32.1% 54.8% 9.1% inter: 3.5% 5.7% 0.1%
[libx264 @ 0462db20] i16 v,h,dc,p: 37% 32%  9% 22%
[libx264 @ 0462db20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 15% 45%  3%  3%  3%  3%  4%  4%
[libx264 @ 0462db20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8% 77%  7%  1%  2%  1%  2%  1%  1%
[libx264 @ 0462db20] i8c dc,h,v,p: 60% 18% 18%  4%
[libx264 @ 0462db20] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0462db20] ref P L0: 56.9% 12.8% 20.4%  9.9%
[libx264 @ 0462db20] ref B L0: 84.1% 12.5%  3.4%
[libx264 @ 0462db20] ref B L1: 96.2%  3.8%
[libx264 @ 0462db20] kb/s:1827.13

comment:5 by Carl Eugen Hoyos, 11 years ago

Resolution: duplicate
Status: newclosed

Duplicate of ticket #2846

Please understand that there is nothing to fix in FFmpeg afaict (consider providing a backtrace if you disagree), you simply have to use the same (or at least more similar) parameters for first and second pass.

comment:6 by Carl Eugen Hoyos, 11 years ago

Or, as I tried to explain there: It would probably be even worse if the crash wouldn't tell you that encoding went completely wrong because you tried to encode a different number of frames.

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:7 by ramitb, 11 years ago

so if I understood correctly (and tried and it works), replacing the -f rawvideo NUL with 2ndpassfail.mp4 in the 1st pass works fine (no crash).
Are you saying that the audio format difference (since NUL causes audio to be disabled) is what is causing the sync/crash?

If so, how does one use NUL in the first pass to speed things up?

comment:8 by ramitb, 11 years ago

got it, I used -f mp4 and it worked fine. I guess -f rawvideo was changing muxers (which caused the audio to be disbaled in 1st pass) hence causing 2nd pass to crash since audio was present with the mp4 muxer.

Is this correct?

Also I didn't any performance improvement by using -f mp4 NUL vs xyz.mp4 - is that the right behavior?

Note: See TracTickets for help on using tickets.