New submission from Deyan <[email protected]>:

Hello,

ffmpeg is acting very strange when I pass to it video libx264/MP4 with variable
frame rate and then try to recode to libx264/MP4.

The Video I am testing with, is encoded from TS to libx264/MP4 with encoder
"HandBrake svn3703 2010121001", which by default encodes with FR "Same as
source", which in this case produces variable frame rate output.

When I try to use libx264 with MP4 output container the encoding is very very,
slow. It will probably finish after months for a movie with 90min length
When I try to use libx264 with MKV output container the speed is normal and the
movie is encoded with reasonable speed.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Meta info from the INPUT file:

[r...@spare Videos]# ffmpeg -v 9 -loglevel 99 -i VTS_01_4-VFR.mp4
FFmpeg version SVN-r25944, Copyright (c) 2000-2010 the FFmpeg developers
  built on Dec 14 2010 15:39:24 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
  configuration: --prefix=/usr/local/ffmpeg --enable-libfaac --enable-libgsm
--enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid
--enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads
--disable-static --enable-shared --enable-gpl --disable-debug
--disable-stripping --enable-nonfree --enable-libtheora --enable-swscale
--enable-doc
  libavutil     50.34. 0 / 50.34. 0
  libavcore      0.16. 0 /  0.16. 0
  libavcodec    52.99. 1 / 52.99. 1
  libavformat   52.88. 0 / 52.88. 0
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.69. 0 /  1.69. 0
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[NULL @ 0x767e510] Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x767e510] ISO: File Type Major Brand: mp42
[h264 @ 0x7681820] no picture
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x767e510] All info found

Seems stream 0 codec frame rate differs from container frame rate: 180000.00
(180000/1) -> 90000.00 (180000/2)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VTS_01_4-VFR.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2010-12-14 10:46:20
    encoder         : HandBrake svn3703 2010121001
  Duration: 00:08:24.88, start: 0.000000, bitrate: 872 kb/s
    Stream #0.0(und), 21, 1/90000: Video: h264, yuv420p, 720x480 [PAR 32:27 DAR
16:9], 1/180000, 706 kb/s, 23.93 fps, 90k tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2010-12-14 10:46:20
    Stream #0.1(und), 64, 1/48000: Audio: aac, 48000 Hz, stereo, s16, 160 kb/s
    Metadata:
      creation_time   : 2010-12-14 10:46:20
At least one output file must be specified

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Output with the very slow encoding MP4 container ( I am waiting like 5 minutes
for 1.6sec of movie to be processed)

[r...@spare Videos]# ffmpeg -y -i VTS_01_4-VFR.mp4 -b 512k -an -vcodec libx264
-vpre fast_firstpass -threads 0 /tmp/out.mp4
FFmpeg version SVN-r25944, Copyright (c) 2000-2010 the FFmpeg developers
  built on Dec 14 2010 15:39:24 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
  configuration: --prefix=/usr/local/ffmpeg --enable-libfaac --enable-libgsm
--enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid
--enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads
--disable-static --enable-shared --enable-gpl --disable-debug
--disable-stripping --enable-nonfree --enable-libtheora --enable-swscale
--enable-doc
  libavutil     50.34. 0 / 50.34. 0
  libavcore      0.16. 0 /  0.16. 0
  libavcodec    52.99. 1 / 52.99. 1
  libavformat   52.88. 0 / 52.88. 0
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.69. 0 /  1.69. 0
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0

Seems stream 0 codec frame rate differs from container frame rate: 180000.00
(180000/1) -> 90000.00 (180000/2)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VTS_01_4-VFR.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2010-12-14 10:46:20
    encoder         : HandBrake svn3703 2010121001
  Duration: 00:08:24.88, start: 0.000000, bitrate: 872 kb/s
    Stream #0.0(und): Video: h264, yuv420p, 720x480 [PAR 32:27 DAR 16:9], 706
kb/s, 23.93 fps, 90k tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2010-12-14 10:46:20
    Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 160 kb/s
    Metadata:
      creation_time   : 2010-12-14 10:46:20
[buffer @ 0x1c97d430] w:720 h:480 pixfmt:yuv420p
[libx264 @ 0x1c97c0f0] using SAR=32/27
[libx264 @ 0x1c97c0f0] MB rate (121500000) > level limit (983040)
[libx264 @ 0x1c97c0f0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle
SSE4.1 Cache64
[libx264 @ 0x1c97c0f0] profile Main, level 5.1
[libx264 @ 0x1c97c0f0] 264 - core 110 r1804 e89c4cf - H.264/MPEG-4 AVC codec -
Copyleft 2003-2010 - 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=0.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=6 sliced_threads=0 nr=0 decimate=1 interlaced=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=30 rc=abr mbtree=1 bitrate=512 ratetol=1.0 qcomp=0.60 qpmin=10
qpmax=51 qpstep=4 ip_ratio=1.41 aq=1:1.00
Output #0, mp4, to '/tmp/out.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2010-12-14 10:46:20
    encoder         : Lavf52.88.0
    Stream #0.0(und): Video: libx264, yuv420p, 720x480 [PAR 32:27 DAR 16:9],
q=10-51, 512 kb/s, 180k tbn, 90k tbc
    Metadata:
      creation_time   : 2010-12-14 10:46:20
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=148820 fps=476 q=51.0 size=    5200kB time=1.65 bitrate=25771.1kbits/s
dup=148790 drop=0

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Output with normal speed encoding MKV container

[r...@spare Videos]# ffmpeg -y -i VTS_01_4-VFR.mp4 -b 512k -an -vcodec libx264
-vpre fast_firstpass -threads 0 /tmp/out.mkv
FFmpeg version SVN-r25944, Copyright (c) 2000-2010 the FFmpeg developers
  built on Dec 14 2010 15:39:24 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
  configuration: --prefix=/usr/local/ffmpeg --enable-libfaac --enable-libgsm
--enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid
--enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads
--disable-static --enable-shared --enable-gpl --disable-debug
--disable-stripping --enable-nonfree --enable-libtheora --enable-swscale
--enable-doc
  libavutil     50.34. 0 / 50.34. 0
  libavcore      0.16. 0 /  0.16. 0
  libavcodec    52.99. 1 / 52.99. 1
  libavformat   52.88. 0 / 52.88. 0
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.69. 0 /  1.69. 0
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0

Seems stream 0 codec frame rate differs from container frame rate: 180000.00
(180000/1) -> 90000.00 (180000/2)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VTS_01_4-VFR.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2010-12-14 10:46:20
    encoder         : HandBrake svn3703 2010121001
  Duration: 00:08:24.88, start: 0.000000, bitrate: 872 kb/s
    Stream #0.0(und): Video: h264, yuv420p, 720x480 [PAR 32:27 DAR 16:9], 706
kb/s, 23.93 fps, 90k tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2010-12-14 10:46:20
    Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 160 kb/s
    Metadata:
      creation_time   : 2010-12-14 10:46:20
[buffer @ 0x1224f6f0] w:720 h:480 pixfmt:yuv420p
[libx264 @ 0x1224e0f0] using SAR=32/27
[libx264 @ 0x1224e0f0] MB rate (121500000) > level limit (983040)
[libx264 @ 0x1224e0f0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle
SSE4.1 Cache64
[libx264 @ 0x1224e0f0] profile Main, level 5.1
[libx264 @ 0x1224e0f0] 264 - core 110 r1804 e89c4cf - H.264/MPEG-4 AVC codec -
Copyleft 2003-2010 - 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=0.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=6 sliced_threads=0 nr=0 decimate=1 interlaced=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=30 rc=abr mbtree=1 bitrate=512 ratetol=1.0 qcomp=0.60 qpmin=10
qpmax=51 qpstep=4 ip_ratio=1.41 aq=1:1.00
Output #0, matroska, to '/tmp/out.mkv':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2010-12-14 10:46:20
    encoder         : Lavf52.88.0
    Stream #0.0(und): Video: libx264, yuv420p, 720x480 [PAR 32:27 DAR 16:9],
q=10-51, 512 kb/s, 1k tbn, 90k tbc
    Metadata:
      creation_time   : 2010-12-14 10:46:20
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=12083 fps=192 q=-1.0 Lsize=   30718kB time=504.31 bitrate= 499.0kbits/s
video:30632kB audio:0kB global headers:0kB muxing overhead 0.280174%
frame I:60    Avg QP:15.24  size: 41984
[libx264 @ 0x1224e0f0] frame P:3503  Avg QP:17.64  size:  6266
[libx264 @ 0x1224e0f0] frame B:8520  Avg QP:20.97  size:   809
[libx264 @ 0x1224e0f0] consecutive B-frames:  4.6%  0.9%  5.5% 89.0%
[libx264 @ 0x1224e0f0] mb I  I16..4: 48.5%  0.0% 51.5%
[libx264 @ 0x1224e0f0] mb P  I16..4: 10.8%  0.0%  0.0%  P16..4: 52.5%  0.0% 
0.0%  0.0%  0.0%    skip:36.7%
[libx264 @ 0x1224e0f0] mb B  I16..4:  1.5%  0.0%  0.0%  B16..8: 16.6%  0.0% 
0.0%  direct: 8.2%  skip:73.6%  L0:42.1% L1:51.7% BI: 6.2%
[libx264 @ 0x1224e0f0] final ratefactor: 20.71
[libx264 @ 0x1224e0f0] coded y,uvDC,uvAC intra: 43.7% 63.1% 20.7% inter: 5.7%
15.7% 0.3%
[libx264 @ 0x1224e0f0] i16 v,h,dc,p: 39% 17% 39%  6%
[libx264 @ 0x1224e0f0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 16% 25%  3%  8%  6% 
5%  5%  6%
[libx264 @ 0x1224e0f0] i8c dc,h,v,p: 52% 16% 29%  3%
[libx264 @ 0x1224e0f0] Weighted P-Frames: Y:2.6% UV:1.6%
[libx264 @ 0x1224e0f0] kb/s:497.48

----------
messages: 12948
priority: normal
status: new
substatus: new
title: MP4 container with variable frame rate source, very very slow encoding
type: bug

________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/issue2423>
________________________________________________

Reply via email to