View Full Version : Encoding Video for Blu-Ray using H264/AVC
Pages :
1
2
3
4
5
6
[
7]
8
9
sneaker_ger
4th September 2012, 20:28
http://www.x264bluray.com/home/480p-ntsc (720x480 is 480p, 1280x720 is 720p)
Vurbal
4th September 2012, 22:27
http://www.x264bluray.com/home/480p-ntsc (720x480 is 480p, 1280x720 is 720p)
Sorry, that was a typo. I'm working with several files simultaneously and my brain slipped. So basically my question remains. It's a minor thing but it's bugging me.
sneaker_ger
4th September 2012, 22:35
That link was supposed to be the answer: #1
shon3i
5th September 2012, 22:38
And, general rule is that never use maxed out settings, always leave room for some errors. So 15000 is kind max (and prefered in your case), but really if bitrate is not near that value there is no reason to use it, you can use something lower, for example 30-40% higher than target bitrate, is good enough.
And answer is #1, like sneaker_ger suggest
dvdboy
2nd December 2012, 13:57
I was wondering if someone could help me write the required command string to encode 1080p24 content for multi-angle. From what I can tell, I would need to drop open-gop, and also add no-scenecut - are there any other switches I would need to ensure the GOP structures match across both files? I also cannot seem to find any documentation regarding what the max bitrate would be for each angle.
Many Thanks
mp3dom
2nd December 2012, 14:54
The suggested settings for multi-angle are:
- No scene change detection
- Closed GOPs
- Smaller GOPs length
- Strict CBR (meaning that it is preferred that every GOP has the same constant bitrate)
In multi-angle, all the angles should have the GOP headers aligned, so they need to be encoded in the same way. A CBR stream increase the likelihood to have a seamless angle-change. Also, a small GOP (15-18 frames, rather than 24) ensure that the angle streams are aligned properly. There's no more limit on the bitrate like it was for dvd. You can go up to 40 Mbps for each angle.
dvdboy
2nd December 2012, 17:28
Thanks MP3Dom.
How do I set a strict CBR with x264? Is it just a case of setting the bitrate to the same as the max bitrate, so my commandline would be something like:
x264 --bitrate 30000 --preset veryslow --tune film --bluray-compat --vbv-maxrate 30000 --vbv-bufsize 30000 --level 4.1 --keyint 18 --no-scenecut --slices 4
--colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 1 -o out.264 input.file
Many Thanks
--EDIT--
Nevermind, that seems to have worked - plays back in WinDVD ok. Many Thanks.
Nico8583
2nd February 2013, 11:01
Hi,
I would like to encode AVC/MVC but I don't know what settings to use for B-Frames (2 or 3 ?) and Reference Frames (3 or 4) ?
Is there a relation between bitrate and B-Frames/Ref Frames ?
Thanks !
sneaker_ger
2nd February 2013, 11:05
Higher limits for B-Frames and Reference Frames result in higher compression. (Better quality at the same bitrate/lower bitrate at same quality)
Stick to the presets and Blu-Ray examples (if you actually want to encode a Blu-Ray structure - not if just your source is a Blu-Ray) if you don't know your way around x264.
Nico8583
2nd February 2013, 11:27
Thanks for your response.
Yes I want to encode a Blu ray structure, so B-Frames = 3 and Ref Frames = 4 will be better than 2 and 3. No problem with this settings to play in a Blu ray player ?
What are impacts on encoding and decoding ?
sneaker_ger
2nd February 2013, 11:57
Yes I want to encode a Blu ray structure, so B-Frames = 3 and Ref Frames = 4 will be better than 2 and 3. No problem with this settings to play in a Blu ray player ?
Yes and yes.
What are impacts on encoding and decoding ?
Raising B-Frames from 2 to 3 has basically no impact on decoding (more than 3 is not Blu-Ray compatible anymore, though), more ref frames can result in incompatibility with many players if you go too high, but 4 is always ok for Blu-Ray.
Since you had to ask about these I highly recommend that you do not set them yourself!
Go here (http://www.x264bluray.com) and just copy the appropriate examples you find on the left side. Only change "--preset veryslow" to a preset of your choice (unless you are fine with the slowness of preset veryslow, of course.) These presets in combination with the rest of the example commands will automatically choose the optimal values for B-frames and ref frames.
Nico8583
2nd February 2013, 15:40
Thanks but I don't use x264, I use Rovi MVC Encoder to encode AVC/MVC :)
You can find my post here about MVC : http://forum.doom9.org/showthread.php?t=166981 (if you have suggestions I'm interested :D)
TheProfosist
25th March 2013, 11:48
there is max bitrate and info for DVDs but what if I wanted to put short specials or clips on a CD? Is this even possible if so what would the VBV settings be?
laserfan
25th March 2013, 12:59
there is max bitrate and info for DVDs but what if I wanted to put short specials or clips on a CD? Is this even possible...
Although I can't seem to find any posts here about it, I do remember making a CD with a BD structure on it and it did work. It was so long ago I can't remember exact settings, but I most probably just used the DVD params to make it.
But then I couldn't rationalize use of CDs given how cheap DVD-Rs had become so it became just a fun exercise.
I should add that it's possible-if-not-likely that certain (many?) standalone players won't like it--mine are are all Sonys.
TheProfosist
25th March 2013, 13:10
Although I can't seem to find any posts here about it, I do remember making a CD with a BD structure on it and it did work. It was so long ago I can't remember exact settings, but I most probably just used the DVD params to make it.
But then I couldn't rationalize use of CDs given how cheap DVD-Rs had become so it became just a fun exercise.
I should add that it's possible-if-not-likely that certain (many?) standalone players won't like it--mine are are all Sonys.
I assumed that the DVD settings would work as well since i would only be doing 480p but wouldnt the VBV buffer and max rate need to be lowered since the read speed of a CD is much lower than even a DVD
Edit: I also was wondering why --pulldown double is recommended for 720p (http://goo.gl/tImdN) instead of --fake-interlaced which is what i know works with 1080p (http://goo.gl/cMihP)
rallymax
25th March 2013, 16:43
720p is 50 and 60 frames per second thus why you double up 25 or 30fps source.
1080 is interlace only thus why you want to encode progressive but set in the parameters that it is interlaced - thus "fake interlaced".
TheProfosist
25th March 2013, 16:48
I assumed that the DVD settings would work as well since i would only be doing 480p but wouldnt the VBV buffer and max rate need to be lowered since the read speed of a CD is much lower than even a DVD
Edit: I also was wondering why --pulldown double is recommended for 720p (http://goo.gl/tImdN) instead of --fake-interlaced which is what i know works with 1080p (http://goo.gl/cMihP)
just realized that the BD spec has no interlaced specification for 1280x720 interlace thats why that needs to be done
anyone have any idea on the VBV if I wanted to make a BD spec CD?
rallymax
25th March 2013, 19:18
I'd take the read speed of the cd and halve it.
eg "x32" read, I'd take as x16.
so...
44100 * 2 * 16 = 1411200 bits/second
(that "x16" number is times the normal read speed of audio off of an audio formatted cd. the audio sample rate of a CD is 44.1khz and is stereo. thus the 44.1k * 2 * read multiplier.
SeeMoreDigital
25th March 2013, 22:02
just realized that the BD spec has no interlaced specification for 1280x720 interlace thats why that needs to be done
Indeed, all you have to do is re-encode each interlaced 'field' into a progressive 'frame'... Job done!
sneaker_ger
29th March 2013, 15:31
Also, is it guaranteed that --vbv-bufsize 30001 --vbv-maxrate 40001 for example would already not be spec compliant any longer?
Well, since those are maximum values it is not guaranteed they'd actually be fully used, I guess.
Ao, if Blu-ray Disc specification can handle --vbv-bufsize 30000 --vbv-maxrate 40000 for Level 4.1, then why is Level 4.0 suddenly restricted to --vbv-bufsize 24000 --vbv-maxrate 24000? I mean, ultimately it's the same hardware.
So, for Level 4.0, shouldn't it rather be --vbv-bufsize 25000 --vbv-maxrate 25000 instead of 24000 (Bufsize not 30000 or 31250 because post #1 says Bufsize greater than Maxrate is not allowed in Blu-ray Disc specification)?
Level 4.1 requires 4 slices for better multi-threading while level 4.0 does not, so the hardware demands can be different.
rallymax
29th March 2013, 16:15
So, if Blu-ray Disc specification can handle --vbv-bufsize 30000 --vbv-maxrate 40000 for Level 4.1, then why is Level 4.0 suddenly restricted to --vbv-bufsize 24000 --vbv-maxrate 24000? I mean, ultimately it's the same hardware.
4.1 you must have slice support (ie you have 4 decoders in the silicon to do each 1/4 of the frame) so I could understand why 4.0, which doesn't have slice as a requirement, would choke above 24Mbps.
Are you just asking out of curiosity or is there some reason you're challenging the br spec - which exists to guarantee any spec compliant decoder will work with your spec compliant encode?
rallymax
29th March 2013, 16:17
Well, since those are maximum values it is not guaranteed they'd actually be fully used, I guess.
That value it put into the header information so any BR verifier worth it's salt would fail it since it's greater than the standard's permissible maximum.
Guest
29th March 2013, 20:51
The spec is publicly available for those with the means to pay for it. I have it through my company, for example.
kieranrk
31st March 2013, 18:13
So how would you (or shon3i) know?
Just wondering ;).
Having worked on this with shon3i in the past, he has the spec for his employment.
kolak
20th June 2013, 22:21
I almost sure that for 2D they are the same.
Fro 3D: L+R max is 60Mbit, buffer don't remember. There were some problems with 1st gen players with B frames (CABAC also) and also older PS3 has problems with peaks at 60Mbit- many studios use way less.
mp3dom
21st June 2013, 08:08
It should be 40Mbps max for the main view and 20Mbps max for dependant.
kolak
22nd June 2013, 14:50
Is it? Not sure if there is such a restriction (thought it does make sense).
paradoxical
25th June 2013, 22:42
Just wondering:
Does anyone here know if the official Blu-ray Disc specifications allow for xvYCC H.264 encoding?
Probably not. Hence why to get the expanded colors of Sony's "Mastered in 4K" discs require playing on their own Bluray players, such as a PS3, and need a Sony TV to support the new color space. HDMI 1.3 added xvYCC support and the PS3 has supported it for quite some time.
kabelbrand
26th June 2013, 10:25
The Blu-ray Spec demands transfer_characteristics to be set to 1 (ITU-R BT.709) for HD video. So setting it to 11 for IEC 61966-2-4/xvYCC wouldn't be compliant.
So Sony might use custom programming/parameters to signal xvYCC support in their "Mastered in 4k" Blu-ray Discs or through this user data SEI:
0x000000E5 H264 SEI {User data unregistered}
User data unregistered()
uuid_iso_iec_11578 = {bb0246a7-a1f8-c04c-a936-48e391dce761}
paradoxical
26th June 2013, 15:04
The Blu-ray Spec demands transfer_characteristics to be set to 1 (ITU-R BT.709) for HD video. So setting it to 11 for IEC 61966-2-4/xvYCC wouldn't be compliant.
And clearly they aren't setting the transfer_characteristics to something else which isn't what I was saying they did. Obviously that would be disallowed. But adding some sort of extension to allow expanding the gamut to xvYCC that would get ignored by any other player is probably not disallowed and that was my point. It really is no different than all the extra copy protections added to DVDs that are not part of the spec but they are still considered valid DVDs and carry the DVD logo.
So Sony might use custom programming/parameters to signal xvYCC support in their "Mastered in 4k" Blu-ray Discs or through this user data SEI:
0x000000E5 H264 SEI {User data unregistered}
User data unregistered()
uuid_iso_iec_11578 = {bb0246a7-a1f8-c04c-a936-48e391dce761}
It's definitely using some sort of custom fields or signalling that only their players read and is ignored by others such that it causes no incompatibility. Their Mastered in 4K discs will play in any Blu-Ray player you just won't get the expanded gamut unless it's a Sony player. Someone would have to analyze a stream from one of the discs to nail down for certain.
rallymax
26th June 2013, 17:25
And clearly they aren't setting the transfer_characteristics to something else which isn't what I was saying they did. Obviously that would be disallowed. But adding some sort of extension to allow expanding the gamut to xvYCC that would get ignored by any other player is probably not disallowed and that was my point. It really is no different than all the extra copy protections added to DVDs that are not part of the spec but they are still considered valid DVDs and carry the DVD logo.
It's definitely using some sort of custom fields or signalling that only their players read and is ignored by others such that it causes no incompatibility. Their Mastered in 4K discs will play in any Blu-Ray player you just won't get the expanded gamut unless it's a Sony player. Someone would have to analyze a stream from one of the discs to nail down for certain.
Is there somewhere that you can download a MTS file that has been authored this way? I'll put it through my h.264 analyzer to find out what they did.
paradoxical
26th June 2013, 17:29
Is there somewhere that you can download a MTS file that has been authored this way? I'll put it through my h.264 analyzer to find out what they did.
Not anything legitimate that I know of. You'd have to buy a disc or go an illegitimate route.
Edited to add:
Obviously I don't support going an illegitimate route.
dvdboy
29th June 2013, 23:18
I asked a while back about encoding multi-angle video, and I was wondering if anyone can answer a related point while I'm waiting for my video to encode.
Do the two angles have to be the same bitrate? I'm not sure how the files are interleaved on the disc, but if they were both CBR, both with the same IDR, no scene detection etc, would it matter if one video was a higher bitrate than another?
dvdboy
1st July 2013, 22:39
Do the two angles have to be the same bitrate?
Yes DVD-BOY, they do:
Error : Seamless_angle_change is invalid, because Video Bit_rate differs between Main Angle and Angle. [PlayItemID:131]
Error : [MUX] Can not write MUX file(s) : Could not create MUX XML File(Invalid [Clip/Stream Data][Scenario Title])
shon3i
15th July 2013, 20:42
@jq963152 false positive (http://www.x264bluray.com/issues-with-certain-analyzers)
detmek
27th July 2013, 11:17
AFAIK, settings are applied correctly but some SEI messages and/or header are lost and muxing software refuses to mux h.264 stream.
Lyris
28th July 2013, 14:21
Forgive me for missing the point, but for what purpose would you ever want to output MKV or MP4 for going into a BD authoring application? You'd have to demux the stream to get it in anyway?
shon3i
28th July 2013, 17:14
Megui is just another GUI for x264 is not official application or even specialized for Blu-Ray encoding. It's very useful but you need know what you are doing if you want 100% compatible BD stream.
detmek
28th July 2013, 19:39
Besides, its "Target playback device", not "Target authoring format". It just limits VBV and DPB because Blu-Ray players are hardware limited.
neil wilkes
29th August 2013, 09:47
You could modify x264 to write frame_mbs_only flag as zero. You'd have to write pic_struct too but the spec isn't clear whether it wants you to signal the frame as two fields or as one frame.
From my limited experience with x264 (a superb encoder, BTW) when I made the mistake of encoding a 25fps piece as PS, as soon as it got multiplexed into DoStudio, the audio played out correctly but the video played out at 2x speed - it took each frame as an interlaced one not a progressive one as at 1920x1080 you cannot, repeat cannot use PS.
Whether or not flagging a PS encode as interlaced will work is - I suspect - dependent on the multiplexing engine used. The Corel one certainly treats even 25p as interlaced when compiling.
The best workaround, if you want to use Progressive scan footage is to shoot at 24. There is no valid reason whatsoever to shoot at 25fps.
jpsdr
31st August 2013, 08:13
I've personnaly used x264 to encode 25fps 576p video using "--fake-interlaced" and "--pic-struct", and mux with scenarist, result was perfectly fine. Never tried other frame size for now.
SeeMoreDigital
12th November 2013, 15:28
Hi Neil,
I've just discovered some of your work on my 'Yes - Close to the Edge' Blu-ray disc, that arrived this morning... There you were in the sleeve notes.
Nice one ;)
Shevach
3rd February 2014, 11:58
Dear experts
According to Blu-Ray spec. (9.5.1.5) buffering period and picture_timing SEI are not mandatory.
If a stream does not contain these SEI messages how a decoder should choose initial_cpb_removal_delay (which is sgnaled in the buffering_period)?
kieranrk
9th February 2014, 21:40
Dear experts
According to Blu-Ray spec. (9.5.1.5) buffering period and picture_timing SEI are not mandatory.
If a stream does not contain these SEI messages how a decoder should choose initial_cpb_removal_delay (which is sgnaled in the buffering_period)?
By using the DTS and PTS along with the PCR which the TS spec defines as being equivalent to the calculations from initial cpb removal delay and friends.
Shevach
14th February 2014, 17:46
So, the first DTS corresponds to the initial_delay_offset counted from the first PCR.
kieranrk
15th February 2014, 02:38
So, the first DTS corresponds to the initial_delay_offset counted from the first PCR.
Not the first PCR but the PCR that's associated with the packet containing the beginning of the first frame. The PCR can pretty much be construed as the arrival time of the data into the buffer. This is explained in more detail in the T-STD part of the MPEG-TS specification.
Shevach
21st February 2014, 16:15
Thanks for your detailed reply.
By the way, is there any Blu-Ray stream analyzer?
kieranrk
23rd February 2014, 16:10
There are a few I believe such as:
http://www.dvdverification.com/public/101.cfm
However, I don't know how low-level they are. I think there is now parity between the BDAV-STD model and the MPEG-TS T-STD model but you'd have to check the related documents. However, most MPEG-TS analysers are designed for CBR whereas Blu-Ray is VBR with a PCR attached to every TS Packet.
Shevach
10th March 2014, 10:28
Dear BluRay practitioners
i have several questions on BDAV-STD.
1)
What the error MUX_SN_E_TS_UNDERFLOW_ERR means?
ERROR: TSWrapper.dll::CTSWrapper::ProcThreadMain::Video buffer underflows. - @8 seconds ::
[MUX_SN_E_TS_UNDERFLOW_ERR]
My conjecture is underflow of MB1 buffer. Am i right?
2) How data enters to MB1 buffer? In T-STD model the data enters to multiplexor buffer according to transport_rate which is derived from successive PCRs. In BDAV-STD each TS packet is extended by the time-stamp. i conjecture that the TS packet in BDAV-STD enters to TB1 according to these timestamps.
Lyris
10th March 2014, 22:56
Sounds like you're using either Scenarist or DVD Architect? Which software are you authoring with?
1: do you have a lot of audio tracks? I'll get this error usually when having a large DTS-HD Master Audio track. The solution is to limit the maxrate from 40000 down to something like 38000 which is usually enough.
2: I'll let someone else answer that.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.