libvpx crf vs libx264 crf

415 views
Skip to first unread message

unnrea...@gmail.com

unread,
Aug 29, 2013, 9:09:28 AM8/29/13
to webm-d...@webmproject.org
Hello

Recently,
recently I had a task to convert video archive to webm. Untill that, i convert videos to mp4 only. For convert to mp4 I used ffmpeg with libx264 library. For convert to webm I decided to use ffmpeg with libvpx library .

The problem is that the value of crf in libx264 operates differently libvpx.

For example:
Encoding to mp4:
crf 22
. / ffmpeg-i input.mpg-vcodec libx264-r 25 -g 50 -crf 22 -acodec libfaac-ar 44100 -ab 128000 output.mp4
result video bitrate - 212 kbit / s

crf 25
. / ffmpeg-i input.mpg-vcodec libx264-r 25 -g 50 -crf 25 -acodec libfaac-ar 44100 -ab 128000 output.mp4
result video bitrate - 163 kbit / s

Encoding to webm:
crf 22
. / ffmpeg-i input.mpg-vcodec libvpx-r 25 -g 50 -crf 22 -acodec libvorbis-ar 44100 -ab 128000 output.webm
result video bitrate - 172 kbit / s

crf 25
. / ffmpeg-i input.mpg-vcodec libvpx-r 25 -g 50 -crf 25 -acodec libvorbis-ar 44100 -ab 128000 output.webm
result video bitrate - 157 kbit / s

It is obvious that this is not correct .
After that, I read that for correct coding c using libvpx must specify bitrate. I tried to do this:

(input.mpg have video bitrate - 374 kb / s)
crf 22
. / ffmpeg-i input.mpg-vcodec libvpx-r 25 -g 50 -crf 22 -b: v 374k-acodec libvorbis-ar 44100 -ab 128000 output.webm
result video bitrate - 210 kbit / s

crf 25
. / ffmpeg-i input.mpg-vcodec libvpx-r 25 -g 50 -crf 25 -b: v 374k-acodec libvorbis-ar 44100 -ab 128000 output.webm
result video bitrate - 198 kbit / s

The resulting bitrate webm ( with crf 22 )
approximately same with bitrate mp4 ( with crf 22) , but the resulting bitrate webm ( with crf 25) is very different from the bitrate mp4 ( with crf 25).

As I understand libx264 works like this: for maximum bitrate she takes
bitrate of input file. If you run the conversion with crf 0 , the output bitrate matches the input. The more crf = stronger compression. Increase crf 6 units reduces bitrate on half.

And how the libvpx?
Is it possible to omit the output bit rate and specify only the crf? What is the pattern between crf and the output bitrate ?

m.fryd...@gmail.com

unread,
Aug 29, 2013, 10:34:55 PM8/29/13
to webm-d...@webmproject.org
Preface, i have no experience with webm encoding, but i would like to point out that CRF for x264 does not work like that at all
CRF Based encoding involves setting a level of visual quality, and the encoder will vary the bitrate according to the complexity of the scene to maintain that  visual quality. it has nothing to do with bitrate of the input file. 
a crf value of 0 means that the output will be physically lossles, so that, every pixel will be absoltely identical from the input to the output.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages