"High Quality" H.264 at low bit rates ;)
Hi! I'm tyring to recode some MPEG2 streams to H.264 using mencoder and x264enc, my aim is to reduce the size significantly without a too severe quality loss. (Of course I'm aware that I'll lose quality in a lossy-to-lossy recoding in any case.) I'm using a post 1.0.rc2 mencoder (binary build of an svn snapshot from 20071207). What bitrate reduction factor should I be able to achieve? I'm asking as I read http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-x264.html, the mencoder man page and http://en.wikipedia.org/wiki/H264 . For my tests, I'm using bitrate-based three-pass encoding with variing encoding parameters. My source material is an 9.8 MBit MPEG2 stream. If I encode to 4 MBit H.264, there are still significant visual artifacts and a significant loss of detail in comparison to the source material. As I read that H.264 aims for at least twice the coding efficiency of MPEG2 or more, I wonder if this is correct and to be expected, or what encoding parameters have proven themselves to optimize the perceived visual quality? There's probably no way to aim for 2 mbit H.264 video without experiencing severy quality losses, right? Greetings, Gunter
On Friday 22 February 2008 20:18, Gunter Ohrner wrote:
Hi!
I'm tyring to recode some MPEG2 streams to H.264 using mencoder and x264enc, my aim is to reduce the size significantly without a too severe quality loss. (Of course I'm aware that I'll lose quality in a lossy-to-lossy recoding in any case.)
I'm using a post 1.0.rc2 mencoder (binary build of an svn snapshot from 20071207).
I get near DVD quality with a bitrate of 1100-1400... H.264 really shows its efficiency at high resolutions and low bitrates. You might also try out http://h264enc.sourceforge.net which has 38 different presets - use either the VHQ or the EHQ preset. If you want to futher improve the quality of your encodes in dark flat areas, then get the adaptive quantization patch for x264 and patch & recompile x264
What bitrate reduction factor should I be able to achieve?
I'm asking as I read http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-x264.html, the mencoder man page and http://en.wikipedia.org/wiki/H264 .
For my tests, I'm using bitrate-based three-pass encoding with variing encoding parameters.
My source material is an 9.8 MBit MPEG2 stream. If I encode to 4 MBit H.264, there are still significant visual artifacts and a significant loss of detail in comparison to the source material.
As I read that H.264 aims for at least twice the coding efficiency of MPEG2 or more, I wonder if this is correct and to be expected, or what encoding parameters have proven themselves to optimize the perceived visual quality?
There's probably no way to aim for 2 mbit H.264 video without experiencing severy quality losses, right?
Greetings,
Gunter
_______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
Grozdan Nikolov (openSUSE Linux) wrote:
On Friday 22 February 2008 20:18, Gunter Ohrner wrote:
Hi!
I'm tyring to recode some MPEG2 streams to H.264 using mencoder and x264enc, my aim is to reduce the size significantly without a too severe quality loss. (Of course I'm aware that I'll lose quality in a lossy-to-lossy recoding in any case.)
I'm using a post 1.0.rc2 mencoder (binary build of an svn snapshot from 20071207).
I get near DVD quality with a bitrate of 1100-1400... H.264 really shows its efficiency at high resolutions and low bitrates. You might also try out http://h264enc.sourceforge.net which has 38 different presets - use either the VHQ or the EHQ preset. If you want to futher improve the quality of your encodes in dark flat areas, then get the adaptive quantization patch for x264 and patch & recompile x264
I'm not trying to get all philosophical here on the list or anything, but there must be some way to make it clear to n00bs that encoding video is like playing a guitar... It looks easy when somebody who knows how is doing it, but if you think you're just gonna pick it up and wail on it right away, you're going to be disappointed. There are some scripts and gui's around that hide the ugly details, like h264enc, but it requires the input of an experienced encoder to come up with those presets. And as Grozdan pointed out, to get the best results out of h264enc you still need to patch x264... There really is no way to beat the learning curve. BTW, for comparison's sake, I get near DVD quality with lavc mpeg4 at about 1600. And I rarely find that I need to encode dvd's above around 3000.
Grozdan Nikolov (openSUSE Linux) wrote:
I get near DVD quality with a bitrate of 1100-1400... H.264 really shows
Mh... Do you reduce the video resolution? (I don't.)
out http://h264enc.sourceforge.net which has 38 different presets - use
Ok, thanks for the tip, I'm just doing that at the moment.
quality of your encodes in dark flat areas, then get the adaptive quantization patch for x264 and patch & recompile x264
Maybe that could help, my test material is gray scale video. The main problem I have is that originally detailed surfaces like skin in the human face lose all detail and get a blurred mess in the recoded videos. Greetings, Gunter
On Friday 22 February 2008 21:09, Gunter Ohrner wrote:
Grozdan Nikolov (openSUSE Linux) wrote:
I get near DVD quality with a bitrate of 1100-1400... H.264 really shows
Mh... Do you reduce the video resolution? (I don't.)
out http://h264enc.sourceforge.net which has 38 different presets - use
Ok, thanks for the tip, I'm just doing that at the moment.
quality of your encodes in dark flat areas, then get the adaptive quantization patch for x264 and patch & recompile x264
Maybe that could help, my test material is gray scale video.
here are all the x264 patchsets - http://files.x264.nl/x264_patches/ here's the AQ patch - http://files.x264.nl/x264_patches/force.php?file=./x264_aq_var.48.diff
The main problem I have is that originally detailed surfaces like skin in the human face lose all detail and get a blurred mess in the recoded videos.
Greetings,
Gunter
_______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
On Friday 22 February 2008 21:09, Gunter Ohrner wrote:
Grozdan Nikolov (openSUSE Linux) wrote:
I get near DVD quality with a bitrate of 1100-1400... H.264 really shows
Mh... Do you reduce the video resolution? (I don't.)
me neither, I just crop it and I hardly ever go above 1150 kbps, I've done encodes @ 950 kbps @ full resolution and they look really good
out http://h264enc.sourceforge.net which has 38 different presets - use
Ok, thanks for the tip, I'm just doing that at the moment.
quality of your encodes in dark flat areas, then get the adaptive quantization patch for x264 and patch & recompile x264
Maybe that could help, my test material is gray scale video.
The main problem I have is that originally detailed surfaces like skin in the human face lose all detail and get a blurred mess in the recoded videos.
Greetings,
Gunter
_______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
Grozdan Nikolov (openSUSE Linux) wrote:
Mh... Do you reduce the video resolution? (I don't.) me neither, I just crop it and I hardly ever go above 1150 kbps, I've done encodes @ 950 kbps @ full resolution and they look really good
What PSNR and SSIM results should I be able to expect with 2 MBit? Can anyone of you provide some values to compare? Greetings, Gunter
On Monday 03 March 2008 12:51, Gunter Ohrner wrote:
Grozdan Nikolov (openSUSE Linux) wrote:
Mh... Do you reduce the video resolution? (I don't.)
me neither, I just crop it and I hardly ever go above 1150 kbps, I've done encodes @ 950 kbps @ full resolution and they look really good
What PSNR and SSIM results should I be able to expect with 2 MBit?
Can anyone of you provide some values to compare?
PSNR/SSIM highly depends on the source/bitrate/resolution so you can't compare a source that easily with two or more different sources @ cropped standard resolution and bitrate of 1020 kbps, i usually get SSIM between 0.976 and 0.986 but again this highly depends on the source and the x264 settings you use
Greetings,
Gunter
_______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
Grozdan Nikolov (openSUSE Linux) wrote:
What PSNR and SSIM results should I be able to expect with 2 MBit? Can anyone of you provide some values to compare?
PSNR/SSIM highly depends on the source/bitrate/resolution so you can't compare a source that easily with two or more different sources
Ok.
@ cropped standard resolution and bitrate of 1020 kbps, i usually get SSIM between 0.976 and 0.986 but again this highly depends on the source and the x264 settings you use
For my test clip 720x544 @ 2000kbps (cropped to avoid black borders) I get, using a current libx264 including all three patches you suggested, SSIM 0.9745643. (3-pass encoding) mencoder parameters were nointerlaced:subq=7:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:me_prepass:psnr:ssim So this still seems to be somewhat low in comparison, doesn't it? I needed 3000kbps to push SSIM > 0.98. At 3000kbps, the video looks "acceptable" for me. With 1000kbps I merely get 0.9559612... Is there anything obviously wrong with my settings? I verify I'm not doing something obviously wrong I also tested the h264enc script which produces comparable results, however - at least it does not achieve significantly better quality. Greetings, Gunter
On Monday 03 March 2008 15:42, Gunter Ohrner wrote:
Grozdan Nikolov (openSUSE Linux) wrote:
What PSNR and SSIM results should I be able to expect with 2 MBit? Can anyone of you provide some values to compare?
PSNR/SSIM highly depends on the source/bitrate/resolution so you can't compare a source that easily with two or more different sources
Ok.
@ cropped standard resolution and bitrate of 1020 kbps, i usually get SSIM between 0.976 and 0.986 but again this highly depends on the source and the x264 settings you use
For my test clip 720x544 @ 2000kbps (cropped to avoid black borders) I get, using a current libx264 including all three patches you suggested, SSIM 0.9745643. (3-pass encoding)
mencoder parameters were
nointerlaced:subq=7:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyr amid:weight_b:me_prepass:psnr:ssim
partitions=all is basically useless and only slows down the encoding by activating the p4x4 partions which in reality provides less than 0.2% in compression but slows down encoding a lot. So better use partitions=p8x8,b8x8,i8x8,i4x4 also if you're using b-frames then enable brdo and bime options and set direct_pred=auto ... enable trellis=1 and cabac too there's also a quantizer noise shaping patch but it's really really slow and I don't know how compatible is with the current x264 code base
So this still seems to be somewhat low in comparison, doesn't it? I needed 3000kbps to push SSIM > 0.98. At 3000kbps, the video looks "acceptable" for me. With 1000kbps I merely get 0.9559612...
Is there anything obviously wrong with my settings? I verify I'm not doing something obviously wrong I also tested the h264enc script which produces comparable results, however - at least it does not achieve significantly better quality.
Greetings,
Gunter
_______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
Grozdan Nikolov (openSUSE Linux) wrote:
nointerlaced:subq=7:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyr amid:weight_b:me_prepass:psnr:ssim
partitions=all is basically useless and only slows down the encoding by activating the p4x4 partions which in reality provides less than 0.2% in compression but slows down encoding a lot. So better use partitions=p8x8,b8x8,i8x8,i4x4
Yes, I read about that, but I wanted to check what the best result I could get - ignoring encoding speed - would look like, and afterwards tune the parameters to achieve a usuable speed with an accepatble quality tradeoff.
also if you're using b-frames then enable brdo and bime options and set direct_pred=auto ... enable trellis=1 and cabac too
Ok, I did (I thought cabac was on by default?). With these changes, I now get SSIM 0.9752217 @ 2000 kbps and SSIM 0.9566152 @ 1000 kbps - thus slightly better, though nothing revolutionary. I'll probably have to settle at 3000 kbps for this clip... :-/ Thanks anyway for your quick help! Greetings, Gunter
Am Freitag, 22. Februar 2008 11:30:52 schrieb Grozdan Nikolov (openSUSE Linux):
You might also try out http://h264enc.sourceforge.net which has 38 different presets - use either the VHQ or the EHQ preset.
That script is about the best thing since sliced bread. Thanks a lot for putting all the options together in a few neat packages. -- Gruß Andreas
Andreas wrote:
Am Freitag, 22. Februar 2008 11:30:52 schrieb Grozdan Nikolov (openSUSE Linux):
You might also try out http://h264enc.sourceforge.net which has 38
different presets - use either the VHQ or the EHQ preset.
That script is about the best thing since sliced bread.
Thanks a lot for putting all the options together in a few neat packages.
I second that! As a beginner, this has to be one of the finest beginner tutorials I have ever experienced. I can run the script with default selection, and get a positive result. I can then read about each term, use the script to experiment, and ask specific questions, which can be answered and discussed without getting the RTFM responses so common to mailing lists. Thanks for your terrific contribution. I wonder how long it will take to make mplayer's front page???? Tom
On Sunday 24 February 2008 16:18, Tom Poe wrote:
Andreas wrote:
Am Freitag, 22. Februar 2008 11:30:52 schrieb Grozdan Nikolov (openSUSE
Linux):
You might also try out http://h264enc.sourceforge.net which has 38
different presets - use either the VHQ or the EHQ preset.
That script is about the best thing since sliced bread.
Thanks a lot for putting all the options together in a few neat packages.
I second that! As a beginner, this has to be one of the finest beginner tutorials I have ever experienced. I can run the script with default selection, and get a positive result. I can then read about each term, use the script to experiment, and ask specific questions, which can be answered and discussed without getting the RTFM responses so common to mailing lists. Thanks for your terrific contribution. I wonder how long it will take to make mplayer's front page????
omg people, it's just a script which started out as a few lines a few years ago as I was tired of always typing the long command line for mencoder so I decided to put almost everything that I needed/wanted in a script. As time passed by it grew more and more. In its first version it didn't even had any presets or automatic detection functions. everything had to be entered manually, not to mention that it didn't had support for different containers either... I guess I should say thanks for all the support :)
Tom _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
Grozdan Nikolov (openSUSE Linux) wrote:
either the VHQ or the EHQ preset. If you want to futher improve the quality of your encodes in dark flat areas, then get the adaptive quantization patch for x264 and patch & recompile x264
Thanks for the tip! This patch and a custom compiled, recent svn version of x264 seem to slightly improve the video quality. However I'm still not sure if I get the most out of x264 I could... Greetings, Gunter
On Monday 03 March 2008 12:55, Gunter Ohrner wrote:
Grozdan Nikolov (openSUSE Linux) wrote:
either the VHQ or the EHQ preset. If you want to futher improve the quality of your encodes in dark flat areas, then get the adaptive quantization patch for x264 and patch & recompile x264
Thanks for the tip!
This patch and a custom compiled, recent svn version of x264 seem to slightly improve the video quality.
However I'm still not sure if I get the most out of x264 I could...
you can get the ME prepass patch which also will improve things. also the gaussian complexity blur patch improves slightly 2-pass ratecontrol http://files.x264.nl/x264_patches/force.php?file=./x264_me-prepass_DeathTheS... http://files.x264.nl/x264_patches/force.php?file=./x264.gaussian.cplxblur.01... ME prepass is turned off by default so you'll have to enable it with me_prepass
Greetings,
Gunter
_______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
participants (5)
-
Andreas -
Grozdan Nikolov (openSUSE Linux) -
Gunter Ohrner -
Phil Ehrens -
Tom Poe