Log in

View Full Version : x264 seems to changes the video duration of Variable Frame Rate video


ramprasad85
23rd July 2012, 21:54
I downloaded the latest x264.exe (core:125 r2208 d9d2288)

Encoded a VFR video of duration 143.733 sec, the duration of the encoded video is 137.501 sec :confused:

Here is the source video: http://dl.dropbox.com/u/55917837/London_Summer_Olympics_2012__Intro.webm

Here is the encoded video: http://dl.dropbox.com/u/55917837/olympics.mp4

When I try to compare the videos side-by-side, this difference in duration makes the videos out of sync, make it difficult to compare.

Here are the steps to reproduce

C:\>ffprobe -show_format -v quiet -print_format json London_Summer_Olympics_2012__Intro.webm
{
"format": {
"filename": "London_Summer_Olympics_2012__Intro.webm",
"nb_streams": 2,
"format_name": "matroska,webm",
"format_long_name": "Matroska/WebM file format",
"start_time": "0.000",
"duration": "143.733",
"size": "22478255",
"bit_rate": "1251111"
}
}

C:\>x264 -o olympics.mp4 London_Summer_Olympics_2012__Intro.webm
ffms : 640x480p 1:1 @ 4484/143 fps (vfr)
x264 : using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT

x264 [info]: profile High, level 3.0
x264 [info]: frame I:113 Avg QP:19.21 size: 20566
x264 [info]: frame P:2745 Avg QP:26.45 size: 4284
x264 [info]: frame B:1454 Avg QP:29.79 size: 979
x264 [info]: consecutive B-frames: 48.4% 16.8% 8.8% 25.9%
x264 [info]: mb I I16..4: 29.8% 54.7% 15.6%
x264 [info]: mb P I16..4: 2.0% 5.6% 1.3% P16..4: 34.7% 9.6% 4.1% 0.0% 0.0% skip:42.7%
x264 [info]: mb B I16..4: 0.2% 0.4% 0.1% B16..8: 31.6% 2.0% 0.3% direct: 0.8% skip:64.6% L0:46.3% L1:47.5% BI: 6.2%
x264 [info]: 8x8 transform intra:60.0% inter:67.7%
x264 [info]: coded y,uvDC,uvAC intra: 58.2% 55.8% 24.8% inter: 13.4% 9.7% 0.6%
x264 [info]: i16 v,h,dc,p: 37% 40% 11% 13%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 27% 18% 4% 6% 6% 7% 6% 8%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 34% 18% 4% 6% 6% 6% 4% 5%
x264 [info]: i8c dc,h,v,p: 50% 29% 15% 6%
x264 [info]: Weighted P-Frames: Y:1.4% UV:0.5%
x264 [info]: ref P L0: 70.9% 18.5% 7.6% 2.8% 0.1%
x264 [info]: ref B L0: 92.8% 6.4% 0.8%
x264 [info]: ref B L1: 97.0% 3.0%
x264 [info]: kb/s:902.23

encoded 4312 frames, 153.00 fps, 902.28 kb/s


[I]C:\>ffprobe -show_format -v quiet -print_format json olympics.mp4
{
"format": {
"filename": "olympics.mp4",
"nb_streams": 1,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime/MPEG-4/Motion JPEG 2000 format",
"start_time": "0.000",
[I]"duration": "137.501",
"size": "15582670",
"bit_rate": "906621",
"tags": {
"major_brand": "avc1",
"minor_version": "0",
"compatible_brands": "isomavc1",
"creation_time": "2012-07-23 19:32:00"
}
}
}

Thanks and Regards

MasterNobody
23rd July 2012, 22:56
This webm-file contains wrong timing information (or at least it parsed incorrectly by mkvtoolnix and ffms: timecode file (http://privatepaste.com/60a404c910)) according to which first 4312-frames have duration of 2:17.5 but in reality it is constant 30 fps video and this 4312-frames should have duration of 2:23.73. I guess this problem can have something todo with not-displaying frames of VP8 (which imho shouldn't present [ignored] in timecode file [parsing]).

Edit: that is ffms bug not lavf (because with --demuxer lavf it should result with correct duration)

Plorkyeran
24th July 2012, 03:36
I've fixed one bug related to this in FFMS2 r701, but the file seems to have a few issues. Your ffprobe output isn't even reporting the file size correctly (it's 28 MB, not 22). mkvmerge complains about corruption when reading the file; Opera, Chrome and mplayer2 can only play the first ~30 seconds, while MPC-HC agrees with ffms about the duration being 1:40.