News:

--

Main Menu

x264 Blu Ray Settings

Started by TimW, March 25, 2014, 07:34:51 PM

Previous topic - Next topic

TimW

Hi

Absolutely incredible software this, I haven't found anything else that does such a fantastic job of keeping the audio in sync when editing a broadcast h264 stream.  Thanks to everyone involved, you're creating a great video tool.

I'd like to respectfully suggest that further improvements to the x264 settings are re-introduced in future releases.  Despite some welcome improvements in the latest release, 2.6.8, it is still not possible to access all the settings on the advanced tabs such as Max VBV bitrate, nor can the --bluray-compat flag be set (unless I have missed it).  As a result x264 settings can be set "close" to full blu-ray compatibility, but encoded streams are still not 100% compliant.

Thanks for this great software.


Sartre

Yes, I'm curious as to why those advanced settings haven't been reimplemented yet. It's actually been years since 2.6 was introduced and a lot of the basic functionality still isn't there. Lack of VBVMax, Zones and QComp settings make 2.6x mostly unusable for my purposes.

AQUAR

To satisfy the curious: because its an open source code, work in progress, by mostly one volunteering developer.

IMHO v2.6 as an editor/recoder for AVC, satisfies a lot of endusers and has come a long way since being introduced.
If you need more from the AVC encoding process you can alway use x264 itself (not meant as criticism!).

TimW

#3
Hi All

Pleased to see the new version 2.6.9, but disappointed that advanced x264 settings have again been overlooked, making full blu-ray compatible encoding still impossible.  Appreciate that there are plenty of other ways of encoding with x264, but I haven't found one with the fantastic frame-accurate editing features of avidemux, which has the simplest and most intuitive (and therefore best) front end for video editing I have come across.  It also holds the audio sync way better than anything else.  I'm really not trying to criticise the developer(s) - as I hope the preceding comments show I have the highest regard for avidemux, which trounces paid-for software in almost all respects.  However, hopefully adding advanced x264 options (either in the tabs or as a text box to type in x264 parameters) can once again be considered?  I'm afraid I don't know anything about how this all works under the hood, so I apologise in advance if I'm naively suggesting something that is actually extremely difficult.

If there are any other frame-accurate editing tools out there that allow access to all x264 settings then I'd surely be grateful to know what they are.  I've tried handbrake, but as far as I can tell it doesn't allow editing at all (apart from cropping the start and end, and even then it's clumsy) - avidemux is still the best.

Thanks again.

mean

what options are important for BR compatibility ?

TimW

Hi mean and thanks for the opportunity to set these out.

Many of the necessary parameters can already be set in avidemux, such as profile level, tune, GOP size, B frame references and some others.  Below I have listed the ones that are mandatory parameters for a blu-ray compatible stream but which canââ,¬â,,¢t currently be accessed from the x264 settings tabs in 2.6.8 and 2.6.9 (most of them are there on the tabs, but disabled).  I canââ,¬â,,¢t take credit for the research, which I distilled from Shon3iââ,¬â,,¢s post at the doom9 forum.

ââ,¬Å"--bluray-compatââ,¬Â  flag : Though it is possible to create a stream that most players will play without this flag, providing you know what youââ,¬â,,¢re doing, it helpfully overrides a number of other settings that might otherwise be incompatible including the bframe ref count (which varies according to resolution, for HD it must be <=3), bpyramid and others.

ââ,¬Å"--vbv-maxrateââ,¬Â  : maximum allowed bitrate.  For bluray media the maximum permissible value is 40000.  This setting is on the ââ,¬Å"Advanced 1 tabââ,¬Â of the avidemux x264 config, but is disabled so that the values cannot be set. 

ââ,¬Å"--vbv-bufsizeââ,¬Â : maximum allowed buffer size.  The blu-ray spec allows a maximum of 1 second buffering, therefore this must be set relative to the vbv-maxrate.   Again this is on the disabled ââ,¬Å"Advanced 1ââ,¬Â tab and therefore cannot be set.

Without the two settings above, both my Sony player and my Samsung player wonââ,¬â,,¢t play the stream.  I get horrible playback speed problems, audio sync issues, and loss of the ability to seek through the stream.

ââ,¬Å"--sarââ,¬Â : simple aspect ratio.  I donââ,¬â,,¢t know whether this is the same as ââ,¬Å"pixel aspect ratioââ,¬Â on the ââ,¬Å"output 1ââ,¬Â tab.  Also I donââ,¬â,,¢t know whether avidemux might be setting it anyway.

ââ,¬Å"--slicesââ,¬Â : this has to be >4 if level  is 4.1.  Again it is on the disabled ââ,¬Å"Advanced 1ââ,¬Â tab.

ââ,¬Å"-o xxx.264ââ,¬Â : the output must be raw 264, however I am guessing that if it is 264 muxed into a ts container all will be okay.  At this point Iââ,¬â,,¢m afraid I donââ,¬â,,¢t know enough about the how the containers relate to the underlying streams.  However by the time it is built into the bluray structure it has to be in an .m2ts container anyway.  I would hope (but I donââ,¬â,,¢t know for certain) that tsmuxer or similar tools will sort that out provided the x264 settings are correct in the first place (with ts output container).

ââ,¬Å"--pic-structââ,¬Â : It is convenient to be able to work with 25p or 30p video, but these will only play if the ââ,¬Å"--fake-interlacedââ,¬Â option is set (this is already accessible on the ââ,¬Å"Frameââ,¬Â) tab.  In this case the ââ,¬Å"--pic-structââ,¬Â must also be set to ââ,¬Å"onââ,¬Â (which it might be by default anyway).

Others:
It would also be nice to set the colour properties on the currently disabled ââ,¬Å"output 2ââ,¬Â tab, and the ââ,¬Å"Open GOPââ,¬Â mode on the ââ,¬Å"frameââ,¬Â tab, but these are not strictly necessary for compliant output.

X264bluray.com gives the following example of x264 parameters that will produce a blu-ray compliant stream for 1080/25p (25fps progressive encoding using the fake interlaced method):

x264 --bitrate XXXXX --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 25 --open-gop --slices 4 --fake-interlaced --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 1 -o out.264 input.file

Hope the above helps.  It is the amazing frame-accurate editing (with preview) capability of avidemux and its peerless ability to keep the audio in sync (since 2.6) that make it stand out way above the rest.  If it could produce blu-ray compatible output as well it would be game over for the competition in my view.

TimW

Hi all, in the continued hope that someone might get chance to look at this for a future release I have done a detailed comparison of the settings passed to x264 by the excellent bdrebuilder (http://www.jdobbs.com) versus the settings that can be controlled in Avidemux.  Iââ,¬â,,¢ve also picked up some further info from ââ,¬Å"http://forum.doom9.org/showthread.php?t=154533ââ,¬Â

(Aside: bdrebuilder is an excellent front end for x264 that produces blu-ray compliant output with great reliability, while keeping the audio in sync most of the time.  This and other tools like handbrake and some others [and of course x264 itself] can be configured to produce x264 blu-ray compliant output, but there is no editing capability within them, except in some cases cropping the start and end.  Alternatively, they can be used to do the recoding first, and then avidemux can be used to edit.  However, this means cutting is limited to i-frames, which invariably means losing frames and sometime snippets of audio as well ââ,¬â€œ resulting in a bit of a mess.)

In addition to the settings I mentioned in my previous post, it seems that it is also necessary to be able to set the ââ,¬Å"--nal-hrdââ,¬Â  parameter (present, but disabled).  Bdrebuilder also sets the ââ,¬Å"--fillerââ,¬Â  parameter, but I have not been able to determine whether this is compulsory or not (though according to x264 help, it is forced anyway if  --nal-hrd  is set to cbr).  In addition, the bitdepth of the output must be 8, but I donââ,¬â,,¢t think this is a parameter as such and donââ,¬â,,¢t know how to set it ââ,¬â€œ maybe it will be 8 by default.

When combined with my previous post the above deals with all the compulsory settings that are not currently accessible as far as I can tell.  However, the names of the settings in Avidemux are somewhat different from those in x264ââ,¬â,,¢s help documentation.  For example ââ,¬Å"merangeââ,¬Â is called ââ,¬Å"Maximum Motion Vector Search Rangeââ,¬Â (I hope!) in Avidemux.  While Avidemuxââ,¬â,,¢s names are generally more descriptive, due to the different conventions I cannot be 100% certain that I have matched them up correctly and I apologise in advance for any omissions or errors.

For the record there are some other important settings for blu-ray that are either disabled or not present at all.  However, it looks as though they will either be inherited from the source (frame rate, timebase) or else it will still be able to produce blu-ray compliant output with the default setting.  These are  ââ,¬Å"--fpsââ,¬Â,  ââ,¬Å"--timebaseââ,¬Â,  --no-psyââ,¬Â, ââ,¬Å"--open-gopââ,¬Â, and ââ,¬Å"--qcompââ,¬Â. 

For completeness, and since I had to match them up to do the above analysis, I attach a spreadsheet which matches up all the x264 settings used by bdrebuilder on a recent successful run I did to their equivalent names in Avidemux.  Again, due to the different conventions I cannot be certain this is 100% accurate Iââ,¬â,,¢m afraid.

I hope the above will prove helpful if the developers do get chance to refresh x264 settings in a future release. 


AQUAR

@TimW,

It's nice to see an ADM end user present a development suggestion, without using some form of "attack mode" phraseology.
And then also follow it up with some self motivated home work to support the suggestion.

Can't speak for the developer('s), but ADM2.6 does continue to evolve with an emphasis on modern codecs.
Lets hope the extra X264 parameters for brd recoding is on their to-do list.

mean


TimW

mean/AQUAR/all

Thanks.  I've tried what seems like dozens of video editors/recoders.  Most of them are downright laughable and scarcely even run.  Some are good, but even with those, hardly any will hold the audio in sync with an h264 stream (bdrebuilder being an honourable exception), and the ones that will, you can't edit with.  Avidemux therefore seems to be streets ahead of the rest already in my view, so the blu-ray compatibility will be the icing on the cake.

Thanks again for taking the trouble to look into this.

mean

Quote
--vbv-maxrateââ,¬Â  : maximum allowed bitrate.  For bluray media the maximum permissible value is 40000.  This setting is on the ââ,¬Å"Advanced 1 tabââ,¬Â of the avidemux x264 config, but is disabled so that the values cannot be set. 

ââ,¬Å"--vbv-bufsizeââ,¬Â : maximum allowed buffer size.  The blu-ray spec allows a maximum of 1 second buffering, therefore this must be set relative to the vbv-maxrate.   Again this is on the disabled ââ,¬Å"Advanced 1ââ,¬Â tab and therefore cannot be set.

That part should work now

AQUAR

Thanks,
I will try it out when the win32 nightly build gets updated. 

mean


TimW

Thanks for looking at this so soon.  Just returned from holiday so I've only had time for a short test (90 secs of video) so far, but the result looks great.  I'll try with a much longer video as soon as I get the chance.  I'll probably never know enough of the technical details to say it's 100% blu-ray compliant by-the-book, but I've managed to replicate as near as I can to what I think are compatible settings and it does play no problem at all in my Samsung, with proper lip sync, and will seek properly.  I set the max bit rate to 15000 and the buffer to 13000 for the test - as suspected those must have been the settings that were doing the damage so many thanks for looking at them first.  (Aside: MediaInfo thinks the output frame rate is 50 instead of the expected 25, but after processing and resetting with tsmuxer it still plays, so it doesn't seem to matter to the player - it's most likely an irrelevant problem with the way I did the deinterlacing.)

Thanks again and I'll report back here with the results of a longer test in a few days.

AQUAR

#14
The frame rate doubling is normally the result of various bob included deinterlacing models.

But on ADM 2.6, a field is interpreted as a frame, it is a know minor "quirk" of the time based version of ADM.
It may be a handicap of the ADM 2.6 processing model and probably requires some form of work-around coding on detecting interlaced input.
The developer is aware of it.

Consequently, with ADM 2.6, any recoded interlaced video ends up with meta data that shows double the frame rate of the original, due to frame rate of output being set to field rate of input.

I resolve it by adding the "change fps" filter to the filter chain and setting it to fps-original=fps-input=fps-output.
The filter, when set up this way, only changes some meta data that results in programs like mediainfo reporting the correct frames per second.
Either way video playback of the recoded product is unaffected AFAIK (maybe some media players might playback at double the rate??).