Opened 8 years ago

Closed 6 years ago

Last modified 6 years ago

#5493 closed defect (fixed)

framerate filter output appears to be affected by request_frame() calls

Reported by: Christian Ebert Owned by:
Priority: important Component: avfilter
Version: git-master Keywords: framerate
Cc: blacktrash@gmx.net Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
Depending on (weird) input frame rates and chosen framerate filter frame rate and other circumstances, the framerate filter results in an incomplete MB tree 1st pass stats file.

How to reproduce:

$ ffprobe -select_streams v -show_entries stream=r_frame_rate,avg_frame_rate oldphone.mp4
ffprobe version N-79691-g66dd21d Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-shared --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55. 23.100 / 55. 23.100
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'oldphone.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    com.android.version: 6.0.1
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[STREAM]
r_frame_rate=180000/2
avg_frame_rate=14906250/584969
[/STREAM]
$ ffmpeg -i oldphone.mp4 -filter:v framerate=30,scale=640:360 -b:v 500k -pass 1 -y
test.mp4
ffmpeg version N-79691-g66dd21d Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-shared --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55. 23.100 / 55. 23.100
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'oldphone.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    com.android.version: 6.0.1
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7fccb2700000] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7fccb2700000] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7fccb2812e00] using SAR=1/1
[libx264 @ 0x7fccb2812e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fccb2812e00] profile Main, level 3.0
[libx264 @ 0x7fccb2812e00] 264 - core 148 r2694 3b70645 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=11 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x7fccb2811c00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 6.0.1
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    encoder         : Lavf57.34.103
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=2-31, 500 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.38.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/500000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.38.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 1559 fps=137 q=-1.0 Lsize=    3989kB time=00:00:52.12 bitrate= 627.0kbits/s speed=4.58x
video:3119kB audio:813kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.448805%
[libx264 @ 0x7fccb2812e00] frame I:12    Avg QP:24.46  size:  8829
[libx264 @ 0x7fccb2812e00] frame P:419   Avg QP:26.64  size:  4157
[libx264 @ 0x7fccb2812e00] frame B:1128  Avg QP:29.56  size:  1193
[libx264 @ 0x7fccb2812e00] consecutive B-frames:  1.9%  3.0%  6.2% 89.0%
[libx264 @ 0x7fccb2812e00] mb I  I16..4: 49.9%  0.0% 50.1%
[libx264 @ 0x7fccb2812e00] mb P  I16..4: 23.3%  0.0%  0.0%  P16..4: 49.3%  0.0%  0.0%  0.0%  0.0%    skip:27.3%
[libx264 @ 0x7fccb2812e00] mb B  I16..4:  3.4%  0.0%  0.0%  B16..8: 19.2%  0.0%  0.0%  direct: 7.1%  skip:70.3%  L0:35.8% L1:43.1% BI:21.2%
[libx264 @ 0x7fccb2812e00] final ratefactor: 23.53
[libx264 @ 0x7fccb2812e00] coded y,uvDC,uvAC intra: 45.2% 40.8% 10.6% inter: 9.6% 8.2% 0.3%
[libx264 @ 0x7fccb2812e00] i16 v,h,dc,p: 74% 13%  7%  6%
[libx264 @ 0x7fccb2812e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 27% 10%  3%  3%  4%  3%  3%  5%
[libx264 @ 0x7fccb2812e00] i8c dc,h,v,p: 48% 16% 31%  6%
[libx264 @ 0x7fccb2812e00] Weighted P-Frames: Y:14.6% UV:3.6%
[libx264 @ 0x7fccb2812e00] kb/s:491.59
[aac @ 0x7fccb2814600] Qavg: 1142.250
$ ffmpeg -i oldphone.mp4 -filter:v framerate=30,scale=640:360 -b:v 500k -pass 2 -y
test.mp4
ffmpeg version N-79691-g66dd21d Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-shared --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55. 23.100 / 55. 23.100
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'oldphone.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    com.android.version: 6.0.1
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7fd880600000] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7fd880600000] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7fd88082c000] using SAR=1/1
[libx264 @ 0x7fd88082c000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fd88082c000] profile High, level 3.0
[libx264 @ 0x7fd88082c000] 264 - core 148 r2694 3b70645 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=11 lookahead_threads=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=500 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 @ 0x7fd880828c00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 6.0.1
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    encoder         : Lavf57.34.103
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=2-31, 500 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.38.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/500000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.38.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fd88082c000] Incomplete MB-tree stats file.08 bitrate= 615.3kbits/s speed=3.84x
Video encoding failed
[libx264 @ 0x7fd88082c000] frame I:12    Avg QP:24.36  size:  8693
[libx264 @ 0x7fd88082c000] frame P:416   Avg QP:26.93  size:  3900
[libx264 @ 0x7fd88082c000] frame B:1117  Avg QP:29.65  size:  1323
[libx264 @ 0x7fd88082c000] consecutive B-frames:  1.9%  3.0%  6.2% 88.9%
[libx264 @ 0x7fd88082c000] mb I  I16..4: 18.8% 66.8% 14.3%
[libx264 @ 0x7fd88082c000] mb P  I16..4:  4.2%  7.9%  2.1%  P16..4: 43.2% 10.2%  4.5%  0.0%  0.0%    skip:27.8%
[libx264 @ 0x7fd88082c000] mb B  I16..4:  0.5%  0.7%  0.2%  B16..8: 39.0%  3.8%  0.9%  direct: 2.3%  skip:52.7%  L0:44.3% L1:49.4% BI: 6.4%
[libx264 @ 0x7fd88082c000] 8x8 transform intra:56.1% inter:83.0%
[libx264 @ 0x7fd88082c000] coded y,uvDC,uvAC intra: 57.8% 60.2% 23.1% inter: 12.4% 11.7% 0.4%
[libx264 @ 0x7fd88082c000] i16 v,h,dc,p: 83%  6%  1% 10%
[libx264 @ 0x7fd88082c000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 53% 13%  9%  2%  3%  5%  4%  5%  6%
[libx264 @ 0x7fd88082c000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 44% 14%  7%  4%  6%  9%  6%  6%  5%
[libx264 @ 0x7fd88082c000] i8c dc,h,v,p: 48% 17% 27%  8%
[libx264 @ 0x7fd88082c000] Weighted P-Frames: Y:14.2% UV:3.1%
[libx264 @ 0x7fd88082c000] ref P L0: 50.1% 18.3% 20.3% 10.1%  1.1%
[libx264 @ 0x7fd88082c000] ref B L0: 85.2% 11.0%  3.8%
[libx264 @ 0x7fd88082c000] ref B L1: 94.9%  5.1%
[libx264 @ 0x7fd88082c000] kb/s:497.76
[aac @ 0x7fd88082d800] Qavg: 1142.847
[aac @ 0x7fd88082d800] 2 frames left in the queue on closing
Conversion failed!

This does not happen e.g. with libvpx; I presume because it collects less data in its first pass stats.

Change History (15)

comment:1 by Carl Eugen Hoyos, 8 years ago

Please provide an input sample.

in reply to:  1 comment:2 by Christian Ebert, 8 years ago

Replying to cehoyos:

Please provide an input sample.

https://www.datafilehost.com/d/be3a0cd6

Thanks.

comment:3 by Carl Eugen Hoyos, 8 years ago

Keywords: regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen

in reply to:  3 comment:4 by Christian Ebert, 8 years ago

Replying to cehoyos:

Regression since 16f08b7a0918ec93d377bfd151e6551da4c3b38f

FWIW, this happens with input which has non monotonically increasing dts when you do ffmpeg -i input -f null -.

comment:5 by Michael Niedermayer, 8 years ago

Cc: Michael Niedermayer added

cant reproduce, does this still occur with git master ?

in reply to:  5 comment:6 by Christian Ebert, 8 years ago

Replying to michael:

cant reproduce, does this still occur with git master ?

Indeed I can:

$ ffmpeg -i issue5493.mp4 -filter:v framerate=30,scale=640:360 -b:v 500k -pass 1 -y test.mp4
ffmpeg version N-80227-ge01b19d Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-shared --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 44.101 / 57. 44.101
  libavformat    57. 37.101 / 57. 37.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.101 /  6. 46.101
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue5493.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    com.android.version: 6.0.1
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7fae68d01c40] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7fae68d01c40] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7fae69027e00] using SAR=1/1
[libx264 @ 0x7fae69027e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fae69027e00] profile Main, level 3.0
[libx264 @ 0x7fae69027e00] 264 - core 148 r2694 3b70645 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=11 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x7fae69026c00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 6.0.1
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    encoder         : Lavf57.37.101
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 500 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.44.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/500000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.44.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=   59 fps=0.0 q=38.0 size=       9kB time=00:00:03.01 bitrate=  25.3kbits/s speed=6.02x    
frame=  135 fps=134 q=31.0 size=     182kB time=00:00:05.01 bitrate= 297.1kbits/s speed=4.99x    
frame=  208 fps=138 q=30.0 size=     364kB time=00:00:07.02 bitrate= 424.9kbits/s speed=4.66x    
frame=  273 fps=136 q=28.0 size=     506kB time=00:00:10.03 bitrate= 413.2kbits/s speed=4.99x    
frame=  343 fps=136 q=29.0 size=     693kB time=00:00:12.03 bitrate= 471.4kbits/s speed=4.78x    
frame=  415 fps=137 q=31.0 size=     947kB time=00:00:14.04 bitrate= 552.5kbits/s speed=4.65x    
frame=  483 fps=137 q=30.0 size=    1104kB time=00:00:16.19 bitrate= 558.2kbits/s speed= 4.6x    
frame=  552 fps=137 q=30.0 size=    1266kB time=00:00:19.05 bitrate= 544.2kbits/s speed=4.74x    
frame=  623 fps=138 q=31.0 size=    1488kB time=00:00:21.06 bitrate= 578.9kbits/s speed=4.66x    
frame=  698 fps=139 q=31.0 size=    1688kB time=00:00:23.06 bitrate= 599.6kbits/s speed=4.59x    
frame=  762 fps=138 q=30.0 size=    1821kB time=00:00:26.07 bitrate= 572.0kbits/s speed=4.72x    
frame=  834 fps=138 q=30.0 size=    1967kB time=00:00:28.08 bitrate= 573.9kbits/s speed=4.65x    
frame=  905 fps=138 q=29.0 size=    2137kB time=00:00:30.08 bitrate= 581.8kbits/s speed= 4.6x    
frame=  972 fps=138 q=30.0 size=    2349kB time=00:00:32.11 bitrate= 599.1kbits/s speed=4.56x    
frame= 1039 fps=138 q=30.0 size=    2520kB time=00:00:35.09 bitrate= 588.2kbits/s speed=4.65x    
frame= 1111 fps=138 q=30.0 size=    2680kB time=00:00:37.10 bitrate= 591.7kbits/s speed=4.61x    
frame= 1181 fps=138 q=30.0 size=    2871kB time=00:00:39.10 bitrate= 601.3kbits/s speed=4.57x    
frame= 1250 fps=138 q=30.0 size=    3036kB time=00:00:41.34 bitrate= 601.5kbits/s speed=4.57x    
frame= 1318 fps=138 q=29.0 size=    3176kB time=00:00:44.12 bitrate= 589.7kbits/s speed=4.62x    
frame= 1389 fps=138 q=29.0 size=    3335kB time=00:00:46.12 bitrate= 592.3kbits/s speed=4.59x    
frame= 1459 fps=138 q=29.0 size=    3513kB time=00:00:48.13 bitrate= 597.8kbits/s speed=4.56x    
frame= 1529 fps=138 q=28.0 size=    3663kB time=00:00:51.14 bitrate= 586.8kbits/s speed=4.62x    
frame= 1559 fps=138 q=-1.0 Lsize=    3989kB time=00:00:52.12 bitrate= 627.0kbits/s speed= 4.6x    
video:3119kB audio:813kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.448805%
[libx264 @ 0x7fae69027e00] frame I:12    Avg QP:24.46  size:  8829
[libx264 @ 0x7fae69027e00] frame P:419   Avg QP:26.64  size:  4157
[libx264 @ 0x7fae69027e00] frame B:1128  Avg QP:29.56  size:  1193
[libx264 @ 0x7fae69027e00] consecutive B-frames:  1.9%  3.0%  6.2% 89.0%
[libx264 @ 0x7fae69027e00] mb I  I16..4: 49.9%  0.0% 50.1%
[libx264 @ 0x7fae69027e00] mb P  I16..4: 23.3%  0.0%  0.0%  P16..4: 49.3%  0.0%  0.0%  0.0%  0.0%    skip:27.3%
[libx264 @ 0x7fae69027e00] mb B  I16..4:  3.4%  0.0%  0.0%  B16..8: 19.2%  0.0%  0.0%  direct: 7.1%  skip:70.3%  L0:35.8% L1:43.1% BI:21.2%
[libx264 @ 0x7fae69027e00] final ratefactor: 23.53
[libx264 @ 0x7fae69027e00] coded y,uvDC,uvAC intra: 45.2% 40.8% 10.6% inter: 9.6% 8.2% 0.3%
[libx264 @ 0x7fae69027e00] i16 v,h,dc,p: 74% 13%  7%  6%
[libx264 @ 0x7fae69027e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 27% 10%  3%  3%  4%  3%  3%  5%
[libx264 @ 0x7fae69027e00] i8c dc,h,v,p: 48% 16% 31%  6%
[libx264 @ 0x7fae69027e00] Weighted P-Frames: Y:14.6% UV:3.6%
[libx264 @ 0x7fae69027e00] kb/s:491.59
[aac @ 0x7fae6902a800] Qavg: 1142.250
$ ffmpeg -i issue5493.mp4 -filter:v framerate=30,scale=640:360 -b:v 500k -pass 2 -y test.mp4
ffmpeg version N-80227-ge01b19d Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-shared --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 44.101 / 57. 44.101
  libavformat    57. 37.101 / 57. 37.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.101 /  6. 46.101
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue5493.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    com.android.version: 6.0.1
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7fd2b9422bc0] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7fd2b9422bc0] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7fd2bc000600] using SAR=1/1
[libx264 @ 0x7fd2bc000600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fd2bc000600] profile High, level 3.0
[libx264 @ 0x7fd2bc000600] 264 - core 148 r2694 3b70645 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=11 lookahead_threads=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=500 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 @ 0x7fd2bb000000] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 6.0.1
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    encoder         : Lavf57.37.101
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 500 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.44.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/500000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.44.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=   53 fps=0.0 q=31.0 size=     121kB time=00:00:02.20 bitrate= 451.5kbits/s speed= 4.4x    
frame=  113 fps=112 q=30.0 size=     267kB time=00:00:04.01 bitrate= 544.6kbits/s speed=   4x    
frame=  176 fps=116 q=30.0 size=     431kB time=00:00:06.02 bitrate= 586.8kbits/s speed=3.99x    
frame=  235 fps=116 q=30.0 size=     552kB time=00:00:08.02 bitrate= 563.5kbits/s speed=3.97x    
frame=  292 fps=116 q=30.0 size=     674kB time=00:00:10.03 bitrate= 550.5kbits/s speed=3.98x    
frame=  348 fps=115 q=30.0 size=     836kB time=00:00:12.03 bitrate= 568.7kbits/s speed=3.98x    
frame=  403 fps=114 q=30.0 size=    1030kB time=00:00:14.04 bitrate= 600.6kbits/s speed=3.99x    
frame=  463 fps=115 q=30.0 size=    1159kB time=00:00:16.04 bitrate= 591.7kbits/s speed=3.98x    
frame=  521 fps=115 q=30.0 size=    1317kB time=00:00:18.05 bitrate= 597.5kbits/s speed=3.98x    
frame=  574 fps=114 q=30.0 size=    1496kB time=00:00:19.69 bitrate= 622.1kbits/s speed=3.91x    
frame=  632 fps=114 q=30.0 size=    1692kB time=00:00:21.06 bitrate= 658.3kbits/s speed= 3.8x    
frame=  692 fps=115 q=30.0 size=    1839kB time=00:00:23.06 bitrate= 652.9kbits/s speed=3.82x    
frame=  750 fps=115 q=30.0 size=    1968kB time=00:00:25.07 bitrate= 643.1kbits/s speed=3.83x    
frame=  811 fps=115 q=30.0 size=    2115kB time=00:00:27.07 bitrate= 639.8kbits/s speed=3.84x    
frame=  874 fps=116 q=30.0 size=    2258kB time=00:00:29.08 bitrate= 635.9kbits/s speed=3.85x    
frame=  930 fps=116 q=30.0 size=    2438kB time=00:00:31.08 bitrate= 642.5kbits/s speed=3.86x    
frame=  986 fps=115 q=30.0 size=    2592kB time=00:00:33.09 bitrate= 641.6kbits/s speed=3.87x    
frame= 1049 fps=116 q=30.0 size=    2745kB time=00:00:35.09 bitrate= 640.6kbits/s speed=3.87x    
frame= 1108 fps=116 q=30.0 size=    2892kB time=00:00:37.10 bitrate= 638.5kbits/s speed=3.88x    
frame= 1164 fps=116 q=30.0 size=    3053kB time=00:00:39.10 bitrate= 639.4kbits/s speed=3.88x    
frame= 1224 fps=116 q=30.0 size=    3185kB time=00:00:41.11 bitrate= 634.6kbits/s speed=3.89x    
frame= 1284 fps=116 q=30.0 size=    3306kB time=00:00:43.12 bitrate= 628.0kbits/s speed=3.89x    
frame= 1345 fps=116 q=30.0 size=    3433kB time=00:00:45.12 bitrate= 623.2kbits/s speed= 3.9x    
frame= 1407 fps=116 q=30.0 size=    3581kB time=00:00:47.13 bitrate= 622.4kbits/s speed= 3.9x    
frame= 1470 fps=117 q=30.0 size=    3705kB time=00:00:49.13 bitrate= 617.8kbits/s speed= 3.9x    
frame= 1532 fps=117 q=30.0 size=    3832kB time=00:00:51.14 bitrate= 613.8kbits/s speed=3.91x    
[libx264 @ 0x7fd2bc000600] Incomplete MB-tree stats file.
Video encoding failed
[libx264 @ 0x7fd2bc000600] frame I:12    Avg QP:24.36  size:  8693
[libx264 @ 0x7fd2bc000600] frame P:416   Avg QP:26.93  size:  3900
[libx264 @ 0x7fd2bc000600] frame B:1117  Avg QP:29.65  size:  1323
[libx264 @ 0x7fd2bc000600] consecutive B-frames:  1.9%  3.0%  6.2% 88.9%
[libx264 @ 0x7fd2bc000600] mb I  I16..4: 18.8% 66.8% 14.3%
[libx264 @ 0x7fd2bc000600] mb P  I16..4:  4.2%  7.9%  2.1%  P16..4: 43.2% 10.2%  4.5%  0.0%  0.0%    skip:27.8%
[libx264 @ 0x7fd2bc000600] mb B  I16..4:  0.5%  0.7%  0.2%  B16..8: 39.0%  3.8%  0.9%  direct: 2.3%  skip:52.7%  L0:44.3% L1:49.4% BI: 6.4%
[libx264 @ 0x7fd2bc000600] 8x8 transform intra:56.1% inter:83.0%
[libx264 @ 0x7fd2bc000600] coded y,uvDC,uvAC intra: 57.8% 60.2% 23.1% inter: 12.4% 11.7% 0.4%
[libx264 @ 0x7fd2bc000600] i16 v,h,dc,p: 83%  6%  1% 10%
[libx264 @ 0x7fd2bc000600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 53% 13%  9%  2%  3%  5%  4%  5%  6%
[libx264 @ 0x7fd2bc000600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 44% 14%  7%  4%  6%  9%  6%  6%  5%
[libx264 @ 0x7fd2bc000600] i8c dc,h,v,p: 48% 17% 27%  8%
[libx264 @ 0x7fd2bc000600] Weighted P-Frames: Y:14.2% UV:3.1%
[libx264 @ 0x7fd2bc000600] ref P L0: 50.1% 18.3% 20.3% 10.1%  1.1%
[libx264 @ 0x7fd2bc000600] ref B L0: 85.2% 11.0%  3.8%
[libx264 @ 0x7fd2bc000600] ref B L1: 94.9%  5.1%
[libx264 @ 0x7fd2bc000600] kb/s:497.76
[aac @ 0x7fd2bc001e00] Qavg: 1142.847
[aac @ 0x7fd2bc001e00] 2 frames left in the queue on closing
Conversion failed!

Maybe we are using different x264 versions? I'm using git master HEAD:

x264 0.148.2694 3b70645
(libswscale 4.1.100)
(libavformat 57.34.102)
built on Apr 29 2016, gcc: 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)
x264 configuration: --bit-depth=8 --chroma-format=all
libx264 configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat license: nonfree and unredistributable
WARNING: This binary is unredistributable!

comment:7 by Michael Niedermayer, 8 years ago

Here:

x264 0.146.2538 121396c
(libswscale 3.1.101)
(libavformat 56.30.100)
built on May 27 2015, gcc: 4.6.3
x264 configuration: --bit-depth=8 --chroma-format=all
libx264 configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat license: GPL version 2 or later

in reply to:  7 comment:8 by Christian Ebert, 8 years ago

Replying to michael:

Here:

x264 0.146.2538 121396c
(libswscale 3.1.101)
(libavformat 56.30.100)
built on May 27 2015, gcc: 4.6.3
x264 configuration: --bit-depth=8 --chroma-format=all
libx264 configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat license: GPL version 2 or later

I can't compile that x264 revision:

gcc -Wno-maybe-uninitialized -Wshadow -O3 -ffast-math -m64  -Wall -I. -I. -I/sw/include -arch x86_64 -std=gnu99  -I/usr/local/include   -I/usr/local/include  -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o output/matroska_ebml.o output/matroska_ebml.c
warningwarningwarning: : : warningwarningunknown: :  warning unknownoptionunknownunknown   unknown'-Wno-maybe-uninitialized';warning    warningwarningwarningdidwarning option option:    '-Wno-maybe-uninitialized'; option optionyou'-Wno-maybe-uninitialized'; did   did'-Wno-maybe-uninitialized';unknown  you '-Wno-maybe-uninitialized';mean   warningdidyou '-Wno-uninitialized'? meandid
 you        '-Wno-uninitialized'?option
[-Wunknown-warning-option]       youmean[-Wunknown-warning-option]
'-Wno-uninitialized'?meanmean

 '-Wno-uninitialized'?      '-Wno-uninitialized'?[-Wunknown-warning-option]

            [-Wunknown-warning-option]
[-Wunknown-warning-option]
'-Wno-maybe-uninitialized';
 did you mean '-Wno-uninitialized'?
      [-Wunknown-warning-option]
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'?
      [-Wunknown-warning-option]
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'?
      [-Wunknown-warning-option]
x264.c:445:27: error: variable has incomplete type 'enum PixelFormat'
    for( enum PixelFormat i = AV_PIX_FMT_NONE+1; i < AV_PIX_FMT_NB; i++ )
                          ^
x264.c:445:15: note: forward declaration of 'enum PixelFormat'
    for( enum PixelFormat i = AV_PIX_FMT_NONE+1; i < AV_PIX_FMT_NB; i++ )
              ^
x264.c:445:15: error: declaration of non-local variable in 'for' loop
    for( enum PixelFormat i = AV_PIX_FMT_NONE+1; i < AV_PIX_FMT_NB; i++ )
              ^
1 warning generated.
gcc -Wno-maybe-uninitialized -Wshadow -O3 -ffast-math -m64  -Wall -I. -I. -I/sw/include -arch x86_64 -std=gnu99  -I/usr/local/include   -I/usr/local/include  -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o output/flv.o output/flv.c
1 warning and 2 errors generated.
<builtin>: recipe for target 'x264.o' failed
make: *** [x264.o] Error 1
make: *** Waiting for unfinished jobs....

I'll try with x264 stable, and maybe other scenarios.

Here's with both ffmpeg git HEAD of yesterday and very latest x264 master HEAD.

I have also changed the filter chain: framerate=30,scale=640:360,fps=30 for these reasons:

  1. normally one would move framerate more to the beginning of the chain
  2. while 1. avoids the error, imho it also covers it up: adding fps at the end is the most compact way I found to simulate a more complex production scenario, it should also prove that something's fishy happens in the filter chain

Note that the x264 error has somewhat more details with its latest version.

$ ffmpeg -i issue5493.mp4 -filter:v framerate=30,scale=640:360,fps=30 -b:v 500k -pass 1 -y test.mp4
ffmpeg version N-80335-gcb46b78 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-shared --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 46.100 / 57. 46.100
  libavformat    57. 38.100 / 57. 38.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.101 /  6. 46.101
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue5493.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    com.android.version: 6.0.1
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7ff5b2d240a0] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7ff5b2d240a0] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7ff5b3009e00] using SAR=1/1
[libx264 @ 0x7ff5b3009e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7ff5b3009e00] profile Main, level 3.0
[libx264 @ 0x7ff5b3009e00] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=11 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x7ff5b3008c00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 6.0.1
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    encoder         : Lavf57.38.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 500 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.46.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/500000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.46.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=   60 fps=0.0 q=37.0 size=      10kB time=00:00:03.01 bitrate=  25.9kbits/s speed=5.96x    
frame=  134 fps=133 q=31.0 size=     177kB time=00:00:05.01 bitrate= 289.1kbits/s speed=4.97x    
frame=  207 fps=137 q=30.0 size=     361kB time=00:00:07.02 bitrate= 421.1kbits/s speed=4.65x    
frame=  274 fps=136 q=28.0 size=     511kB time=00:00:10.03 bitrate= 417.4kbits/s speed=4.98x    
frame=  346 fps=137 q=28.0 size=     701kB time=00:00:12.03 bitrate= 476.9kbits/s speed=4.77x    
frame=  417 fps=138 q=31.0 size=     957kB time=00:00:14.04 bitrate= 558.0kbits/s speed=4.65x    
frame=  486 fps=138 q=30.0 size=    1111kB time=00:00:17.05 bitrate= 533.7kbits/s speed=4.83x    
frame=  558 fps=138 q=30.0 size=    1280kB time=00:00:19.05 bitrate= 550.2kbits/s speed=4.73x    
frame=  631 fps=139 q=31.0 size=    1509kB time=00:00:21.06 bitrate= 586.7kbits/s speed=4.65x    
frame=  699 fps=139 q=31.0 size=    1692kB time=00:00:24.06 bitrate= 575.9kbits/s speed=4.78x    
frame=  770 fps=139 q=30.0 size=    1838kB time=00:00:26.07 bitrate= 577.4kbits/s speed=4.71x    
frame=  843 fps=140 q=30.0 size=    1998kB time=00:00:28.08 bitrate= 582.8kbits/s speed=4.65x    
frame=  908 fps=139 q=29.0 size=    2145kB time=00:00:30.10 bitrate= 583.5kbits/s speed= 4.6x    
frame=  971 fps=138 q=30.0 size=    2347kB time=00:00:32.38 bitrate= 593.5kbits/s speed= 4.6x    
frame= 1037 fps=137 q=30.0 size=    2514kB time=00:00:35.09 bitrate= 586.8kbits/s speed=4.65x    
frame= 1102 fps=137 q=30.0 size=    2662kB time=00:00:37.10 bitrate= 587.7kbits/s speed=4.61x    
frame= 1169 fps=137 q=30.0 size=    2837kB time=00:00:39.10 bitrate= 594.2kbits/s speed=4.57x    
frame= 1235 fps=136 q=30.0 size=    3003kB time=00:00:41.11 bitrate= 598.4kbits/s speed=4.54x    
frame= 1294 fps=135 q=29.0 size=    3120kB time=00:00:43.12 bitrate= 592.7kbits/s speed=4.51x    
frame= 1367 fps=136 q=29.0 size=    3281kB time=00:00:45.12 bitrate= 595.6kbits/s speed=4.49x    
frame= 1430 fps=135 q=29.0 size=    3433kB time=00:00:47.13 bitrate= 596.7kbits/s speed=4.46x    
frame= 1493 fps=135 q=29.0 size=    3586kB time=00:00:49.86 bitrate= 589.2kbits/s speed=4.51x    
frame= 1557 fps=135 q=28.0 size=    3729kB time=00:00:52.08 bitrate= 586.5kbits/s speed=4.51x    
frame= 1559 fps=134 q=-1.0 Lsize=    3989kB time=00:00:52.12 bitrate= 627.0kbits/s speed=4.48x    
video:3119kB audio:813kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.448805%
[libx264 @ 0x7ff5b3009e00] frame I:12    Avg QP:24.46  size:  8829
[libx264 @ 0x7ff5b3009e00] frame P:419   Avg QP:26.64  size:  4157
[libx264 @ 0x7ff5b3009e00] frame B:1128  Avg QP:29.56  size:  1193
[libx264 @ 0x7ff5b3009e00] consecutive B-frames:  1.9%  3.0%  6.2% 89.0%
[libx264 @ 0x7ff5b3009e00] mb I  I16..4: 49.9%  0.0% 50.1%
[libx264 @ 0x7ff5b3009e00] mb P  I16..4: 23.3%  0.0%  0.0%  P16..4: 49.3%  0.0%  0.0%  0.0%  0.0%    skip:27.3%
[libx264 @ 0x7ff5b3009e00] mb B  I16..4:  3.4%  0.0%  0.0%  B16..8: 19.2%  0.0%  0.0%  direct: 7.1%  skip:70.3%  L0:35.8% L1:43.1% BI:21.2%
[libx264 @ 0x7ff5b3009e00] final ratefactor: 23.53
[libx264 @ 0x7ff5b3009e00] coded y,uvDC,uvAC intra: 45.2% 40.8% 10.6% inter: 9.6% 8.2% 0.3%
[libx264 @ 0x7ff5b3009e00] i16 v,h,dc,p: 74% 13%  7%  6%
[libx264 @ 0x7ff5b3009e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 27% 10%  3%  3%  4%  3%  3%  5%
[libx264 @ 0x7ff5b3009e00] i8c dc,h,v,p: 48% 16% 31%  6%
[libx264 @ 0x7ff5b3009e00] Weighted P-Frames: Y:14.6% UV:3.6%
[libx264 @ 0x7ff5b3009e00] kb/s:491.59
[aac @ 0x7ff5b300b600] Qavg: 1142.250
$ ffmpeg -i issue5493.mp4 -filter:v framerate=30,scale=640:360,fps=30 -b:v 500k -pass 2 -y test.mp4
ffmpeg version N-80335-gcb46b78 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-shared --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 46.100 / 57. 46.100
  libavformat    57. 38.100 / 57. 38.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.101 /  6. 46.101
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue5493.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    com.android.version: 6.0.1
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7fe6984253e0] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7fe6984253e0] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7fe698810200] using SAR=1/1
[libx264 @ 0x7fe698810200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fe698810200] profile High, level 3.0
[libx264 @ 0x7fe698810200] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=11 lookahead_threads=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=500 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 @ 0x7fe69899b600] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 6.0.1
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    encoder         : Lavf57.38.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 500 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.46.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/500000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.46.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=   52 fps=0.0 q=31.0 size=     119kB time=00:00:02.45 bitrate= 398.0kbits/s speed=4.91x    
frame=  112 fps=112 q=28.0 size=     266kB time=00:00:04.01 bitrate= 542.8kbits/s speed=4.01x    
frame=  172 fps=115 q=30.0 size=     419kB time=00:00:06.02 bitrate= 569.7kbits/s speed=4.01x    
frame=  229 fps=114 q=30.0 size=     539kB time=00:00:08.02 bitrate= 550.4kbits/s speed=4.01x    
frame=  289 fps=115 q=30.0 size=     670kB time=00:00:10.03 bitrate= 547.2kbits/s speed=4.01x    
frame=  349 fps=116 q=30.0 size=     842kB time=00:00:12.03 bitrate= 572.7kbits/s speed=3.99x    
frame=  406 fps=115 q=30.0 size=    1035kB time=00:00:14.04 bitrate= 603.9kbits/s speed=3.99x    
frame=  467 fps=116 q=30.0 size=    1166kB time=00:00:16.04 bitrate= 595.3kbits/s speed=3.99x    
frame=  525 fps=116 q=30.0 size=    1328kB time=00:00:18.05 bitrate= 602.5kbits/s speed=3.99x    
frame=  579 fps=115 q=30.0 size=    1515kB time=00:00:20.05 bitrate= 618.7kbits/s speed=3.99x    
frame=  636 fps=115 q=30.0 size=    1704kB time=00:00:21.68 bitrate= 643.8kbits/s speed=3.92x    
frame=  697 fps=116 q=30.0 size=    1850kB time=00:00:23.81 bitrate= 636.5kbits/s speed=3.95x    
frame=  758 fps=116 q=30.0 size=    1987kB time=00:00:25.60 bitrate= 635.8kbits/s speed=3.92x    
frame=  820 fps=117 q=30.0 size=    2132kB time=00:00:28.08 bitrate= 622.1kbits/s speed=3.99x    
frame=  880 fps=117 q=30.0 size=    2279kB time=00:00:29.44 bitrate= 634.0kbits/s speed=3.91x    
frame=  940 fps=117 q=30.0 size=    2471kB time=00:00:31.08 bitrate= 651.2kbits/s speed=3.87x    
frame=  998 fps=117 q=30.0 size=    2622kB time=00:00:33.09 bitrate= 649.1kbits/s speed=3.88x    
frame= 1060 fps=117 q=30.0 size=    2765kB time=00:00:35.09 bitrate= 645.3kbits/s speed=3.88x    
frame= 1117 fps=117 q=30.0 size=    2915kB time=00:00:37.10 bitrate= 643.5kbits/s speed=3.89x    
frame= 1172 fps=117 q=30.0 size=    3069kB time=00:00:39.10 bitrate= 642.9kbits/s speed=3.89x    
frame= 1234 fps=117 q=30.0 size=    3203kB time=00:00:41.11 bitrate= 638.1kbits/s speed=3.89x    
frame= 1296 fps=117 q=30.0 size=    3331kB time=00:00:43.12 bitrate= 632.8kbits/s speed= 3.9x    
frame= 1357 fps=117 q=30.0 size=    3459kB time=00:00:45.12 bitrate= 628.0kbits/s speed= 3.9x    
frame= 1416 fps=117 q=30.0 size=    3598kB time=00:00:47.13 bitrate= 625.3kbits/s speed= 3.9x    
frame= 1478 fps=117 q=30.0 size=    3721kB time=00:00:49.13 bitrate= 620.4kbits/s speed= 3.9x    
frame= 1538 fps=117 q=30.0 size=    3852kB time=00:00:51.14 bitrate= 617.1kbits/s speed= 3.9x    
[libx264 @ 0x7fe698810200] 2nd pass has more frames than 1st pass (1559)
[libx264 @ 0x7fe698810200] continuing anyway, at constant QP=27
[libx264 @ 0x7fe698810200] disabling adaptive B-frames
[libx264 @ 0x7fe698810200] specified frame type is not compatible with max B-frames
$ x264 --version
x264 0.148.2705 3f5ed56
(libswscale 4.1.100)
(libavformat 57.37.101)
built on Jun 15 2016, gcc: 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)
x264 configuration: --bit-depth=8 --chroma-format=all
libx264 configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat license: nonfree and unredistributable
WARNING: This binary is unredistributable!

in reply to:  7 comment:9 by Christian Ebert, 8 years ago

Replying to michael:

Here:

x264 0.146.2538 121396c
(libswscale 3.1.101)
(libavformat 56.30.100)
built on May 27 2015, gcc: 4.6.3
x264 configuration: --bit-depth=8 --chroma-format=all
libx264 configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat license: GPL version 2 or later

ffmpeg before 16f08b7a0918ec93d377bfd151e6551da4c3b38f bisected by cehoyos has no trouble with latest x264:

$ ffmpeg -i issue5493.mp4 -filter:v framerate=30,scale=640:360,fps=30 -b:v 500k -pass 1 -y test.mp4
ffmpeg version N-75265-g349970a Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55.  2.100 / 55.  2.100
  libavcodec     57.  1.100 / 57.  1.100
  libavformat    57.  0.100 / 57.  0.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6.  2.100 /  6.  2.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue5493.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7f9f58400ea0] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7f9f58400ea0] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7f9f58985a00] using SAR=1/1
[libx264 @ 0x7f9f58985a00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7f9f58985a00] profile Main, level 3.0
[libx264 @ 0x7f9f58985a00] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=11 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    location-eng    : +60.4916+022.2685/
    location        : +60.4916+022.2685/
    encoder         : Lavf57.0.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, pass 1, 500 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.1.100 libx264
    Stream #0:1(eng): Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.1.100 libfaac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (libfaac))
Press [q] to stop, [?] for help
frame=   62 fps=0.0 q=37.0 size=      12kB time=00:00:02.97 bitrate=  33.3kbits/s    
frame=  139 fps=139 q=30.0 size=     198kB time=00:00:04.97 bitrate= 326.3kbits/s    
frame=  214 fps=142 q=30.0 size=     381kB time=00:00:07.98 bitrate= 391.0kbits/s    
frame=  293 fps=145 q=28.0 size=     560kB time=00:00:09.98 bitrate= 459.5kbits/s    
frame=  368 fps=146 q=29.0 size=     774kB time=00:00:12.99 bitrate= 487.6kbits/s    
frame=  442 fps=146 q=31.0 size=    1028kB time=00:00:15.00 bitrate= 561.1kbits/s    
frame=  515 fps=146 q=30.0 size=    1182kB time=00:00:18.01 bitrate= 537.5kbits/s    
frame=  590 fps=146 q=30.0 size=    1375kB time=00:00:20.01 bitrate= 562.9kbits/s    
frame=  664 fps=147 q=31.0 size=    1612kB time=00:00:22.02 bitrate= 599.6kbits/s    
frame=  739 fps=147 q=31.0 size=    1778kB time=00:00:25.02 bitrate= 581.8kbits/s    
frame=  814 fps=147 q=30.0 size=    1930kB time=00:00:27.03 bitrate= 584.9kbits/s    
frame=  888 fps=147 q=29.0 size=    2099kB time=00:00:30.04 bitrate= 572.5kbits/s    
frame=  961 fps=147 q=30.0 size=    2317kB time=00:00:32.04 bitrate= 592.2kbits/s    
frame= 1031 fps=146 q=30.0 size=    2504kB time=00:00:34.92 bitrate= 587.3kbits/s    
frame= 1109 fps=147 q=30.0 size=    2678kB time=00:00:37.06 bitrate= 591.9kbits/s    
frame= 1184 fps=147 q=30.0 size=    2881kB time=00:00:39.06 bitrate= 604.1kbits/s    
frame= 1256 fps=147 q=30.0 size=    3055kB time=00:00:42.07 bitrate= 594.8kbits/s    
frame= 1333 fps=147 q=29.0 size=    3210kB time=00:00:44.08 bitrate= 596.5kbits/s    
frame= 1407 fps=147 q=29.0 size=    3379kB time=00:00:47.08 bitrate= 587.9kbits/s    
frame= 1480 fps=147 q=29.0 size=    3563kB time=00:00:49.09 bitrate= 594.5kbits/s    
frame= 1552 fps=147 q=28.0 size=    3721kB time=00:00:52.03 bitrate= 585.7kbits/s    
frame= 1558 fps=146 q=-1.0 Lsize=    3987kB time=00:00:52.12 bitrate= 626.7kbits/s    
video:3116kB audio:815kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.448293%
[libx264 @ 0x7f9f58985a00] frame I:12    Avg QP:24.46  size:  8829
[libx264 @ 0x7f9f58985a00] frame P:419   Avg QP:26.64  size:  4158
[libx264 @ 0x7f9f58985a00] frame B:1127  Avg QP:29.56  size:  1190
[libx264 @ 0x7f9f58985a00] consecutive B-frames:  1.9%  3.0%  6.4% 88.8%
[libx264 @ 0x7f9f58985a00] mb I  I16..4: 49.9%  0.0% 50.1%
[libx264 @ 0x7f9f58985a00] mb P  I16..4: 23.3%  0.0%  0.0%  P16..4: 49.3%  0.0%  0.0%  0.0%  0.0%    skip:27.4%
[libx264 @ 0x7f9f58985a00] mb B  I16..4:  3.4%  0.0%  0.0%  B16..8: 19.2%  0.0%  0.0%  direct: 7.1%  skip:70.3%  L0:35.7% L1:43.1% BI:21.1%
[libx264 @ 0x7f9f58985a00] final ratefactor: 23.53
[libx264 @ 0x7f9f58985a00] coded y,uvDC,uvAC intra: 45.3% 40.8% 10.6% inter: 9.6% 8.2% 0.3%
[libx264 @ 0x7f9f58985a00] i16 v,h,dc,p: 74% 13%  7%  6%
[libx264 @ 0x7f9f58985a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 27% 10%  3%  3%  4%  3%  3%  5%
[libx264 @ 0x7f9f58985a00] i8c dc,h,v,p: 48% 16% 31%  6%
[libx264 @ 0x7f9f58985a00] Weighted P-Frames: Y:14.6% UV:3.3%
[libx264 @ 0x7f9f58985a00] kb/s:491.36
$ ffmpeg -i issue5493.mp4 -filter:v framerate=30,scale=640:360,fps=30 -b:v 500k -pass 2 -y test.mp4
ffmpeg version N-75265-g349970a Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55.  2.100 / 55.  2.100
  libavcodec     57.  1.100 / 57.  1.100
  libavformat    57.  0.100 / 57.  0.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6.  2.100 /  6.  2.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue5493.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7ff943d06fe0] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7ff943d06fe0] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7ff944808400] using SAR=1/1
[libx264 @ 0x7ff944808400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7ff944808400] profile High, level 3.0
[libx264 @ 0x7ff944808400] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=11 lookahead_threads=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=500 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 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    location-eng    : +60.4916+022.2685/
    location        : +60.4916+022.2685/
    encoder         : Lavf57.0.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, pass 2, 500 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.1.100 libx264
    Stream #0:1(eng): Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.1.100 libfaac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (libfaac))
Press [q] to stop, [?] for help
frame=   52 fps=0.0 q=31.0 size=     122kB time=00:00:02.56 bitrate= 390.3kbits/s    
frame=  113 fps=113 q=30.0 size=     274kB time=00:00:04.03 bitrate= 556.4kbits/s    
frame=  175 fps=117 q=30.0 size=     437kB time=00:00:05.97 bitrate= 598.2kbits/s    
frame=  237 fps=118 q=30.0 size=     564kB time=00:00:08.00 bitrate= 577.6kbits/s    
frame=  299 fps=119 q=30.0 size=     697kB time=00:00:10.01 bitrate= 570.5kbits/s    
frame=  359 fps=119 q=30.0 size=     889kB time=00:00:11.99 bitrate= 607.0kbits/s    
frame=  419 fps=119 q=30.0 size=    1074kB time=00:00:14.00 bitrate= 628.3kbits/s    
frame=  482 fps=120 q=30.0 size=    1224kB time=00:00:16.02 bitrate= 625.8kbits/s    
frame=  541 fps=120 q=30.0 size=    1379kB time=00:00:18.03 bitrate= 626.6kbits/s    
frame=  598 fps=119 q=30.0 size=    1576kB time=00:00:20.01 bitrate= 644.9kbits/s    
frame=  655 fps=119 q=30.0 size=    1760kB time=00:00:22.02 bitrate= 654.8kbits/s    
frame=  718 fps=119 q=30.0 size=    1907kB time=00:00:24.02 bitrate= 650.3kbits/s    
frame=  778 fps=119 q=30.0 size=    2037kB time=00:00:26.03 bitrate= 641.0kbits/s    
frame=  841 fps=119 q=30.0 size=    2185kB time=00:00:28.03 bitrate= 638.4kbits/s    
frame=  901 fps=119 q=30.0 size=    2359kB time=00:00:30.04 bitrate= 643.1kbits/s    
frame=  962 fps=119 q=30.0 size=    2540kB time=00:00:32.04 bitrate= 649.3kbits/s    
frame= 1022 fps=119 q=30.0 size=    2685kB time=00:00:34.05 bitrate= 646.0kbits/s    
frame= 1084 fps=120 q=30.0 size=    2822kB time=00:00:36.05 bitrate= 641.1kbits/s    
frame= 1140 fps=119 q=30.0 size=    2982kB time=00:00:38.06 bitrate= 641.7kbits/s    
frame= 1203 fps=119 q=30.0 size=    3141kB time=00:00:40.06 bitrate= 642.1kbits/s    
frame= 1265 fps=120 q=30.0 size=    3272kB time=00:00:42.07 bitrate= 637.0kbits/s    
frame= 1329 fps=120 q=30.0 size=    3404kB time=00:00:44.08 bitrate= 632.6kbits/s    
frame= 1391 fps=120 q=30.0 size=    3540kB time=00:00:46.08 bitrate= 629.2kbits/s    
frame= 1455 fps=120 q=30.0 size=    3681kB time=00:00:48.09 bitrate= 627.0kbits/s    
frame= 1516 fps=120 q=30.0 size=    3803kB time=00:00:50.09 bitrate= 621.9kbits/s    
frame= 1558 fps=120 q=-1.0 Lsize=    4037kB time=00:00:52.12 bitrate= 634.5kbits/s    
video:3165kB audio:815kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.430352%
[libx264 @ 0x7ff944808400] frame I:12    Avg QP:24.36  size:  8702
[libx264 @ 0x7ff944808400] frame P:419   Avg QP:26.92  size:  3913
[libx264 @ 0x7ff944808400] frame B:1127  Avg QP:29.64  size:  1328
[libx264 @ 0x7ff944808400] consecutive B-frames:  1.9%  3.0%  6.4% 88.8%
[libx264 @ 0x7ff944808400] mb I  I16..4: 19.0% 67.0% 14.0%
[libx264 @ 0x7ff944808400] mb P  I16..4:  4.3%  8.1%  2.2%  P16..4: 43.3% 10.1%  4.4%  0.0%  0.0%    skip:27.6%
[libx264 @ 0x7ff944808400] mb B  I16..4:  0.5%  0.7%  0.1%  B16..8: 38.8%  3.8%  0.9%  direct: 2.4%  skip:52.8%  L0:44.3% L1:49.3% BI: 6.4%
[libx264 @ 0x7ff944808400] 8x8 transform intra:56.6% inter:83.0%
[libx264 @ 0x7ff944808400] coded y,uvDC,uvAC intra: 57.9% 60.5% 22.8% inter: 12.4% 11.8% 0.4%
[libx264 @ 0x7ff944808400] i16 v,h,dc,p: 81%  7%  1% 11%
[libx264 @ 0x7ff944808400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 52% 13% 10%  2%  4%  5%  4%  5%  6%
[libx264 @ 0x7ff944808400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 44% 14%  8%  4%  6%  8%  6%  6%  4%
[libx264 @ 0x7ff944808400] i8c dc,h,v,p: 48% 18% 27%  8%
[libx264 @ 0x7ff944808400] Weighted P-Frames: Y:14.6% UV:3.3%
[libx264 @ 0x7ff944808400] ref P L0: 49.9% 18.6% 20.3% 10.1%  1.1%
[libx264 @ 0x7ff944808400] ref B L0: 85.2% 11.0%  3.8%
[libx264 @ 0x7ff944808400] ref B L1: 95.1%  4.9%
[libx264 @ 0x7ff944808400] kb/s:499.17
$ x264 --version
x264 0.148.2705 3f5ed56
(libswscale 4.1.100)
(libavformat 57.37.101)
built on Jun 15 2016, gcc: 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)
x264 configuration: --bit-depth=8 --chroma-format=all
libx264 configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat license: nonfree and unredistributable
WARNING: This binary is unredistributable!

From this perspective it looks like a filter regression.

in reply to:  7 comment:10 by Christian Ebert, 8 years ago

Replying to michael:

Here:

x264 0.146.2538 121396c
(libswscale 3.1.101)
(libavformat 56.30.100)
built on May 27 2015, gcc: 4.6.3
x264 configuration: --bit-depth=8 --chroma-format=all
libx264 configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat license: GPL version 2 or later

The issue is also present with x264 stable:

$ ffmpeg -i issue5493.mp4 -filter:v framerate=30,scale=640:360,fps=30 -b:v 500k -pass 1 -y test.mp4
ffmpeg version N-80335-gcb46b78 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 46.100 / 57. 46.100
  libavformat    57. 38.100 / 57. 38.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.101 /  6. 46.101
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue5493.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    com.android.version: 6.0.1
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7fd821408280] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7fd821408280] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7fd821822600] using SAR=1/1
[libx264 @ 0x7fd821822600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fd821822600] profile Main, level 3.0
[libx264 @ 0x7fd821822600] 264 - core 148 r2699 a5e06b9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=11 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x7fd821821400] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 6.0.1
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    encoder         : Lavf57.38.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 500 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.46.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/500000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.46.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=   58 fps=0.0 q=36.0 size=       9kB time=00:00:03.01 bitrate=  24.0kbits/s speed=6.02x    
frame=  133 fps=132 q=30.0 size=     176kB time=00:00:05.01 bitrate= 287.2kbits/s speed=4.98x    
frame=  207 fps=137 q=30.0 size=     361kB time=00:00:07.02 bitrate= 421.1kbits/s speed=4.65x    
frame=  272 fps=135 q=28.0 size=     505kB time=00:00:10.03 bitrate= 412.6kbits/s speed=4.97x    
frame=  346 fps=137 q=28.0 size=     701kB time=00:00:12.03 bitrate= 476.9kbits/s speed=4.78x    
frame=  417 fps=138 q=31.0 size=     957kB time=00:00:14.04 bitrate= 558.0kbits/s speed=4.64x    
frame=  484 fps=137 q=30.0 size=    1105kB time=00:00:17.05 bitrate= 530.8kbits/s speed=4.84x    
frame=  558 fps=139 q=30.0 size=    1280kB time=00:00:19.05 bitrate= 550.2kbits/s speed=4.73x    
frame=  630 fps=139 q=31.0 size=    1504kB time=00:00:21.06 bitrate= 585.0kbits/s speed=4.65x    
frame=  697 fps=139 q=31.0 size=    1687kB time=00:00:24.04 bitrate= 574.8kbits/s speed=4.78x    
frame=  771 fps=139 q=30.0 size=    1840kB time=00:00:26.07 bitrate= 578.2kbits/s speed=4.72x    
frame=  846 fps=140 q=30.0 size=    2003kB time=00:00:28.08 bitrate= 584.3kbits/s speed=4.65x    
frame=  912 fps=139 q=30.0 size=    2155kB time=00:00:31.08 bitrate= 567.9kbits/s speed=4.75x    
frame=  982 fps=139 q=30.0 size=    2384kB time=00:00:33.09 bitrate= 590.2kbits/s speed= 4.7x    
frame= 1051 fps=139 q=30.0 size=    2548kB time=00:00:35.09 bitrate= 594.6kbits/s speed=4.65x    
frame= 1120 fps=139 q=30.0 size=    2697kB time=00:00:37.10 bitrate= 595.5kbits/s speed=4.61x    
frame= 1186 fps=139 q=30.0 size=    2883kB time=00:00:39.25 bitrate= 601.6kbits/s speed=4.59x    
frame= 1258 fps=139 q=30.0 size=    3055kB time=00:00:42.11 bitrate= 594.2kbits/s speed=4.65x    
frame= 1333 fps=139 q=29.0 size=    3207kB time=00:00:44.12 bitrate= 595.4kbits/s speed=4.62x    
frame= 1401 fps=139 q=29.0 size=    3363kB time=00:00:46.14 bitrate= 596.9kbits/s speed=4.59x    
frame= 1466 fps=139 q=29.0 size=    3532kB time=00:00:49.13 bitrate= 588.8kbits/s speed=4.65x    
frame= 1537 fps=139 q=28.0 size=    3680kB time=00:00:51.14 bitrate= 589.5kbits/s speed=4.62x    
frame= 1559 fps=138 q=-1.0 Lsize=    3989kB time=00:00:52.12 bitrate= 627.0kbits/s speed=4.62x    
video:3119kB audio:813kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.448805%
[libx264 @ 0x7fd821822600] frame I:12    Avg QP:24.46  size:  8829
[libx264 @ 0x7fd821822600] frame P:419   Avg QP:26.64  size:  4157
[libx264 @ 0x7fd821822600] frame B:1128  Avg QP:29.56  size:  1193
[libx264 @ 0x7fd821822600] consecutive B-frames:  1.9%  3.0%  6.2% 89.0%
[libx264 @ 0x7fd821822600] mb I  I16..4: 49.9%  0.0% 50.1%
[libx264 @ 0x7fd821822600] mb P  I16..4: 23.3%  0.0%  0.0%  P16..4: 49.3%  0.0%  0.0%  0.0%  0.0%    skip:27.3%
[libx264 @ 0x7fd821822600] mb B  I16..4:  3.4%  0.0%  0.0%  B16..8: 19.2%  0.0%  0.0%  direct: 7.1%  skip:70.3%  L0:35.8% L1:43.1% BI:21.2%
[libx264 @ 0x7fd821822600] final ratefactor: 23.53
[libx264 @ 0x7fd821822600] coded y,uvDC,uvAC intra: 45.2% 40.8% 10.6% inter: 9.6% 8.2% 0.3%
[libx264 @ 0x7fd821822600] i16 v,h,dc,p: 74% 13%  7%  6%
[libx264 @ 0x7fd821822600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 27% 10%  3%  3%  4%  3%  3%  5%
[libx264 @ 0x7fd821822600] i8c dc,h,v,p: 48% 16% 31%  6%
[libx264 @ 0x7fd821822600] Weighted P-Frames: Y:14.6% UV:3.6%
[libx264 @ 0x7fd821822600] kb/s:491.59
[aac @ 0x7fd82182bc00] Qavg: 1142.250
$ ffmpeg -i issue5493.mp4 -filter:v framerate=30,scale=640:360,fps=30 -b:v 500k -pass 2 -y test.mp4
ffmpeg version N-80335-gcb46b78 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --enable-gpl --enable-nonfree --disable-ffserver --enable-openssl --enable-libspeex --enable-libopus --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 46.100 / 57. 46.100
  libavformat    57. 38.100 / 57. 38.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.101 /  6. 46.101
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'issue5493.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-04-24 09:48:33
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    com.android.version: 6.0.1
  Duration: 00:00:52.12, start: 0.000000, bitrate: 15880 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 15715 kb/s, SAR 1:1 DAR 16:9, 25.48 fps, 90k tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
[Parsed_framerate_0 @ 0x7fe522422e60] time base:1/90000 -> 1/90000 exact:1
[Parsed_framerate_0 @ 0x7fe522422e60] fps -> fps:30/1 scene score:7.000000 interpolate start:15 end:240
[libx264 @ 0x7fe523001200] using SAR=1/1
[libx264 @ 0x7fe523001200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fe523001200] profile High, level 3.0
[libx264 @ 0x7fe523001200] 264 - core 148 r2699 a5e06b9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=11 lookahead_threads=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=500 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 @ 0x7fe523000000] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 6.0.1
    location        : +60.4916+022.2685/
    location-eng    : +60.4916+022.2685/
    encoder         : Lavf57.38.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 500 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : VideoHandle
      encoder         : Lavc57.46.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/500000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-04-24 09:48:33
      handler_name    : SoundHandle
      encoder         : Lavc57.46.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=   52 fps=0.0 q=31.0 size=     119kB time=00:00:02.35 bitrate= 416.1kbits/s speed= 4.7x    
frame=  113 fps=113 q=30.0 size=     267kB time=00:00:04.01 bitrate= 544.6kbits/s speed=4.01x    
frame=  177 fps=117 q=30.0 size=     433kB time=00:00:06.02 bitrate= 589.2kbits/s speed=3.99x    
frame=  235 fps=117 q=30.0 size=     552kB time=00:00:08.02 bitrate= 563.5kbits/s speed=3.99x    
frame=  293 fps=116 q=30.0 size=     678kB time=00:00:10.03 bitrate= 553.7kbits/s speed=3.99x    
frame=  349 fps=115 q=30.0 size=     842kB time=00:00:12.03 bitrate= 572.7kbits/s speed=3.98x    
frame=  407 fps=115 q=30.0 size=    1039kB time=00:00:14.04 bitrate= 606.0kbits/s speed=3.98x    
frame=  467 fps=116 q=30.0 size=    1166kB time=00:00:16.04 bitrate= 595.3kbits/s speed=3.98x    
frame=  525 fps=116 q=30.0 size=    1328kB time=00:00:18.05 bitrate= 602.5kbits/s speed=3.98x    
frame=  579 fps=115 q=30.0 size=    1515kB time=00:00:20.05 bitrate= 618.7kbits/s speed=3.99x    
frame=  636 fps=115 q=30.0 size=    1704kB time=00:00:21.08 bitrate= 662.0kbits/s speed=3.81x    
frame=  697 fps=115 q=30.0 size=    1850kB time=00:00:23.06 bitrate= 657.1kbits/s speed=3.82x    
frame=  755 fps=115 q=30.0 size=    1979kB time=00:00:25.07 bitrate= 646.7kbits/s speed=3.83x    
frame=  814 fps=115 q=30.0 size=    2119kB time=00:00:27.07 bitrate= 641.1kbits/s speed=3.84x    
frame=  875 fps=116 q=30.0 size=    2261kB time=00:00:29.08 bitrate= 637.0kbits/s speed=3.85x    
frame=  930 fps=115 q=30.0 size=    2438kB time=00:00:31.08 bitrate= 642.5kbits/s speed=3.86x    
frame=  987 fps=115 q=30.0 size=    2594kB time=00:00:33.09 bitrate= 642.0kbits/s speed=3.86x    
frame= 1048 fps=115 q=30.0 size=    2741kB time=00:00:35.09 bitrate= 639.7kbits/s speed=3.87x    
frame= 1104 fps=115 q=30.0 size=    2877kB time=00:00:37.10 bitrate= 635.1kbits/s speed=3.87x    
frame= 1158 fps=115 q=30.0 size=    3040kB time=00:00:39.10 bitrate= 636.8kbits/s speed=3.88x    
frame= 1219 fps=115 q=30.0 size=    3175kB time=00:00:41.11 bitrate= 632.6kbits/s speed=3.88x    
frame= 1279 fps=115 q=30.0 size=    3293kB time=00:00:42.82 bitrate= 630.0kbits/s speed=3.86x    
frame= 1340 fps=116 q=30.0 size=    3423kB time=00:00:44.78 bitrate= 626.1kbits/s speed=3.87x    
frame= 1401 fps=116 q=30.0 size=    3569kB time=00:00:46.34 bitrate= 630.8kbits/s speed=3.83x    
frame= 1461 fps=116 q=30.0 size=    3686kB time=00:00:48.13 bitrate= 627.3kbits/s speed=3.82x    
frame= 1522 fps=116 q=30.0 size=    3807kB time=00:00:50.16 bitrate= 621.7kbits/s speed=3.83x    
[libx264 @ 0x7fe523001200] 2nd pass has more frames than 1st pass (1559)
[libx264 @ 0x7fe523001200] continuing anyway, at constant QP=27
[libx264 @ 0x7fe523001200] disabling adaptive B-frames
[libx264 @ 0x7fe523001200] specified frame type is not compatible with max B-frames
$ x264 --version
x264 0.148.2699 a5e06b9
(libswscale 4.1.100)
(libavformat 57.38.100)
built on Jun 15 2016, gcc: 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)
x264 configuration: --bit-depth=8 --chroma-format=all
libx264 configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat license: nonfree and unredistributable
WARNING: This binary is unredistributable!

To be honest I'm deeply reluctant to try out various older x264 releases because

  • I'm brainwashed to use ffmpeg git HEAD, so why not do the same for the tools in the ffmpeg toolbox? (unless it's a clear cut bug)
  • from the outside looking in it _does_ look like a filter regression, at least appending fps to chain should not trigger the issue at all shouldn't it?

comment:11 by Michael Niedermayer, 8 years ago

Cc: Michael Niedermayer removed
Keywords: regression removed
Summary: incomplete x264 MB tree with framerate filterframerate filter outputs an undefined number of frames with x264

This seems a bug in the framerate filter, pending_input_frames starts drifting apart between pass 1 and 2 caused by different patterns of request_frame calls and ultimatly resulting in diferent output frame numbers.
This on my box only reproduces with -threads 1 (but any x264 version)
i do not think this is a regression, the commit in question indicates that flushing did not work correctly before and this ticket indicates it still doesnt work.
Ill leave this to stefano and paul as they know the code better

comment:12 by Michael Niedermayer, 8 years ago

Keywords: libx264 removed
Summary: framerate filter outputs an undefined number of frames with x264framerate filter output appears to be affected by request_frame() calls

this can be reproduced with:

./ffmpeg  -i ~/tickets/5493/issue5493.mp4 -filter:v framerate=30,scale=640:360,fps=30 -f framecrc A
./ffmpeg -threads 1 -i ~/tickets/5493/issue5493.mp4 -filter:v framerate=30,scale=640:360,fps=30 -f framecrc B
diff -u A B

--- A   2016-06-22 16:31:26.633033665 +0200
+++ B   2016-06-22 16:31:06.057033231 +0200
@@ -560,25 +560,25 @@
 1,     342290,     342290,     1024,     4096, 0x445206ff
 0,        214,        214,        1,   345600, 0x4017bedd
 1,     343314,     343314,     1024,     4096, 0xfdc5dcbf
-0,        215,        215,        1,   345600, 0xfc5a89e7
+0,        215,        215,        1,   345600, 0x4017bedd
 1,     344338,     344338,     1024,     4096, 0x21d21a3c
 1,     345362,     345362,     1024,     4096, 0x69ccf0a0
-0,        216,        216,        1,   345600, 0x72119102
+0,        216,        216,        1,   345600, 0xc36ba5f7
 1,     346386,     346386,     1024,     4096, 0x6b5f2c63
-0,        217,        217,        1,   345600, 0x8888a036
+0,        217,        217,        1,   345600, 0x9e679ff2
 1,     347410,     347410,     1024,     4096, 0xade4587c
 1,     348434,     348434,     1024,     4096, 0x1b0c0bad
 0,        218,        218,        1,   345600, 0x86672978
 1,     349458,     349458,     1024,     4096, 0x1cf0bade
-0,        219,        219,        1,   345600, 0x6b562d5d
+0,        219,        219,        1,   345600, 0x84e02563
 1,     350482,     350482,     1024,     4096, 0x4e14313e
 1,     351506,     351506,     1024,     4096, 0x86e5f4d4
-0,        220,        220,        1,   345600, 0x3ed5ffa9
+0,        220,        220,        1,   345600, 0xa763fe75
 1,     352530,     352530,     1024,     4096, 0x24c4f499
 1,     353554,     353554,     1024,     4096, 0x117d58e2
-0,        221,        221,        1,   345600, 0x5bb5a595
+0,        221,        221,        1,   345600, 0xeda1a607
 1,     354578,     354578,     1024,     4096, 0xd1aabc50
-0,        222,        222,        1,   345600, 0xcc59390c
+0,        222,        222,        1,   345600, 0xab0137cd
 1,     355602,     355602,     1024,     4096, 0x8b8939d3
 1,     356626,     356626,     1024,     4096, 0x72e51b9e
 0,        223,        223,        1,   345600, 0x128fbac6
@@ -1027,19 +1027,19 @@
 0,        396,        396,        1,   345600, 0x10409a8c
 1,     634130,     634130,     1024,     4096, 0x57ae5401
 1,     635154,     635154,     1024,     4096, 0x260a230d
-0,        397,        397,        1,   345600, 0x0bc7659d
+0,        397,        397,        1,   345600, 0x42896f4f
 1,     636178,     636178,     1024,     4096, 0x5bcc5956
-0,        398,        398,        1,   345600, 0x08f67f09
+0,        398,        398,        1,   345600, 0xf28b6d65
 1,     637202,     637202,     1024,     4096, 0x2981fe02
 1,     638226,     638226,     1024,     4096, 0x11b60f5f
-0,        399,        399,        1,   345600, 0xeed29026
+0,        399,        399,        1,   345600, 0x21f58778
 1,     639250,     639250,     1024,     4096, 0xc41dffc9
-0,        400,        400,        1,   345600, 0x278a8297
+0,        400,        400,        1,   345600, 0xba567f15
 1,     640274,     640274,     1024,     4096, 0xc456e0c4
 1,     641298,     641298,     1024,     4096, 0xede935d4
-0,        401,        401,        1,   345600, 0x471669b4
+0,        401,        401,        1,   345600, 0x7e6b6746
 1,     642322,     642322,     1024,     4096, 0x556acd01
-0,        402,        402,        1,   345600, 0x831c4a69
+0,        402,        402,        1,   345600, 0x34ae4e6e
 1,     643346,     643346,     1024,     4096, 0x3dcc7d69
 1,     644370,     644370,     1024,     4096, 0xfa59595f
 0,        403,        403,        1,   345600, 0x9cc7b60a

so libx264 is not involved

removing the filter chain single and multithreded outputs match

comment:13 by Marton Balint, 6 years ago

Probably fixed in 0c31a3876d9a522add43ab62a9bcd3d857b28436, reopen if not.

comment:14 by Marton Balint, 6 years ago

Resolution: fixed
Status: openclosed

in reply to:  13 comment:15 by Christian Ebert, 6 years ago

Replying to cus:

Probably fixed in 0c31a3876d9a522add43ab62a9bcd3d857b28436, reopen if not.

Confirming fix for inputs which caused the symptoms. Thank you.

Note: See TracTickets for help on using tickets.