Doom10 Forum: Digital Video Discussion
September 09, 2010, 12:35:01 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Of course it's better, it's one more. Read the rules!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: VBV Maximum Bitrate Doesn't Work as Well as I'd Like  (Read 2148 times)
TacoHeater
Member

Offline Offline

Posts: 3


View Profile
« on: March 10, 2010, 02:06:03 PM »

The title pretty much sums up my feelings, but I do have some questions.  When using MeGUI, I choose the "x264: Blu-Ray Insane" "Encoder Settings" and I specify an average bitrate of 40,000.  Assuming the VBV maximum bitrate does what it's supposed to, it would prevent the video from having a bitrate higher than 40,000, thus play without issues on a Blu-Ray player.

Bare in mind, I know very little when it comes to this stuff, but I would assume a Blu-Ray preset would force your video to be encoded in such a way that it remains playable on Blu-Ray players.  Not so.  Given a source material of 1920x1080 @ 60fps, the bitrate tends to spike well above the 40,000 VBV Maximum Bitrate and VBV buffer size.  This causes the video to have frame loss and stutter on the PS3 when played from the PS3 harddrive.

What I want to know is, is this normal behavior?  How can I prevent the video from having a bitrate higher than 40,000, yet be as absolutely high quality as possible?

Thanks.
Logged
Dark Shikari
x264 developer
Administrator
Member
*****
Offline Offline

Posts: 465


View Profile
« Reply #1 on: March 10, 2010, 02:24:51 PM »

x264 will never, ever violate VBV without telling you in the log.

Most likely you are not measuring the maximum bitrate correctly.  How are you doing so?
Logged

TacoHeater
Member

Offline Offline

Posts: 3


View Profile
« Reply #2 on: March 11, 2010, 12:58:02 AM »

From within MeGUI, there are 2 ways that I can change the VBV Maximum Bitrate.  The first is from the "Rate Control" tab of the "x264 configuration dialog".  The other is from the "misc" tab where it says "Custom Command Line".  I noticed it has a bunch of things specified in there, two of which were "--vbv-bufsize 30000" and "--vbv-maxrate 40000".

To be honest, I haven't really touched anything to do with Maximum Bitrate, I just selected the "Bluray - Insane" preset and specified an ABR of 40,000.  When playing the video on the PS3, I noticed that it spikes well above the 50,000 bitrate at times.

The video is a flyby I recorded from UT3 at 1920x1080 @60fps.  There are some EXTREMELY complex scenes in there including snowfall and all kinds of jerky / constantly moving camera movement.

Code:
General
Complete name                    : O:\Fraps\Movies\UT3 DM-Whiterealm_huffy2_constant_bitrate-muxed.mp4
Format                           : MPEG-4
Format profile                   : Base Media
Codec ID                         : isom
File size                        : 355 MiB
Duration                         : 1mn 17s
Overall bit rate                 : 38.4 Mbps
Encoded date                     : UTC 2010-03-09 22:52:06
Tagged date                      : UTC 2010-03-09 22:52:06

Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : High@L4.1
Format settings, CABAC           : Yes
Format settings, ReFrames        : 3 frames
Codec ID                         : avc1
Codec ID/Info                    : Advanced Video Coding
Duration                         : 1mn 17s
Bit rate mode                    : Variable
Bit rate                         : 38.1 Mbps
Nominal bit rate                 : 40.0 Mbps
Maximum bit rate                 : 52.1 Mbps
Width                            : 1 920 pixels
Height                           : 1 080 pixels
Display aspect ratio             : 16:9
Frame rate mode                  : Constant
Frame rate                       : 60.000 fps
Resolution                       : 8 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.306
Stream size                      : 352 MiB (99%)
Title                            : Imported with GPAC 0.4.6-DEV (build 1)
Writing library                  : x264 core 80 r1376M 3feaec2
Encoding settings                : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.0:0.0 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=3 / sliced_threads=0 / slices=4 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=3 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=1 / wpredb=1 / wpredp=2 / keyint=24 / keyint_min=2 / scenecut=40 / rc_lookahead=40 / rc=cbr / mbtree=0 / bitrate=40000 / ratetol=1.0 / qcomp=1.00 / qpmin=10 / qpmax=51 / qpstep=4 / vbv_maxrate=40000 / vbv_bufsize=40000 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:1.00
Encoded date                     : UTC 2010-03-09 22:52:06
Tagged date                      : UTC 2010-03-09 22:52:21

Audio
ID                               : 2
Format                           : AAC
Format/Info                      : Advanced Audio Codec
Format version                   : Version 4
Format profile                   : LC
Format settings, SBR             : No
Codec ID                         : 40
Duration                         : 1mn 17s
Bit rate mode                    : Variable
Bit rate                         : 352.8 Kbps
Maximum bit rate                 : 398 Kbps
Channel(s)                       : 2 channels
Channel positions                : L R
Sampling rate                    : 44.1 KHz
Stream size                      : 3.22 MiB (1%)
Encoded date                     : UTC 2010-03-09 22:52:21
Tagged date                      : UTC 2010-03-09 22:52:21

As you can see from this MediaInfo, the maximum bitrate is 52Mbps.

Thanks

« Last Edit: March 11, 2010, 01:09:19 AM by TacoHeater » Logged
Dark Shikari
x264 developer
Administrator
Member
*****
Offline Offline

Posts: 465


View Profile
« Reply #3 on: March 11, 2010, 01:43:45 AM »

Quote
As you can see from this MediaInfo, the maximum bitrate is 52Mbps.
MediaInfo is wrong.  It is ignoring the VBV when calculating the maximum bitrate.  This is hardly a surprise considering that it didn't ask you for the VBV buffer size when performing the calculation, nor is it psychic, so it has no way of knowing what the VBV you chose was.

Use a VBV-compliant measuring tool, like vbv.pl or neuron2's tool.

x264 does not violate VBV without telling you, no matter what the content is or how "complex" it is.
« Last Edit: March 11, 2010, 01:45:30 AM by Dark Shikari » Logged

TacoHeater
Member

Offline Offline

Posts: 3


View Profile
« Reply #4 on: March 11, 2010, 03:35:05 AM »

Not to disagree with you or anything, but I would also use the PS3 to show the bitrate onscreen.  At times, it would jump above 50,000.

I tried an experiment.  I re-encoded the video with a VBV-Maximum Bitrate of 30,000 and an ABR of 30,000.  This time MediaInfo showed a maximum bitrate of 38,000 and the PS3 never once spiked above 38,000.

However, the video did have stuttering and playback issues.  I guess the PS3 simply cannot handle a 1920x1080p video with 60fps without stuttering issues.  That's disappointing.  Oh well.  I guess I will have to find a happy medium.  If I go any lower than 30,000 bitrate, the video will be starved of bits at that resolution and I'll have no choice but to bring it down to 1600x900 or 1280x720.

Regarding vbv.pl or neuron2's tool, can you point me in the right direction?  I tried searching Google but to no avail.

Thanks
Logged
MaxBlack
Member

Offline Offline

Posts: 31


View Profile
« Reply #5 on: March 11, 2010, 06:16:40 AM »

Regarding vbv.pl or neuron2's tool, can you point me in the right direction?  I tried searching Google but to no avail.
Try again with "VBV Checker" and for me it was the 4th hit.
Logged
Dark Shikari
x264 developer
Administrator
Member
*****
Offline Offline

Posts: 465


View Profile
« Reply #6 on: March 11, 2010, 09:28:25 AM »

Not to disagree with you or anything, but I would also use the PS3 to show the bitrate onscreen.  At times, it would jump above 50,000.
Then the PS3 is wrong, and it's measuring bitrate differently from how the H.264 specification does.  In other words, it's measuring instantaneous bitrate, not buffer fill rate.
Logged

checkers
Member

Offline Offline

Posts: 72



View Profile WWW
« Reply #7 on: March 11, 2010, 10:27:32 PM »

Here's an explanation of how the VBV settings work: http://mewiki.project357.com/wiki/X264_Encoding_Suggestions#VBV_Encoding

In short: vbv-maxrate doesn't set the maximum bitrate of the video. It sets the rate at which the VBV buffer fills.
Logged

Neal1981
Member

Offline Offline

Posts: 3


View Profile
« Reply #8 on: June 03, 2010, 04:09:34 AM »

Hi Checker and Dark,

I also meet a same question as TacoHeater, there's possible a burst rate over the maximum bitrate we configured.
If the vbv-maxrate matches to the VBV buffer fill rate, how can we transfer it to the actual video rate?

Thanks a lot.
Logged
checkers
Member

Offline Offline

Posts: 72



View Profile WWW
« Reply #9 on: June 03, 2010, 06:12:29 AM »

I think you're confused. If you have set vbv-maxrate and vbv-bufsize correctly (as per my above link) you should have no problems. You shouldn't have to worry about "burst rates over the maximum bitrate configured".

Otherwise, please elaborate.
Logged

Neal1981
Member

Offline Offline

Posts: 3


View Profile
« Reply #10 on: June 03, 2010, 05:42:04 PM »

Hi checkers,

Let me say by this way.
If we'd like to have a H.264 bitstream with maximaum bitrate as 40Mbps(take TacoHeater's example) by x264 encoder.
Which is, no burst rate over 40Mbps.
How can we configure the encoding option to acheive the target?

Thanks.
Logged
Dark Shikari
x264 developer
Administrator
Member
*****
Offline Offline

Posts: 465


View Profile
« Reply #11 on: June 03, 2010, 07:33:20 PM »

Hi checkers,

Let me say by this way.
If we'd like to have a H.264 bitstream with maximaum bitrate as 40Mbps(take TacoHeater's example) by x264 encoder.
Which is, no burst rate over 40Mbps.
How can we configure the encoding option to acheive the target?

Thanks.
You must define what "burst rate" means first.  The purpose of the VBV is to define one possible definition of burst rate.
Logged

Neal1981
Member

Offline Offline

Posts: 3


View Profile
« Reply #12 on: June 03, 2010, 10:47:35 PM »

The burst rate and maximum rate I mean is reported by the tool, maybe the MediaInfo, Elecard StreamEye or PS3 player, since they are the common tool now.
It's confused that we see the maximum rate reported by them is over the maximum rate as we want.

As I know, Blu-ray SPEC had also defined some transport buffer and rate in multiplexer, does the VBV buffer model used in x264 conform with the SPEC?
Logged
checkers
Member

Offline Offline

Posts: 72



View Profile WWW
« Reply #13 on: June 04, 2010, 04:55:57 AM »

You're still confused. Why is it bad if the "burst rate" is over a random number reported by some tools.
As long as you meet the VBV restrictions of a given decoder environment, you will have no issues. The size of individual frames is irrelevant.
Logged

ranka-mei
Member

Offline Offline

Posts: 5


View Profile
« Reply #14 on: June 20, 2010, 09:31:06 PM »

Here's an explanation of how the VBV settings work: http://mewiki.project357.com/wiki/X264_Encoding_Suggestions#VBV_Encoding
I thought L4.1 allows for a 62,500kb/s video data rate? (at 1920x1080)

Also, how do you calculate the relationship between --vbv-maxrate and --vbv-bufsize? (like 40 vs 30). Is that always 4:3?
Logged
checkers
Member

Offline Offline

Posts: 72



View Profile WWW
« Reply #15 on: June 20, 2010, 09:59:37 PM »

I thought L4.1 allows for a 62,500kb/s video data rate? (at 1920x1080)
Where did I say otherwise?

Quote
Also, how do you calculate the relationship between --vbv-maxrate and --vbv-bufsize? (like 40 vs 30). Is that always 4:3?
These sentences are the key and explain the relationship:
Quote
The buffer's size is specified in kbit by --vbv-bufsize and the minimum rate at which it fills is specified in kbit/sec by --vbv-maxrate. At the start of playback, the buffer is empty, and fills at a minimum speed of vbv-maxrate kbits/s.
Are you still confused?
Logged

ranka-mei
Member

Offline Offline

Posts: 5


View Profile
« Reply #16 on: June 20, 2010, 10:06:13 PM »

Where did I say otherwise?
These sentences are the key and explain the relationship:Are you still confused?
Pretty unconfused now. :) So, "--vbv-maxrate 40000" does NOT mean the max video data rate is 40,000kb/s, but only that the buffer fills at said rate, right? Accordingly, if I were to set "--vbv-bufsize 70000," (instead of the usual 30000) all that would really do is take my video longer to start.

Thanks.
Logged
checkers
Member

Offline Offline

Posts: 72



View Profile WWW
« Reply #17 on: June 20, 2010, 11:17:00 PM »

Yes, on both counts.

Of course, increasing buffer size doesn't just increase time to start. It also allows x264 more flexibility in bitrate allocation, which is a good thing for encoding efficiency.
Logged

checkers
Member

Offline Offline

Posts: 72



View Profile WWW
« Reply #18 on: June 20, 2010, 11:43:35 PM »

I just updated the wording of that section on the MeWiki. Do you think it's clearer now?
Logged

ranka-mei
Member

Offline Offline

Posts: 5


View Profile
« Reply #19 on: June 21, 2010, 12:07:07 AM »

I just updated the wording of that section on the MeWiki. Do you think it's clearer now?
It's fully clear now. :) And thanks for all the effort.
Logged
CaptainMorgan
Member

Offline Offline

Posts: 1


View Profile
« Reply #20 on: June 22, 2010, 02:17:13 AM »

Hey Taco,

If your encode is 60 frames per second (not 59.94 fields per second), that is likely why the PS3 is not playing back in real-time.
1080p60 is not part of the Blu-ray standard and as such it is not guaranteed for playback on any Blu-ray player, even the PS3.

There's a nice table of allowable resolutions/frame rates listed on the wikipedia...
http://en.wikipedia.org/wiki/Blu-ray_Disc

Also ranka-mei, the Blu-ray specifications define the VBV buffer as specifically 3,750,000 bytes (30,000,000 bits) so if you want to be compliant with Blu-ray you cannot raise the buffer any higher than this...
Logged
Pkarl
Member

Offline Offline

Posts: 16


View Profile
« Reply #21 on: June 24, 2010, 12:18:46 PM »

Hello,

i found this thread with google as I was looking for some explanations for the vbv-settings.

I also misunderstoof the meaning of the vbv settings, now thanks to this thread learned something new. Smiley

I was wondering since there are a lot of media players on the market using similar chipsets as in Blu-ray players,
is there any chance to get information which are the best vbv settings for those chipsets like Sigma 8635 or Realtek 1283D?

I did some encodes in crf mode without any vbv settings and got stuttering playback on my machines in some 1080p clips with high movements.

Since then I'm just playing around with these 2 values to find a way to get a smooth playback  but I would really like to know which values would work on those chips with any kind of scenery. But I cant find anything, neither from Sigma or Realtek.

Does encoding with vbv settings only make sense with 2pass encode, or does it work with crf as well?

I find crf the most elegant way to use for my backups since i dont need to hit specific target sizes, and 2pass always ends up either with too much bitrate wasted or too less bitrate set.


Logged
Dark Shikari
x264 developer
Administrator
Member
*****
Offline Offline

Posts: 465


View Profile
« Reply #22 on: June 24, 2010, 02:29:26 PM »

Hello,

i found this thread with google as I was looking for some explanations for the vbv-settings.

I also misunderstoof the meaning of the vbv settings, now thanks to this thread learned something new. Smiley

I was wondering since there are a lot of media players on the market using similar chipsets as in Blu-ray players,
is there any chance to get information which are the best vbv settings for those chipsets like Sigma 8635 or Realtek 1283D?

I did some encodes in crf mode without any vbv settings and got stuttering playback on my machines in some 1080p clips with high movements.

Since then I'm just playing around with these 2 values to find a way to get a smooth playback  but I would really like to know which values would work on those chips with any kind of scenery. But I cant find anything, neither from Sigma or Realtek.

Does encoding with vbv settings only make sense with 2pass encode, or does it work with crf as well?

I find crf the most elegant way to use for my backups since i dont need to hit specific target sizes, and 2pass always ends up either with too much bitrate wasted or too less bitrate set.



Usually they provide information like "Level 4.0 High Profile" or similar, which implies a specific set of VBV settings.
Logged

skittle
Member

Offline Offline

Posts: 11


View Profile
« Reply #23 on: June 24, 2010, 09:59:11 PM »

also note that in some devices mkv parsing is done in software, so on devices like iobox it can handle much higher bitrate in m2ts container!
Logged
Pkarl
Member

Offline Offline

Posts: 16


View Profile
« Reply #24 on: June 24, 2010, 11:08:23 PM »

Thank you for your replies. Well almost any hardware player (WDTV, Popcorn Hour, Dvico TViX) supporting AVC supports at least HP@4.0.

Are there any differences with vbv settings for HP 4.0 and 4.1, or should I stay with those values above?

As for container support, yes demuxing MKV is done by firmware while transport streams can be directly accessed by chipset itself, leaving more room for plain video decoding performance.

Since Matroska does not support Presentation Graphics, I stick with m2ts anyway.
« Last Edit: June 24, 2010, 11:11:17 PM by Pkarl » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!