Log in

View Full Version : vbv-maxrate question


someoneXgr
25th February 2013, 20:21
Hi to everyone! I am trying to do a retro sports project from VHS tapes. I am capturing them with VirtualDub with huffyuv codec and then encode them. I use StaxRip and x264 with the following commands:
--crf 18 --keyint 100 --subme 9 --vbv-bufsize 40000 --vbv-maxrate 2300 --sar 12:11
Is it a right way to restrict bitrate with the vbv-maxrate command or should I use a more proper way? If I leave it to 40000 it turns out to 9-12 Mbps file.

Asmodian
25th February 2013, 21:54
Do not use VBV to influence the bitrate, use it only if you need to meet streaming requirements or playback hardware requirements.

To decrease the bit rate increase the crf value.

Blue_MiSfit
25th February 2013, 21:59
Indeed, or just use --bitrate mode, ideally in 2 passes.

Asmodian
25th February 2013, 22:09
I just wanted to add that
--vbv-bufsize 40000 --vbv-maxrate 40000
is very random. I have no idea why those values are suggested in so many places.

If you want to use the VBV limits set by High profile level 4.1 (the profile and level used in the bluray spec, almost all newer hardware will support it) it is:
--vbv-bufsize 78125 --vbv-maxrate 62500

Also maybe give --crf 20 a try. :)

someoneXgr
25th February 2013, 22:15
Does it have any influence to quality? Because I have burned some mkv's to DVD with this setting.
Also could I ask why I shouldn't use it? Because from what I understand it sets a maximum bitrate for the variable bitrate mode CRF.

Also how to use --birate mode? Just "--bitrate 2300"?

EDIT
Asmodian at --crf 20 what bitrates will I get? Because I don't have any videos handy to test it now.

sneaker_ger
25th February 2013, 22:38
Does it have any influence to quality? Because I have burned some mkv's to DVD with this setting.
Also could I ask why I shouldn't use it? Because from what I understand it sets a maximum bitrate for the variable bitrate mode CRF.

It highly reduces the quality the way you used it. If you set an average bitrate with "--bitrate", it is just that: an average bitrate. Complex scenes will get a lot more bitrate than 2300 kbit/s, easy scenes less than 2300 kbit/s. With --vbv-maxrate/--vbv-bufsize you are capping the maximum bitrate locally, so complex scenes do not get more than 2300 kbit/s anymore. As soon as a complex scene starts, the picture will lose quality.

Also how to use --birate mode? Just "--bitrate 2300"?

There are two ways to use --bitrate:
single pass:
--bitrate 2300

multi-pass:
--bitrate 2300 --pass 1
--bitrate 2300 --pass 2

The multi-pass option does allocate bits in a better way to keep the quality as constant as possible throughout the whole film and is recommended. (More than two passes are possible but considered a waste of time.)

Also, we usually recommend to use the presets instead of playing with parameters like --subme yourself. This would be a good start:
--preset slower --level 4.0 --vbv-bufsize 31250 --vbv-maxrate 25000 --bitrate 2300 --pass 1
--preset slower --level 4.0 --vbv-bufsize 31250 --vbv-maxrate 25000 --bitrate 2300 --pass 2

If you want to invest more or less time, change the preset from "slower" to something else. There are also tunings for "normal" films, grainy films and animation/cartoon: --tune filme, --tune grain and --tune animation. If you are not fixed to exactly 2300 kbit/s you could of course simply keep using --crf and just increase its value a bit as suggested by Asmodian.

Asmodian
25th February 2013, 22:42
edit: sneaker_ger was faster.

The bit rate at a given crf very much depends on the source, 20 is quite a bit lower than 18. If you want a specific bit rate use two pass encoding.

Using lower vbv settings than needed does hurt quality. For your desired bit rate this decrease is probably not significant (or even measurable) between 40000 and 62500 but it would be worse at 2300.

Exactly why VBV shouldn't be used to decrease the bitrate is somewhat complex and you need to understand what VBV is doing and how the rate control works. Just know that it isn't for setting the average bit rate and there are other settings for that. VBV limits are more of an emergency "Oh %#^$ the bandwidth+buffer during playback will not be sufficient, drop data NOW with no regard for the impact on quality".

someoneXgr
26th February 2013, 01:55
So what do you think are good settings for football and basketball games from VHS? I mean what tune and preset? (I know that this question does not abide with the forum rules but I want to hear your opinions and I will try them all to find a good one.)

I also would like to tell that I tried to compare frame to frame and by eye the encode with the uncompressed avi with Yadif deinterlacing enabled in VLC (just like the encode) and I didn't notice much difference in intense scenes, even though I used the wrong vbv setting. Do you think I should re-encode the tapes with the correct (--bitrate) setting?

Also I've read that x264 determines the level of h264 automatically, why should I limit it to 4.1 (even though the appropriate for my case would be 3 or 3.1)?

Asmodian
26th February 2013, 02:32
I suggest tune film. If you have no reason to restrict the level just don't set VBV at all. Note the automatic level doesn't set or check VBV compliance.

I would re-encode but it is up to you. I just like things to be right, especially after bothering to do the capture etc.

I hope you are using two pass if you are setting --bitrate?

edit: oh and preset veryslow, always ;)