Log in

View Full Version : Split AVC-Elementary Stream but remain Blu-ray compatible


pyrisurfer
7th October 2012, 13:16
I want to encode a BD5 with two titles (about 50 minutes each). To have a constant quality throughout both titles I thought I'd join them together in an Avisyth script, do a twopass encode with x264 and then split the elementary stream in two parts again (I need two separate files for the authoring).
I thought I'd do the splitting with DGAVCIndex/DGIndexNV, but what I would like to know is: will the streams both stay 100% Blu-ray compatible. I've read multiple times that remuxing etc. can break certain things in the bitstream with are required for compatibility. And once I opened the splitted stream in MediaInfo, I noticed that the x264 encoding parameters were gone, which leaves the question what else isn't there anymore.

LoRd_MuldeR
7th October 2012, 13:26
Well, if you deal with "raw" (elementary) H.264 streams, nothing is re-muxed when you split the stream, because it never was muxed into a container before the split-operation.

Two "valid" elementary H.264 streams can be concatenated via "copy /b part1.264 + part2.264 joined.264" and you will again get a "valid" H.264 stream. So I don't see a reason why splitting shouldn't work too.

Given, of course, that you "cut" at a suitable position, e.g. not in the middle of a frame and not at a position where you'll get "orphaned" P- or B-Frames.

The reason why you may loose your x264 settings by cutting a stream is quite simple: x264 writes its setting into a custom SEI message that is stored at the beginning of the stream. After the cut, it can be only in one of the segments!

However the x264 custom SEI message is only for debugging purposes and for convenience. It's not related to "BluRay" compatibility. It will simply be ignored during playback.

[EDIT]

Only problem I can imagine is related to VBV conformance. With VBV enabled, x264 will ensure that no buffer underflow will occur - assuming that the stream is played back from the beginning all the way to the end.

Now if you cut the stream at some position, it means that the VBV buffer of the second segment (which is now a separate stream) will be reset to the initial occupancy rather than what the actual occupancy was at that position.

If, for example, the buffer occupancy at the "cut" position happened to be higher than 90%, but the initial buffer occupancy is "only" 90%, this may (in theory) result in a buffer underflow. No idea how realistic that is, though!

pyrisurfer
7th October 2012, 13:35
Given, of course, that you "cut" at a suitable position, e.g. not in the middle of a frame and not at a position where you'll get "orphaned" P- or B-Frames.

As far as I know DGAVCIndex and DGIndeNV only split at the beginning of a GOP. But since I have Open Gop enabled I probably have to place a chapterpoint at where I want to split the stream, correct?

[EDIT]

Now if you cut the stream at some position, it means that the VBV buffer of the second segment (which is now a separate stream) will be reset to the initial occupancy rather than what the actual occupancy was at that position.

Is there a way around that problem? Or is it possible to do a firstpass on both streams and then two separate secondpasses for them?

If it is anyhow relevant: The cut will be placed on a black screen with the one title fading out and the next one fading in.

LoRd_MuldeR
7th October 2012, 13:46
As far as I know DGAVCIndex and DGIndeNV only split at the beginning of a GOP. But since I have Open Gop enabled I probably have to place a chapterpoint at where I want to split the stream, correct?

Yes, I think "Open GOP" might result in "orphaned" B-Frames when cutting, because the B-Frames at the end of one GOP may reference to the I-Frame of the next GOP.

Enforcing an IDR-Frame at the position where you want to cut should resolve the issue.

chompy
8th October 2012, 07:32
Depending on the muxing program you are using, joining various elementary streams in one prior to mux will lead to error.

For example Scenarist BD will complain with "ERROR: Invalid timing info. (DTS of xxxth AU is not greater than DTS of previous AU)"

nixo
8th October 2012, 08:29
You could try "HD Files Splitter" (and merger):
http://www.dvd-logic.com/hdsplitter.htm

This includes the AVC corrector tool which *should* make it possible to eliminate timing info errors. It's freeware.

--
Nikolaj