Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st March 2011, 20:01   #1  |  Link
pepelugil
Registered User
 
Join Date: Jul 2010
Posts: 37
"Accurately" define max bitrate with x264

Hi,

I want to reencode a video in a middle of a seamless branched disk playlist and in order to Scenarist to accept it, it must have the same (max) bitrate as the other videos in the playlist.

The original videos in Scenarist have a (max) bitrate of 31,499,776bps. If I set --vbv-maxrate 31500 in my reencode I'll end with a bitrate of 31,499,968bps and if I set --vbv-maxrate 31499 the bitrate will be 31,498,944bps and in both cases, Scenarist will complain when trying to mux:

Code:
Error : Invalid Connection condition,  because Bit_rate differs between current Video and previous Video.
Is there any way to define in a more precise way max bitrate or is there any tool to "fake" this value so Scenarist can mux this project without reencoding all videos in the playlist?

Greetings
pepelugil is offline   Reply With Quote
Old 21st March 2011, 21:30   #2  |  Link
shon3i
BluRay Maniac
 
shon3i's Avatar
 
Join Date: Dec 2005
Posts: 2,419
I think you have problem with Bitrate not Max Bitrate. Please examine original video, there is lot information, using some of stream analyser you can get what you need. Btw what command line you use to encode ?
shon3i is offline   Reply With Quote
Old 21st March 2011, 22:18   #3  |  Link
pepelugil
Registered User
 
Join Date: Jul 2010
Posts: 37
If I not wrong, when Scenarist refers to bitrate, in fact, it refers to max bitrate (at least from my tests).

Here you have original stream info in Scenarist:



And here from x264 stream with max bitrate = 31499:



And here x264 with max bitrate = 31500:


Original mediainfo:
Code:
Video
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : High@L4.1
Format settings, CABAC           : Yes
Format settings, ReFrames        : 4 frames
Format settings, GOP             : M=2, N=25
Bit rate mode                    : Variable
Maximum bit rate                 : 31.5 Mbps
Width                            : 1 920 pixels
Height                           : 1 080 pixels
Display aspect ratio             : 16:9
Frame rate                       : 23.976 fps
Color space                      : YUV
Chroma subsampling               : 4:2:0
Bit depth                        : 8 bits
Scan type                        : Progressive
Color primaries                  : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics         : BT.709-5, BT.1361
Matrix coefficients              : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177
Reencoded video:
Code:
Video
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : High@L4.1
Format settings, CABAC           : Yes
Format settings, ReFrames        : 3 frames
Bit rate mode                    : Variable
Bit rate                         : 24.5 Mbps
Maximum bit rate                 : 31.5 Mbps
Width                            : 1 920 pixels
Height                           : 1 080 pixels
Display aspect ratio             : 16:9
Frame rate                       : 23.976 fps
Color space                      : YUV
Chroma subsampling               : 4:2:0
Bit depth                        : 8 bits
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.493
Writing library                  : x264 core 114 r1913 5fd3dce
Encoding settings                : cabac=1 / ref=4 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=hex / subme=2 / psy=1 / psy_rd=0.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=12 / sliced_threads=0 / slices=4 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=3 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=2 / weightp=1 / keyint=24 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=10 / rc=2pass / mbtree=1 / bitrate=24500 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=31499 / vbv_bufsize=30000 / nal_hrd=vbr / ip_ratio=1.10 / aq=1:1.00
Color primaries                  : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics         : BT.709-5, BT.1361
Matrix coefficients              : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177
And my x264 command line is (I always use veryslow on my final encodes, but for this testing I've used veryfast):

Code:
x264.exe 00320_1_01.avc --preset veryfast --tune film --ref 4 --b-adapt 1 --demuxer lavf --force-cfr --b-pyramid strict --open-gop bluray --qpmin=0 --weightp 1 --bitrate 24500 --level 4.1 --sar 1:1 --aud --nal-hrd vbr --pic-struct --vbv-bufsize 30000 --keyint 24 --min-keyint 1 --ipratio 1.1 --pbratio 1.1 --vbv-maxrate 31500 --threads auto --slices 4 --thread-input --stats "stats.stats" --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --pass 1 --output NUL

x264.exe 00320_1_01.avc --preset veryfast --tune film --ref 4 --b-adapt 1 --demuxer lavf --force-cfr --b-pyramid strict --open-gop bluray --qpmin=0 --weightp 1 --bitrate 24500 --level 4.1 --sar 1:1 --aud --nal-hrd vbr --pic-struct --vbv-bufsize 30000 --keyint 24 --min-keyint 1 --ipratio 1.1 --pbratio 1.1 --vbv-maxrate 31500 --threads auto --slices 4 --thread-input --stats "stats.stats" --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --pass 2 --output x264_320.264
EDIT: I've also done a quick test with MainConcept and when you set max bitrate to 31500kbps, it automatically sets it to 31499776bps
with the following error:

Code:
C043:H.264 Validation Error: bit rate value does not match HRD model. Should be 31499776.
So maybe it's a bug in x264 that incorrectly sets max bitrate value?

Greetings

Last edited by pepelugil; 21st March 2011 at 22:43.
pepelugil is offline   Reply With Quote
Old 22nd March 2011, 02:09   #4  |  Link
shon3i
BluRay Maniac
 
shon3i's Avatar
 
Join Date: Dec 2005
Posts: 2,419
Quote:
Originally Posted by pepelugil
So maybe it's a bug in x264 that incorrectly sets max bitrate value?
Nope. Did mainconcept successfully muxed or not ?

Btw, x264 use rounded valuse, and there is nothing bad. Only mainconcept uses "higher" precision, but scenarist seem to need accomplish this. You probably must use Mainconcept since source disk is probably encoded with mainconcept/cinevision.

Quote:
Originally Posted by pepelugil
If I not wrong, when Scenarist refers to bitrate, in fact, it refers to max bitrate (at least from my tests).
Not really true, but here maybe.

Btw i am little sceptic, maybe you can try without opengop since mainconcept not use opengops, this can produce wierd behavior.
__________________
ChapterGen - manipulate with chapters in various i/o formats, with CLI support
Official website or Doom9 thread
shon3i is offline   Reply With Quote
Old 22nd March 2011, 08:58   #5  |  Link
pepelugil
Registered User
 
Join Date: Jul 2010
Posts: 37
Quote:
Originally Posted by shon3i View Post
Did mainconcept successfully muxed or not ?
No, with MainConcept I’ve only selected Blu-Ray H264 High Resolution preset and changed target bitrate to 24500kbps and max bitrate to 31500kbps, but I’ve not changed buffer size and other settings and when muxing there’s an error with Cpb_size not been equal to the other playitems.

But if I set playitem to not seamless then both, x264 and MainConcept mux ok.

Quote:
Originally Posted by shon3i View Post
You probably must use Mainconcept since source disk is probably encoded with mainconcept/cinevision.
The source is Toy Story 3 and if I’m not wrong, it’s encoded with CC-HDe… When I get home I’ll try tweaking MainConcept settings and x264 without opengop to see what happens.

I can also just leave this video as not seamless, mux it and then change with BDEdit in the corresponding playlist its connection condition to seamless, I’ll lose ATC_delta but it seems it doesn’t matter in “real world”.

Thanks
pepelugil is offline   Reply With Quote
Old 23rd March 2011, 08:34   #6  |  Link
pepelugil
Registered User
 
Join Date: Jul 2010
Posts: 37
This seems a dead end... with x264 I get the correct buffer size, but max bitrate is wrong, and with MainConcept/CineVision I get the correct max bitrate, but then buffer size isn't exactly 30000000, so neither will mux in the existing seamless playlist
pepelugil is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:47.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.