This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Constant Bitrate in HEVC
#1
Hi there, I'm trying to output a x265 file in an mp4 wrapper with a constant bitrate.

I'm being asked to set a constant bitrate of 40Mbps  and apparently no matter what I do the bitrate is varying up to 100Mbps!

I saw in a ducth post that mpeg cannot have a constant bitrate, but what about mp4? Is there a setting I've missed?

It's a hdr Rec2020 file so I'm concerned one of the level/profile/tier settings may be having an effect?




Here's is my two pass settings:
x265 --input - --output-depth 10 --y4m --profile main10 --limit-modes --no-open-gop --pass 1 --bitrate 40000 --cbqpoffs -2 --crqpoffs -2 --qpfile GENERATED_QP_FILE --psy-rd 2.50 --rdoq-level 2 --psy-rdoq 10.00 --aq-mode 0 --deblock=-1:-1 --limit-sao --colorprim bt2020 --transfer smpte-st-2084 --colormatrix bt2020nc --hdr --stats "PATH TO THE .stats FILE" --multi-pass-opt-analysis --multi-pass-opt-distortion --analysis-file "PATH TO THE .analysis FILE" --output OUTPUTFILE

x265 --input - --output-depth 10 --y4m --profile main10 --limit-modes --no-open-gop --pass 2 --bitrate 40000 --cbqpoffs -2 --crqpoffs -2 --psy-rd 2.50 --rdoq-level 2 --psy-rdoq 10.00 --aq-mode 0 --deblock=-1:-1 --limit-sao --colorprim bt2020 --transfer smpte-st-2084 --colormatrix bt2020nc --hdr --stats "PATH TO THE .stats FILE" --multi-pass-opt-analysis --multi-pass-opt-distortion --analysis-file "PATH TO THE .analysis FILE" --output OUTPUTFILE

Here is a single pass setting I've put together (not tested yet, maybe this is what I'm missing?):
x265 --input - --output-depth 10 --y4m --profile main10 --limit-modes --no-open-gop --bitrate 40000 --crf-min 0.00 --crf-max 0.00 --strict-cbr --cbqpoffs -2 --crqpoffs -2 --qpfile GENERATED_QP_FILE --psy-rd 2.50 --rdoq-level 2 --psy-rdoq 10.00 --aq-mode 0 --deblock=-1:-1 --limit-sao --colorprim bt2020 --transfer smpte-st-2084 --colormatrix bt2020nc --hdr --output OUTPUTFILE
Reply
#2
short: Hybrid can't create bit streams without any fluctuation since it's not possible.

long: ->
  • Read up on MPEG compression just the basics should do to understand why constant bitrate doesn't make any sense with MPEG based compression.
  • Read up on VBV what it is and what it is for and why this is what one normally wants.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#3
Photo 
(23.08.2017, 20:33)Selur Wrote: short:  Hybrid can't create bit streams without any fluctuation since it's not possible.

long: ->
  • Read up on MPEG compression just the basics should do to understand why constant bitrate doesn't make any sense with MPEG based compression.
  • Read up on VBV what it is and what it is for and why this is what one normally wants.

Cu Selur

Ok that's some good news. I'm not expecting a 100% set bitrate but it going up to 100Mbps meant something must be off. The person testing the file is using a T7 HDR deck so I can only assume what they're seeing is accurate.


My other thought was to choose a constant rate factor but I cannot see what that refers to, if it's Mbps, Kbps or another measurement.

The rate factor also pops up in my Average Bitrate single pass settings (which I can use CBR on and will use from now on!). But I'm not sure if the min/max rate factor will help or not. The code is there even if the value is 0, I assume the '--bitrate 40000' and '--strict cbr' should be all I need, but I'm concerned these rate factors



x265 --input - --output-depth 10 --y4m --profile main10 --limit-modes --no-open-gop --bitrate 40000 --crf-min 0.00 --crf-max 0.00 --strict-cbr --cbqpoffs -2 --crqpoffs -2 --qpfile GENERATED_QP_FILE --psy-rd 2.50 --rdoq-level 2 --psy-rdoq 10.00 --aq-mode 0 --deblock=-1:-1 --limit-sao --colorprim bt2020 --transfer smpte-st-2084 --colormatrix bt2020nc --hdr --output OUTPUTFILE
Reply
#4
I wrote down my recommendation.
-> I wish you the best of luck with your endeavor.

In case you find a better way to reproduce 'constant bitrate' (as understood by VBV), please share since others might be interested.
(Personally I don't care about cbr and only make sure content I encode abides the VBV restrictions I set.)

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#5
Ok I shall keep digging, you've got me on the right path for sure, it's the rate factor that scares me now!

I'm going to test the settings below (wit a few ups and downs on the rate factors) and will report back if all was successful!



I don't normally get asked for such strict restrictions on bit rate either, but apparently for HDR constant is better because it preserves tiny details that could easily be compressed. And this is an UHD, HDR 50fps file, they couldn't be using more bitrate nonsense as it is!


Anyway thanks for providing one of the only GUIs out there than can really encode a HDR signal Wink

Settings:
x265 --input - --output-depth 10 --y4m --profile main10 --limit-modes --no-open-gop --bitrate 40000 --crf-min 10.00 --crf-max 20.00 --strict-cbr --cbqpoffs -2 --crqpoffs -2 --qpfile GENERATED_QP_FILE --psy-rd 2.50 --rdoq-level 2 --psy-rdoq 10.00 --aq-mode 0 --deblock=-1:-1 --limit-sao --colorprim bt2020 --transfer smpte-st-2084 --colormatrix bt2020nc --hdr --output OUTPUTFILE
Reply
#6
I'm getting an error saying I've not set a target bit rate for the strict CBR:

x265 [error]: Strict-cbr cannot be applied without specifying target bitrate or vbv bufsize

I've set the bitrate as 40000 in the box next to the CBR checkbox not sure what's missing? I'm a bit worried it's because I can't get rid of the min/max rate factor settings that sit in between on the code (--bitrate 40000 --crf-min 10.00 --crf-max 20.00 --strict-cbr).

I then tried to set the vbv bufsize and max fillrate but they both only let me type in zeroes. Is there a setting or checkbox that would allow me to put a value in them? According to the link you sent this should be what I need to help with a slightly more constant bitrate:
https://bitbucket.org/multicoreware/x265...o-with-cbr

I can't seem to find answers from my googling that include how to apply it in the GUI!
Reply
#7
Unless you specify x255->Main->Compatibility Restrictions->Level/Profile/Tier to values that allow vbv (so not 'unrestricted' or 'none') you can't specify VBV values, since they are only applicable when Level/Profile/Tier is set.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#8
That's the one! My level was set to unrestricted. Makes total sense!

I can have the --strict CBR line in my settings now as well Smile

I've set my level to 5.1 as that sets me close to the 40000Kbps I've been asked for! Wikipedias table cleared it up really well for me.

https://en.wikipedia.org/wiki/High_Effic...and_levels


(Again just keeping track of things in case anyone else has these issues). I'll report back my findings.


Current settings:
x265 --input - --output-depth 10 --y4m --profile main10 --no-high-tier --level-idc 5.1 --limit-modes --no-open-gop --lookahead-slices 0 --bitrate 40000 --crf-min 10.00 --crf-max 20.00 --strict-cbr --cbqpoffs -2 --crqpoffs -2 --qpfile GENERATED_QP_FILE --psy-rd 2.50 --rdoq-level 2 --psy-rdoq 10.00 --aq-mode 0 --vbv-maxrate 40000 --vbv-bufsize 40000 --deblock=-1:-1 --limit-sao --colorprim bt2020 --transfer smpte-st-2084 --colormatrix bt2020nc --hdr --output "/var/folders/hx/f01cb34s7zd2kj5yzlw4sk6h0000gn/T/Post Event 23 08 2017.265"
Reply
#9
Ok here's the best I could manage!

I've applied the maxrate a little below my desired bitrate (37500 maxrate to 40000 bitrate) and allowed the bufsize to be 30000. I also set the level to 5.1 which is most desirable to trying to get an UHD file to 40mbps.

The file sits at an average bitrate of 33mbps and it's highest bitrate was 42mbps. It's gotten me through the delivery at least. I hope that others can find this helpful too. Smile

Current settings:
x265 --input - --output-depth 10 --y4m --profile main10 --no-high-tier --level-idc 5.1 --limit-modes --no-open-gop --lookahead-slices 0 --bitrate 40000 --crf-min 10.00 --crf-max 20.00 --strict-cbr --cbqpoffs -2 --crqpoffs -2 --qpfile GENERATED_QP_FILE --psy-rd 2.50 --rdoq-level 2 --psy-rdoq 10.00 --aq-mode 0 --vbv-maxrate 37500 --vbv-bufsize 30000 --deblock=-1:-1 --limit-sao --colorprim bt2020 --transfer smpte-st-2084 --colormatrix bt2020nc --hdr --output "/var/folders/hx/f01cb34s7zd2kj5yzlw4sk6h0000gn/T/Post Event 23 08 2017.265"
Reply
#10
(23.08.2017, 20:33)Selur Wrote: ...
  • Only container that might show up as constant bitrate is probably transport stream containers (ts, m2ts, mts,..), since there are multiplexer out there that support bitrate stuffing for those.
...

So about this
How can I setup the -muxrate option for the m2ts container?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)