[FFmpeg-user] libvpx and libx264 problematic frame accuracy

Franz Klinger klingerfranz827 at gmail.com
Sat Jan 19 22:24:56 CET 2013


Hi,

when using the following command

ffmpeg.exe -i akiyo-352x288-29.970.avi -c:v libvpx -quality good -speed 
0 -vb 300k -y akiyo-vp8-none-352x288-29.970-good-cbr-300.webm

I get a file with which I can't  properly measure psnr or ssim. It seems 
that when using e.g. msu video quality measurment tool (which seem to 
use DirectShowSource2 for webm files) the frames are shifted. The result 
is for psnr, regardless how high I set the bitrate, constantly around 27 
db. The Tool seems to use for this file DirectShowSource2.

When using for the encoding the makewebm.exe from the webm website, I 
get an psnr around 45 db. The frames of this webm file seem to get read 
properly.

I have the same problem when encoding with ffmpeg with libx264. When I 
try to compare the result afterwards with the original file, the x264 
frames are misplaced about 2 frames which results in very low psnr and 
ssim values. The problem seems to start directly at the first two frames.

Unfortunately I have not found a solution for the problem and also I'm 
not sure what the reason for the misplaced frames is.


My command line output for vp8:

ffmpeg version N-44459-g8bdba0b Copyright (c) 2000-2012 the FFmpeg 
developers
   built on Sep 14 2012 18:35:56 with gcc 4.7.1 (GCC)
   configuration: --enable-gpl --enable-version3 --disable-pthreads 
--enable-runtime-cpudetect --enable-avisynth --enable-bzlib 
--enable-frei0r --enable-libass --enable-libcelt 
--enable-libopencore-amrnb --enable-libopencore-amrwb 
--enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut 
--enable-libopenjpeg --enable-librtmp --enable-libschroedinger 
--enable-libspeex --enable-libtheora --enable-libutvideo 
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis 
--enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid 
--enable-zlib
   libavutil      51. 73.100 / 51. 73.100
   libavcodec     54. 55.100 / 54. 55.100
   libavformat    54. 27.100 / 54. 27.100
   libavdevice    54.  2.100 / 54.  2.100
   libavfilter     3. 16.103 /  3. 16.103
   libswscale      2.  1.101 /  2.  1.101
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
Input #0, avi, from 'akiyo-352x288-29.970.avi':
   Duration: 00:00:10.01, start: 0.000000, bitrate: 36470 kb/s
     Stream #0:0: Video: rawvideo (YV12 / 0x32315659), yuv420p, 352x288, 
29.97 tbr, 29.97 tbn, 29.97 tbc
[libvpx @ 02498480] v1.1.0
Output #0, webm, to 'akiyo-vp8-none-352x288-29.970-good-cbr-300.webm':
   Metadata:
     encoder         : Lavf54.27.100
     Stream #0:0: Video: vp8, yuv420p, 352x288, q=-1--1, 300 kb/s, 1k 
tbn, 29.97 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo -> libvpx)
Press [q] to stop, [?] for help
frame=   43 fps=0.0 q=0.0 size=       0kB time=00:00:00.63 bitrate=   
5.5kbits/s
frame=   58 fps= 52 q=0.0 size=      32kB time=00:00:01.13 bitrate= 
234.2kbits/s
frame=   71 fps= 44 q=0.0 size=      32kB time=00:00:01.56 bitrate= 
169.4kbits/s
frame=   84 fps= 40 q=0.0 size=      64kB time=00:00:02.00 bitrate= 
263.6kbits/s
frame=   97 fps= 36 q=0.0 size=      64kB time=00:00:02.43 bitrate= 
216.6kbits/s
frame=  114 fps= 36 q=0.0 size=      96kB time=00:00:03.00 bitrate= 
263.0kbits/s
frame=  125 fps= 34 q=0.0 size=      96kB time=00:00:03.37 bitrate= 
234.4kbits/s
frame=  138 fps= 32 q=0.0 size=     128kB time=00:00:03.80 bitrate= 
276.6kbits/s
frame=  149 fps= 31 q=0.0 size=     128kB time=00:00:04.17 bitrate= 
252.2kbits/s
frame=  161 fps= 30 q=0.0 size=     157kB time=00:00:04.57 bitrate= 
280.9kbits/s
frame=  171 fps= 29 q=0.0 size=     157kB time=00:00:04.90 bitrate= 
261.7kbits/s
frame=  179 fps= 28 q=0.0 size=     189kB time=00:00:05.17 bitrate= 
298.9kbits/s
frame=  191 fps= 28 q=0.0 size=     189kB time=00:00:05.57 bitrate= 
277.5kbits/s
frame=  200 fps= 27 q=0.0 size=     189kB time=00:00:05.87 bitrate= 
263.2kbits/s
frame=  213 fps= 27 q=0.0 size=     221kB time=00:00:06.30 bitrate= 
286.7kbits/s
frame=  227 fps= 27 q=0.0 size=     221kB time=00:00:06.77 bitrate= 
267.0kbits/s
frame=  237 fps= 26 q=0.0 size=     253kB time=00:00:07.10 bitrate= 
291.3kbits/s
frame=  252 fps= 27 q=0.0 size=     253kB time=00:00:07.60 bitrate= 
272.1kbits/s
frame=  263 fps= 26 q=0.0 size=     285kB time=00:00:07.97 bitrate= 
292.5kbits/s
frame=  278 fps= 26 q=0.0 size=     285kB time=00:00:08.47 bitrate= 
275.2kbits/s
frame=  296 fps= 27 q=0.0 size=     314kB time=00:00:09.07 bitrate= 
283.8kbits/s
frame=  300 fps= 25 q=0.0 Lsize=     369kB time=00:00:10.01 bitrate= 
301.7kbits/s

video:366kB audio:0kB subtitle:0 global headers:0kB muxing overhead 
0.703784%




and the command for x264:

ffmpeg.exe -i akiyo-352x288-29.970.avi -c:v libx264 -preset medium -b:v 
300k -y akiyo-x264-none-352x288-29.970-medium-b-300.avi

and its output:

ffmpeg version N-44459-g8bdba0b Copyright (c) 2000-2012 the FFmpeg 
developers
   built on Sep 14 2012 18:35:56 with gcc 4.7.1 (GCC)
   configuration: --enable-gpl --enable-version3 --disable-pthreads 
--enable-runtime-cpudetect --enable-avisynth --enable-bzlib 
--enable-frei0r --enable-libass --enable-libcelt 
--enable-libopencore-amrnb --enable-libopencore-amrwb 
--enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut 
--enable-libopenjpeg --enable-librtmp --enable-libschroedinger 
--enable-libspeex --enable-libtheora --enable-libutvideo 
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis 
--enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid 
--enable-zlib
   libavutil      51. 73.100 / 51. 73.100
   libavcodec     54. 55.100 / 54. 55.100
   libavformat    54. 27.100 / 54. 27.100
   libavdevice    54.  2.100 / 54.  2.100
   libavfilter     3. 16.103 /  3. 16.103
   libswscale      2.  1.101 /  2.  1.101
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
Input #0, avi, from 'akiyo-352x288-29.970.avi':
   Duration: 00:00:10.01, start: 0.000000, bitrate: 36470 kb/s
     Stream #0:0: Video: rawvideo (YV12 / 0x32315659), yuv420p, 352x288, 
29.97 tbr, 29.97 tbn, 29.97 tbc
[libx264 @ 023e8380] using cpu capabilities: MMX2 SSE2Fast SSSE3 
FastShuffle SSE4.1 Cache64
[libx264 @ 023e8380] profile High, level 1.3
Output #0, avi, to 'akiyo-x264-none-352x288-29.970-medium-b-300.avi':
   Metadata:
     ISFT            : Lavf54.27.100
     Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 352x288, 
q=-1--1, 300 kb/s, 29.97 tbn, 29.97 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo -> libx264)
Press [q] to stop, [?] for help
frame=  110 fps=0.0 q=24.0 size=      60kB time=00:00:02.03 bitrate= 
241.4kbits/s
frame=  184 fps=0.0 q=22.0 size=     140kB time=00:00:04.50 bitrate= 
255.4kbits/s
frame=  254 fps=168 q=21.0 size=     221kB time=00:00:06.84 bitrate= 
264.1kbits/s
frame=  300 fps=147 q=-1.0 Lsize=     357kB time=00:00:09.94 bitrate= 
294.1kbits/s

video:344kB audio:0kB subtitle:0 global headers:0kB muxing overhead 
3.696035%
[libx264 @ 023e8380] frame I:2     Avg QP:18.24  size: 20970
[libx264 @ 023e8380] frame P:76    Avg QP:15.89  size:  3323
[libx264 @ 023e8380] frame B:222   Avg QP:23.57  size:   262
[libx264 @ 023e8380] consecutive B-frames:  1.3%  0.0%  0.0% 98.7%
[libx264 @ 023e8380] mb I  I16..4: 12.9% 52.1% 35.0%
[libx264 @ 023e8380] mb P  I16..4:  0.0%  0.2%  0.1%  P16..4: 24.6% 
13.7% 13.5%  0.0%  0.0%    skip:47.8%
[libx264 @ 023e8380] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 17.7%  
2.0%  0.7%  direct: 1.1%  skip:78.5%  L0:29.6% L1:55.0% BI:15.4%
[libx264 @ 023e8380] final ratefactor: 16.73
[libx264 @ 023e8380] 8x8 transform intra:53.6% inter:45.8%
[libx264 @ 023e8380] coded y,uvDC,uvAC intra: 78.1% 81.2% 66.4% inter: 
8.7% 7.7% 3.1%
[libx264 @ 023e8380] i16 v,h,dc,p: 33% 24% 15% 28%
[libx264 @ 023e8380] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 27% 16%  5%  5%  
7%  4%  5%  5%
[libx264 @ 023e8380] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 14% 15%  6%  6% 
10%  6% 10%  6%
[libx264 @ 023e8380] i8c dc,h,v,p: 49% 20% 22%  9%
[libx264 @ 023e8380] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 023e8380] ref P L0: 64.0% 11.3% 17.2%  7.4%
[libx264 @ 023e8380] ref B L0: 89.7%  7.8%  2.5%
[libx264 @ 023e8380] ref B L1: 92.1%  7.9%
[libx264 @ 023e8380] kb/s:281.77



More information about the ffmpeg-user mailing list