VideoHelp Forum
+ Reply to Thread
Results 1 to 15 of 15
Thread
  1. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    Hello VideoHelp,

    Today is my 5 year anniversary with this fabulous community.

    You have my many thanks for the friendships, the knowledge and the memorable times – and I look forward to many more. In my own humble way I offer a guide with information that is special to me. I hope it proves very helpful to some.

    Please also feel free to ask questions or offer suggestions.

    Thank you,
    Geordie
    I hate VHS. I always did.
    Quote Quote  
  2. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    Since high quality Standard Definition (SD) video is associated with DvD/MPEG-2, and blu-ray (BD) is the de facto standard High Definition (HD) medium, much confusion has surfaced regarding SD video on BD.

    This makes it even more complicated with an MPEG-4 format like H.264 (MPEG-4 AVC) as to its possibility, and particularly to its complexity (interlacing, pull-down, and peculiar values for non-square pixel aspect ratios, etc). This format has even been documented as unsupported, not only in Forums, but also with consumer and several supposedly professional BD edit, encode and author tools. Even some guides have gotten it wrong.

    Was it purposeful omission, ignorance, or just one big burden for them?

    However, as stubborn, and even problematic, as the SD H.264 BD spec can be, it is indeed possible – and can be quite useful when solved.

    As a result, despite the fact that there may be a few blu-ray guides available, this guide will focus on only just this very gray area between disc formats and optimize it. It will clear much of the mis-information behind this complicated, and very misunderstood, and even neglected, target format.

    So why bother?

    Facts:

    DvD compliant video is pretty much limited to:
    -The video format of MPEG-2
    -Disc capacities of ~4.7GB/8.5GB (single/dual layer respectively)
    -Resolutions up to only 480/576

    BD compliant video, with its more modern features, supports:
    -The video format of MPEG-2, plus two other more efficient formats such as H.264 and VC-1.
    -Disc capacities of ~25GB/50GB (single/dual layer respectively)
    -Resolutions from 480/576 to 1080.

    Given the fact that H.264 can be anywhere from 1.5 to 3 times smaller in files size, with similar quality, to MPEG-2, and the much greater disc capacity of BD, it’s not hard to notice with ballpark mathematics that one can store 10-20 times the volume of SD (480/576) content on one disc (per layer) with BD than with DvD.

    These figures also qualitatively stand to be increased significantly furthermore taken into consideration the much lower number of collective vacant remainders in storage (such as the wasted empty space that can occur storing content across multiple DvDs).

    As a result, leveraging these advantages can provide some interesting productions.

    Some examples:
    -1000 music videos
    -Recordings of 10 seasons of a certain TV show
    -Over 20 movies in a certain category
    -Family videos of your child from 1-5 years old
    -Dozens of VHS tapes captured
    -Many, many hours encoded from DV tape/DV format

    …each on one disc and playable in every blu-ray player.

    Of course, this is hypothetical due to many factors, but nevertheless, such collections would normally otherwise be considerably awkward on DvD, spanning over many, many more discs.

    And that is the purpose of this guide. For those that have lots of content in SD, enjoy H.264 encoding, and want the playback option of blu-ray.

    Again, this is an option and available if other playback methods such as a media player, computer, gaming console, mobile device, USB stick, codecs or codec packs, or the less efficient use of disc space with DvD/MPEG-2, are not the desired target format/playback option.
    I hate VHS. I always did.
    Quote Quote  
  3. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    Software Used (all free):
    Professional blu-ray encoding can be achieved by several professional tools. However they can be very expensive (and some, dysfunctional with SD). This guide is only concerned with the free tools (that are also better than adequate), which includes x264, the free H.264 encoder, that has come a long way in recent years.

    All that’s necessary:
    x264:
    As of this posting, most, if not all, formerly patched features necessary for blu-ray have been committed into the SVN (ex: --nal-hrd), however a patched build of x264 will still be recommended.

    Highly recommended:
    AviSynth:
    This will assist as any adjustments to the Source video are necessary to fit a blu-ray profile, such as changing resolution, fps (such as decimating, etc), cropping, etc.

    Suggestion:
    MeGUI:
    A front-end for those that wish to simplify the building of the x264 commandline, and the loading of scripts. However, it is highly encouraged that “Custom Command Line” is used from the Misc tab in Config. This will override any accidental options in the rest of the GUI since one wrong selection and blu-ray compatibility could be broken. Separate profile templates can also convenience.

    Then again, the following command will be explained shortly:

    Code:
    --bluray-compat
    As well, regardless of what tool is used – only raw video streams (*.264 or *.avc) must be generated from the encode. No MP4 or MKV. Explained later.

    More (optional) tools will be discussed as needed (for audio, muxing, etc), as well as other helpful ones at the end of the guide for other supplementary tasks.

    Assumed Knowledge:
    -Basic knowledge of video (and audio) - video/audio formats, encoding, DvD, BD, fps, resolutions, aspect ratios (display, pixel), pulldown, interlacing, bitrates, muxing, video containers, etc.
    -Knowledge of running x264 command line options, and some basic AviSynth.
    Last edited by PuzZLeR; 12th Oct 2011 at 13:05.
    I hate VHS. I always did.
    Quote Quote  
  4. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    Values in the chart are accompanied by commandlines following.

    Click image for larger version

Name:	Chart.png
Views:	1335
Size:	38.4 KB
ID:	34022

    A blu-ray disc can contain a combination of content from all resolutions, aspect ratios and audio/video formats, etc.
    A standard blu-ray disc can also be authored with both PAL and NTSC content, however this is assuming the actual player accomodates both the PAL and NTSC standards.
    Both PAL and NTSC schemes are stand-alone standards, however mixed combinations internally at the stream level (ex: 720x480 with 25fps) are not compliant.

    All SD Profiles must be encoded Interlaced, or flagged Interlaced, for content that is meant to be visually progressive (stated).

    COMMANDLINES

    Each commandline uses input file: Source.avi, output file: bdstream.264. Encoding mode is CRF (18), but 2-pass methods are also valid.

    The following commands (near the end of the commandline) are mostly cosmetic and subjective settings are only suggestions: aq-mode, aq-strength, deblock, tune, preset, chroma-qp-offset, b-adapt, and can be used with any profile.

    COMMANDLINE COMMON COMMANDS FOR ALL PROFILES
    Code:
    x264 --level 4.1 --crf 18 --bluray-compat --aud --nal-hrd vbr --vbv-maxrate 15000 --vbv-bufsize 15000 --b-pyramid strict --bframes 3 --ref 3 --weightp 0 --cabac --slices 4 --partitions p8x8,b8x8,i8x8,i4x4 --aq-mode 1 --aq-strength 1.0 --deblock -1:2 --tune film --preset medium --chroma-qp-offset -2 --b-adapt 2 --input Source.avi --output bdstream.264
    ADD THE FOLLOWING COMMANDLINES (anywhere in between) PER PROFILE:
    (Shown here for demonstration - suggestion is to create a full template of each as required.)

    INTERLACED DISPLAY

    PAL, 25fps (25i-INTERLACED DISPLAY), Aspect Ratio 4:3 (Full-Screen):
    Code:
    --keyint 50 --min-keyint 2 --open-gop bluray --colorprim "bt470bg" --transfer "bt470bg" --colormatrix "bt470bg" --sar 12:11 --interlaced
    PAL, 25fps (25i-INTERLACED DISPLAY), Aspect Ratio 16:9 (Wide-Screen):
    Code:
    --keyint 50 --min-keyint 2 --open-gop bluray --colorprim "bt470bg" --transfer "bt470bg" --colormatrix "bt470bg" --sar 16:11 --interlaced
    NTSC, 30/1001=29.97fps (30i-INTERLACED DISPLAY), Aspect Ratio 4:3 (Full-Screen):
    Code:
    --keyint 60 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 10:11 --interlaced
    NTSC, 30/1001=29.97fps (30i-INTERLACED DISPLAY), Aspect Ratio 16:9 (Wide-Screen):
    Code:
    --keyint 60 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 40:33 --interlaced
    NTSC, 24/1001=23.976fps (24p-INTERLACED DISPLAY) (with pulldown), Aspect Ratio 4:3 (Full-Screen)*:
    Code:
    --keyint 48 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 10:11 --interlaced --pulldown 32
    NTSC, 24/1001=23.976fps (24p-INTERLACED DISPLAY) (with pulldown), Aspect Ratio 16:9 (Wide-Screen)*:
    Code:
    --keyint 48 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 40:33 --interlaced --pulldown 32
    PROGRESSIVE DISPLAY

    PAL, 25fps (25i-PROGRESSIVE DISPLAY), Aspect Ratio 4:3 (Full-Screen):
    Code:
    --keyint 50 --min-keyint 2 --open-gop bluray --colorprim "bt470bg" --transfer "bt470bg" --colormatrix "bt470bg" --sar 12:11 --fake-interlaced --pic-struct
    PAL, 25fps (25i-PROGRESSIVE DISPLAY), Aspect Ratio 16:9 (Wide-Screen):
    Code:
    --keyint 50 --min-keyint 2 --open-gop bluray --colorprim "bt470bg" --transfer "bt470bg" --colormatrix "bt470bg" --sar 16:11 --fake-interlaced --pic-struct
    NTSC, 30/1001=29.97fps (30i-PROGRESSIVE DISPLAY), Aspect Ratio 4:3 (Full-Screen):
    Code:
    --keyint 60 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 10:11 --fake-interlaced --pic-struct
    NTSC, 30/1001=29.97fps (30i-PROGRESSIVE DISPLAY), Aspect Ratio 16:9 (Wide-Screen):
    Code:
    --keyint 60 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 40:33 --fake-interlaced --pic-struct
    NTSC, 24/1001=23.976fps (24p-PROGRESSIVE DISPLAY) (with pulldown), Aspect Ratio 4:3 (Full-Screen):
    Code:
    --keyint 48 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 10:11 --fake-interlaced --pic-struct --pulldown 32
    NTSC, 24/1001=23.976fps (24p-PROGRESSIVE DISPLAY) (with pulldown), Aspect Ratio 16:9 (Wide-Screen):
    Code:
    --keyint 48 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 40:33 --fake-interlaced --pic-struct --pulldown 32
    If you wish to use a GUI like MeGUI, just cut and paste the (consolodated) profile into the XML file where Custom Command Line insertions are allowed (with maybe the exception of x264 executable, input and output file names). A separate XML template for each profile required is suggested.

    *Not a practical profile for soft telecine, as encoding it interlaced defeats the purpose, but included since it is theoretically compliant with BD. Having said that, progressive encoding and flagged interlacing is highly recommended for soft telecine.
    Last edited by PuzZLeR; 18th Dec 2015 at 02:01.
    I hate VHS. I always did.
    Quote Quote  
  5. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    BUILDING OF THE COMMANDLINE AND AVISYNTH SCRIPT:

    The following lists important x264 functions for blu-ray compatibility. For more info, please refer to the x264 MeWiki.

    Level
    All that’s necessary is level 4.1 for Primary streams if intended for higher quality settings. Anything less, such as 4.0, 3.2 or 3.1, for a lesser version of the spec, is not covered.

    Code:
    --level 4.1
    Delimiters and Signal Information
    The following, each as is, are necessary for blu-ray compatibility:

    Code:
    --aud --nal-hrd vbr
    VBV (Bitrate and buffer)
    Since this is SD video, this guide recommends a lower rate and buffer, although not necessary, but has an effect on better quality (and respects DvD disc limits as an option). There is little reason to use more than this anyway for SD H.264 video.

    Code:
    --vbv-maxrate 15000 --vbv-bufsize 15000
    along with the larger GOPs allowed by BD for lower bitrate video (explained below).

    The maximum is also acceptable for SD video:

    Code:
    --vbv-maxrate 40000 --vbv-bufsize 30000
    However, the latter is better suited for HD, and likely overkill for H.264 SD and not as efficient an encode since to compensate for the potentially higher bitrate a smaller GOP size is necessary for fluid BD compatibility, and that can hurt quality.


    B-Pyramid
    BD does not accept normal b-pyramids, however a good compromise, and recommendation, for better quality (instead of none, which is also BD compliant) is the following:

    Code:
    --b-pyramid strict
    Reference frames and b-frames
    Only 3 b-frames are allowed, and up to 6 for multiple reference frames (for Level 4.1). The following are recommended as a good compromise between quality and encoding time since more than 3 reference frames makes little difference in quality for BD SD video profiles (unless maybe it's animation video with the flat backgrounds).

    Code:
    --bframes 3 --ref 3
    Weighted prediction
    Parameter must be 0 or 1 to be BD compliant. Recommendation is to disable it, since 1 doesn’t apply much benefit for BD video.

    Code:
    --weightp 0

    CABAC
    Fully allowed with the blu-ray specification, especially if using a higher profile (such as Level 4.1 suggested in this guide). Highly recommended for a more efficient encode. Although the default setting is enabled, it is included for demonstration.

    Code:
    --cabac
    Slices
    Use 4 slices for higher profiles (such as the Level 4.1 suggested in this guide, and by x264 settings for blu-ray).

    Code:
    --slices 4
    GOPs
    Unlike the default settings of x264, blu-ray video must have GOP sizes that are even 10 times smaller. However, since we are using SD video, and a bitrate ceiling of 15mbps, we can increase sizes, for better quality results, to double that of the respective fps, and in turn allow 2 seconds of GOP size minimum.

    Use the values 48, 50 and 60 for respective framerates of 24/1001, 25 and 30/1001 and a minimum of 2 seconds.

    For example, for PAL, the following is fine.

    Code:
    --keyint 50 --min-keyint 2
    --open GOP
    This function is only, in theory, a cosmetic encoding enhancement and not necessary for BD compliance although supported. However, it’s worth mentioning and highly suggested for encoding BD streams. Due to the smaller GOPs that are necessary for fluid BD playback, the video can experience “shimmers” or “pulses” on slower/still scenes, like a heartbeat as GOPs shift. This function detects much of this activity and alleviates the symptom with techniques that improve quality significantly. Use it with the blu-ray parameter:

    Code:
    --open-gop bluray
    Maximum Vertical Range
    Although the default is fine, most purists would use the following with a Level 4.1 Profile:

    Code:
    --mvrange 511
    Left up to debate.

    Partitions
    The following can be used for BD compatibility:

    Code:
    --partitions p8x8,b8x8,i8x8,i4x4
    However this is the default, and is sufficient, so it is not necessary to be included in the commandline. Important note: p4x4 is not BD compliant, but is not included in the default setting regardless.

    Colorimetry Standards
    Refer to chart, which differs for PAL and NTSC video standards of BT.470 BG and SMPTE 170M respectively, and associated command line functions:

    Code:
    --colorprim "bt470bg" --transfer "bt470bg" --colormatrix "bt470bg"
    OR

    Code:
    --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m"
    Not necessary, but can be erroneous if wrong input is used (such as with those associated with HD).

    --qpfile
    Use this for time codes and chapters. But care and caution is necessary as each muxer may process them differently (such as floating point inaccuracies due to different rounding methods). This is mostly a trial and error process at first.

    Blu-ray Compatiblity function
    You can include the following in your command line:

    Code:
    --bluray-compat
    This is a safety measure, and will keep all necessary parameters in check for blu-ray compatibility with respect to the blu-ray profile used, and will override any other options that go over limits. It enables key features like HRD and AUD. Recommended, and included here, but not necessary if the following are satisfied:

    Code:
    --nal-hrd vbv --aud
    And if the following don’t go over their limits as described earlier:

    Code:
    --weightp
    --bframes
    --ref
    --bpyramid
    Cosmetic x264 features
    The following are just a few of the many features of x264. They are strictly cosmetic in nature when applied to BD compatibility, however some suggestions can be made, such as care with bitrate in advance (to respect limits) whether using one pass or two pass schemes (both are fine), film as the recommended tuning for BD, etc.

    Code:
    aq-mode
    aq-strength
    deblock
    tune
    preset
    chroma-qp-offset
    b-adapt
    The reader is encouraged to research and experiment with these, and other functions, for better quality encoding.

    The following will assist in using x264 functions, along with the building of some AviSynth scripts to fit BD profiles from certain Sources:

    Resolution
    Only DvD’s Full-D1 resolutions of 720x576 (PAL) or 720x480 (NTSC) are accepted by BD SD H.264 (or any BD SD video format). You must have Source this size, or resize in your encode, such as with the following script:

    Code:
    LanczosResize(720, 576)#for a PAL profile
    Or

    Code:
    LanczosResize(720, 480)#for an NTSC profile
    Display Aspect Ratio (DAR)
    Both wide-screen (16:9) and full-screen (4:3) are honored in the blu-ray standard for SD. This must be inherent in the source, or can be adjusted with the Pixel Aspect Ratio, or cropping, etc.

    Pixel Aspect Ratio (PAR)
    Only the listed ones are compliant, however uncanny. For example, PAR=8:9 may be mathematically valid for DAR=4:3 of SD resolution 720x480, but will not be blu-ray compliant. Only 10:11, the “cropped” version for 480/576, and the standard used for MPEG-4 values, in this case will be blu-ray standard.

    You must include the appropriate x264 command line option, for example:

    Code:
    --sar 10:11
    This can be subject to an error margin since using the following equation

    Width/Height = DAR/PAR

    will base the MPEG-4 PAR values with a width of 704. Since the 704 value is also not blu-ray compliant, to use an MPEG-4 PAR with a 720 width, and deal with the disparity, we have two options:

    Option 1: Add black banding in your script to avoid distortion of 8 pixels on each side (of width) to create a 704 width effect, and would be accurate to picture integrity.

    Code:
    AddBorders(8,0,8,0)
    LanczosResize(720,480)
    Option 2: Just accept the error, and slight distortion, to avoid black banding. The distortion will be nevertheless minor and hardly noticeable.

    Frame Rate (FPS)
    Only the above FPS values are accepted. If your source isn’t one of them, you must include it in your script by either of the following:

    Code:
    ConvertFPS()
    Code:
    AssumeFPS()
    Or with other methods, depending, such as hard telecining to soft telecining. Nevertheless, your FPS must result in one of those entries in the table with respect to other attributes.

    This can done with the following x264 commandline option as well:

    Code:
    --fps
    Care should be taken when changing frame-rates.

    Interlacing/Progressive/Deinterlacing/Etc

    All blu-ray SD streams must be encoded, or flagged, interlaced – no progressive encoding is allowed. This is true even with visually progressive content or progressive film source. You have two choices.

    Option 1: You can enable interlaced encoding in x264 with the following in the command line:

    Code:
    --interlaced
    or even

    Code:
    --tff
    This is only recommended however if content is visually interlaced for playback on an interlace-aware display, and/or deinterlacing (such as with an AviSynth script) is not used.

    Otherwise, using the latter command, particularly with a visually progressive result, will not be an efficient encode. In that case, the second option is highly suggested.

    Option 2: You can encode progressive, but the stream must be flagged interlaced during the encode for it to be BD compliant.

    This is done with replacing the functions from the first option with the following fake interlace and Picture Timing SEI:

    Code:
    --fake-interlaced --pic-struct
    Either Option 1 or 2 will satisfy the BD spec.

    Note: it is necessary to include Picture Timing SEI, every time interlaced is flagged, including with pulldown, to be certain of compliancy (discussed next).
    Last edited by PuzZLeR; 18th Dec 2015 at 02:11.
    I hate VHS. I always did.
    Quote Quote  
  6. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    PULLDOWN

    This function justifies its own section, which is dedicated to pulldown, and the following x264 comandline function:

    Code:
    --pulldown 32
    Although the blu-ray SD spec reads 29.97fps for SD, 23.976fps streams are supported, but ONLY with applied pulldown (and NOT supported without it).

    Some examples of when this commandline function should be used are if working with:

    -Native 23.976fps acquired from 24p film source.

    -Encoding 29.97fps hard telecine, visually interlaced, streams to soft telecine 23.976fps. This typically can be detected when there is a pattern of two consecutive “interlaced” frames in the Source, followed by three progressive frames, looping in each scene. The following script can be used to convert from 29.97fps to 23.976fps:

    Code:
    tfm(order=1).tdecimate(hybrid=1)
    -Encoding from 29.97fps visually progressive streams, however they are from film source (usually content captured from broadcasting). This is detected when there is one repeat frame for every five, and handled with the following script to create a 23.976fps, more efficient, stream:

    Code:
    tfm(order=1).tdecimate(hybrid=1)
    -Slowing down 25fps (film-sourced) PAL content to NTSC film speed levels of 23.976fps to change regions.

    -Any other reason you may wish to have a resulting 23.976fps stream (editing speed effect, etc)

    At any rate, --pulldown 32 is necessary with any workflow that results with fps=23.97624, and ONLY fps=23.976. As well, this is regardless of Source – it’s the final output that matters.

    You must enable the following commandline functions in unison when using pulldown:

    Code:
    --pulldown 32 --pic-struct
    Unfortunately, pulldown with H.264 video is not without its issues.

    tsMuxeR is not compatible with a stream that has pulldown (and b-frames). Muxing will result in jittery video that drops frames during playback.

    DGAVCPulldown is useless. The pulldown it implements will also cause the same problems when muxing with tsMuxeR, but furthermore, a professional application like Sonic Scenarist will simply reject the pulldown applied by deleting it during muxing (and throw the video out of sync assuming it was from hard telecined Source). This guide does not encourage tools that apply properties to a stream after an encode when they should be properly done during.

    MP4/MKV: Not BD standard containers, but worth pointing out. They can’t handle pulldown either if using them for other playback means. The stream will mux and play fine, but introduce blurs and step-ladder effects during playback, hurting playback quality.

    Having said that, a good muxer like Sonic Scenarist will mux the stream fluidly, if encoded properly (with the right commandline functions), even with b-frames, but only if pulldown is applied during the encode. The M2TS files it creates into the BDMV\STREAM folder on the disc can be used as playback files (albeit the 5%-6% overhead).

    However, what can one do if they don’t have an extra $50,000USD in pocket change to purchase a tool like Sonic Scenarist, but still want to create a BD disc with streams that have pulldown, are compliant, and have no playback problems?

    Option 1: Encode without b-frames. This will not create the jittery effect when pulldown is applied with tsMuxeR, and other supporting authoring applications like multiAVCHD.

    Replace the command line function with

    Code:
    --bframes 0
    However, keep in mind, this will not be as efficient an encode as using 3, or more, b-frames, maybe adding 25% more bitrate for the same quality. But it will be 100% blu-ray compatible and will work smoothly.

    Option 2: If your region/player supports PAL then encode with a BD PAL profile and AviSynth. For example, a typical script to create 23.976fps content:

    Code:
    tfm(order=1).tdecimate(hybrid=1)
    Can be replaced with

    Code:
    tfm(order=1).tdecimate(hybrid=1)
    AssumeFPS(25)
    LanczosResize(720,576)
    This will however be an encode that is roughly 17% higher in bitrate. Depending on Source resolution this could actually be added quality value, or fluff, but it will be compliant.

    Keep in mind to speed up audio to 96% of its duration to maintain sync (such as with the free tool Audacity). Depending on software, this can either be worked with 96% or its reciprocal value (1/x) of 104.1667%. (Audacity uses the Percent Change difference +4.1667).

    Option 3: Here’s a point in the guide where maybe MPEG-2 could be a viable option if pulldown with H.264 is complex (especially since the bitrate gap closes somewhat when using the previous two options). All streams with proper pulldown applied to MPEG-2, with a good encoder like HC Encoder, and with DvD specs, at 480/576, will be compliant in a blu-ray structure.

    Keep in mind, this guide offers the option of blu-ray playback. One can still encode with pulldown applied, and create content for future use, but in the interim can still enjoy their content in an MP4/MKV. However, it is highly suggested raw encoded streams are backed up separately before muxing into MP4/MKV.

    As well, for better playback before using these containers (MP4/MKV), remove pulldown before muxing.

    Using tsMuxeR:
    -Load the stream containing pulldown
    -Make sure stream is checked
    -Disable any changes to fps and level
    -Disable “Add picture timing info” and “Continually insert SPS/PPS”
    -Enable “Remove pulldown”
    -In Output select “Demux”
    -Select your output then hit “Start Demuxing”

    This will be a playable stream, without erratic pulldown to affect the container, ready to muxed with your audio in an MP4/MKV with the muxing tool of your choice (ex:mp4creator or mkvmerge respectively).

    Only one encode will be necessary if raw compliant streams are backed up.
    Last edited by PuzZLeR; 18th Dec 2015 at 02:15.
    I hate VHS. I always did.
    Quote Quote  
  7. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    EXAMPLE

    The following example demonstrates some usage of AviSynth and the x264 commandline to create blu-ray content.

    Source: DV-AVI video, 720x480 resolution, 29.97fps but hard telecined “interlaced”, in an aspect ratio of 4:3 capping a true 16:9 film Source in black banding, likely a TV capture.

    Target: AVC Blu-ray compliant video SD NTSC video, resolution of 720x480, 23.976fps (restored to film levels) in a true aspect ratio of 16:9 without distortion and progressive display. (Resulting file should be almost 10x smaller in file size for similar quality.)

    Script:

    Code:
    AVISource("C:Source.avi")
    ConvertToYV12() #Since this is DV-AVI
    tfm(order=-1).tdecimate(hybrid=1) #To decimate to film Source with respect to Source BFF with DV-AVI
    AddBorders(8,0,8,0) #To avoid distortion between PAR values
    Crop(0,60,0,-60) #To crop black banding and avoid distortion between AR values
    LanczosResize(720,480) #To return to compliant resolution
    Then encode with an NTSC x264 profile for progressive display (with pulldown) with wide-screen aspect ratio:

    Code:
    x264 --level 4.1 --crf 18 --bluray-compat --aud --nal-hrd vbr --vbv-maxrate 15000 --vbv-bufsize 15000 --b-pyramid strict --bframes 3 --ref 3 --weightp 0 --cabac --slices 4 --partitions p8x8,b8x8,i8x8,i4x4 --aq-mode 1 --aq-strength 1.0 --deblock -1:2 --tune film --preset medium --chroma-qp-offset -2 --b-adapt 2 --keyint 48 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 40:33 --fake-interlaced --pic-struct --pulldown 32 --input Source.avi --output bdstream.264
    I hate VHS. I always did.
    Quote Quote  
  8. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    Disclaimer and Warnings

    The option, not politics
    This guide is not looking to challenge SD’s home of MPEG-2/DvD and/or the fact that BD is sold almost exclusively for HD video productions.

    What is here is only provided as an option – targeted to those already using H.264 with a good volume of SD content, and wishing to have the option of full compliant blu-ray playback as their C/E playback medium, without having to inefficiently encode SD to HD with the longer processing and bigger file sizes only to reveal flaws inherent, or created, in the Source from the upscaling.

    Full (Re-)Encode Only
    Any “tricks” here (such as faking interlaced, or pulldown, etc) are conducted validly during the encoding phase only, not after.

    Adding pulldown, changing levels or bitrates or resolution, to supplement an encode that should have been done properly in the first place, or even rigging the actual BD structure itself, all to “make it work” are not covered here. Tools like BDEdit, DGAVCPulldown, h264info, etc., serve a different audience.

    Furthermore, this guide will also proudly disappoint those wishing to make an MKV that they’ve “acquired” play on their BD player.

    This guide assumes you are in proper possession of your Source, and only a full (re-)encode that is accepted by professional BD tools, is guaranteed for BD compliance here.

    Period-Exclamation Mark

    Retain Source
    As is good practice with any (lossy) video encoding venture, you should retain all Source. Only a playback option is demonstrated here, not an archival one. Formats, performance, technologies, etc, are always subject to change.

    The “Best Encode”
    Only encoding streams that are 100% blu-ray compliant are of interest here.

    They may not, subjectively, be the “best encode” since adding more b-frames, changing GOP sizes, or adding normal b-pyramid may achieve a 1%-5% better compression delta (quality increment per bitrate), or introduce other decoding (dis-)advantages, etc. but you will only invite “finger-crossing compatibility” and sacrifice the peace of mind that your project will play on every blu-ray player.

    Nevertheless, only the “better” BD compliant specs are covered here (ex: no Baseline/Level 3.X Profiles, Secondary Streams, etc), and in the context of “sanity in encoding” these parameters are quite capable of generating a quality encode. The video streams also decode smoothly and also respect High Profile QuickTime Compatibility.

    As well, some parameters have been optimized for blu-ray’s SD spec such as lower bitrate ceilings, and longer GOPs. Using HD’s parameters in these cases would not be the “best” encode for SD video.

    Having said that, any suggestions that would enhance SD blu-ray compatible H.264 video are greatly appreciated.

    White Paper Specs and Sonic Scenarist

    Not public domain and not covered here.

    As well, this guide is not concerned with the full spectrum of lower quality video, and lower level profiles offered by the White Paper specs for blu-ray (ex; Level 3.1, Secondary Streams, etc). Many are moot with SD video being the primary, or likely outdated anyhow, or were designed to migrate to platforms where the more CPU intensive procedures were not fully available at the time of their implementations into the standard.

    However all streams encoded here (raw *.avc) have been accepted as an Actual Asset by, and tested with, Sonic Scenarist - an industry standard benchmark in blu-ray compatibility and production.

    About DvD Compliant Video and DvD Discs and “DvD-AVC” Discs

    Any content, on any DvD disc, is not part of the BD spec. Only blu-ray video, on a BD disc, guarantees BD compliance.

    This includes standard DvD compliant discs and any blu-ray content on a DvD.

    For clarity, DvD compliant MPEG-2 480/576 SD video streams are fully BD compliant, but only in a BD structure on a BD disc. But DvD Standard video discs, for the record, are not BD compliant. Yes, virtually every BD unit plays DvDs, but they are really only, in theory, no more a feature (albeit a high-demand feature) than MP3 on a CD in a CD player.

    DvD is physically quite different from BD – it has lower capacity and a different wavelength to its red laser, and is slower – a 15mbs bitrate, much lower than the 40mbps of blu-ray discs, is highly suggested.

    Hence it needs a different system to run on a BD player, so even fully compliant BD video on a DvD disc is subject to the leniency of the BD player itself.

    Using the information here will be the closest way of creating a pseudo-compliant “DvD-AVC” (SD) video/authored disc, but only content on a BD disc is part of the spec, and that’s all that’s guaranteed here.

    As an aside, DvD-AVC is an interesting choice nevertheless, and if your player supports AVCHD (another “feature”) then it is highly likely this disc will playback easily. As well, the 15mbps limit on DvD discs shouldn’t be a problem when there’s little reason to use anything more for SD H.264 video (unless a strong desire for pseudo losslessness is in order).

    AVCHD

    AVCHD streams, although supporting both SD and HD, are not blu-ray compliant whether on a DvD or BD disc – and offered only as a feature among supporting BD players.

    AVCHD was primarily designed to be a lower complexity format generated by cameras, such as satisfying a lower bitrate threshold, to play primarily on inexpensive DvD blanks (where-as BD blanks were still in the “market skimming” price-line at the time of AVCHD’s inception). It was in many ways a Sony (partnered) initiative to win the format war with HD-DvD offering a feature exclusively supported by select BD units, (or with a measure of control by means of an established “camera standard” as a consolation prize if Sony, et al, had lost the war and offered it to HD-DvD).

    AVCHD is only a suitable target format if obtained via as an acquisition format. It is not the best option to encode to when blu-ray methods are available, and becomes less useful as BD blanks drop in price, and especially more-so for SD.

    Blu-ray compliant video is the common denominator of compatibility, and better quality, and as a result, AVCHD encoding is not covered here.

    MP4/MKV

    Special care is suggested when using such containers for playback of the streams. Of course, they are not BD standard, but most importantly, they will destroy BD compliance when used (and will need to be re-encoded to reestablish compliance).

    Multiplexing/demultiplexing a stream through MP4/MKV will delete vital data such as IDK, delimiters, HRD, SPS, etc, necessary for blu-ray compatibility, particularly any calculations/data pertinent at the container level.

    Professional tools will likely reject the streams after demuxed from MP4/MKV, or will likely be problematic on playback if successfully authored (especially more-so if hacked or rigged).

    One encode is all that’s necessary for, both, BD and MP4/MKV playback options, however, to ensure the blu-ray option is available, the raw compliant streams much be separately archived or backed up (or already in a blu-ray structure).

    In other words, MP4/MKV are fine for a playback option (except with pulldown, covered earlier) but never should be an archival option.

    What is BD compatibility?
    Other tools, or H.264 implementations, can also achieve BD compatibility, but their approach may be quite different from how x264 will do it. However, there is no varying degree of blu-ray compliance when reached – all will be just as equal in standard in the result.
    Last edited by PuzZLeR; 12th Oct 2011 at 22:38.
    I hate VHS. I always did.
    Quote Quote  
  9. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    SUPPLEMENTARY

    The focus here is to provide 100% compliant H.264 SD raw streams ready for any next step, leaving other procedures to the other many available guides for audio, authoring, burning, and other procedures.

    Thus, this supplementary section is meant to be an intro and will be brief.

    Secondary Streams
    All SD streams mentioned so far are Level 4.1 High Profile Primary streams and of the “main feature” variety, which renders SD Secondary streams rather moot since they’re of lower quality and serve as auxiliary content to the main feature(s), so focus remains with Primary streams.

    However, for the sake of completion, the parameters for SD Secondary streams have lower values. Using the x264 commands for the similar profile, ceteris paribus, just replace the parameters as shown to create compliant Secondary SD streams.

    Code:
    --vbv-maxrate 8000 --vbv-bufsize 8000 --level 3.2 --slices 1
    Note 1: No need to include slices since value of 1, or the default of 0, are both acceptable.

    Note 2: No need to add pulldown (or even Picture Timing SEI) for 23.976fps/24fps encoded video, since these framerates are included in the standard for Secondary streams.

    Audio
    Any video stream encoded from this guide will still be BD compliant packaged with any BD compliant audio format: Dolby (Digital AC-3 and others), DTS(-HD) or LPCM(WAV).

    If any audio format Source is non-standard, any tool that can generate, for example, a fully compliant A/52 AC-3 (Dolby Digital) stream, such as with a tool like Aften, will also serve the purpose.

    Audacity is also recommended if changing speeds of audio streams is necessary to match a changed framerate.

    Subtitles
    This in itself is a minor science and a full separate guide, and there are others out there. A good starting point would be to look into the freeware/donationware Subtitle Workshop and SUPread to properly handle and create and convert among .srt and .sup (to the BDN XML file format parsed with with .png images).

    MPEG-2*
    This is the less efficient of the three blu-ray video formats, however it has plenty of support with SD and can’t be ignored. Full-D1 DvD MPEG-2 streams at 480/576 are accepted by BD (but only compliant in a BD authored structure on a BD disc).

    Furthermore, the convenience of any MPEG-2 SD 480/576 compliant streams is that they’re backward compatible to DvD if wishing to create and migrate content between DvD and BD in SD or add to the mix with other formats on the same BD disc.

    Keep in mind, encoding MPEG-2 SD for BD needs not be restricted to the DvD bitrate spec limit of 9.8mbps. This can be very useful for high quality captures, or encodes from DV, etc, as up to 40mbps is acceptable if burning on a BD disc (but anything over 15mbps is likely overkill for even this format in SD).

    Arguably the best free MPEG-2 encoder is HC Encoder.

    VC-1*
    Lacking features like CABAC, multiple reference frames, etc, that H.264 has in its standard, VC-1 arguably seems less suited for lower bitrate video, hence not covered here. However, a similar guide with VC-1 would indeed be interesting.

    *A blu-ray disc can contain clips, and authored, from all three formats: H.264, MPEG-2 and VC-1, muxed with any combination of allowable audio formats, on one disc.
    .
    Authoring and Burning
    There are many excellent guides and tools for this, so it’s not covered here. Look into tools like tsmuxeR, multiAVCHD or ImgBurn to mux, create menus, and burn (such as with UDF 2.5/2.6) to create the final production from the streams generated in this guide.

    (Caution with these tools if streams have pulldown.)

    All-in-ones
    There are some solutions that will encode, author, burn, etc, in one app, however such jack-of-all-trades tools are master-of-none.

    It’s almost always good practice, especially with a project like this, to handle each step separately for best results, and especially more-so given the nature of this task. This includes a workflow of properly encoding the streams beforehand (as with this guide) before inputting into another tool for further processing.
    Last edited by PuzZLeR; 12th Oct 2011 at 22:39.
    I hate VHS. I always did.
    Quote Quote  
  10. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    First of all, congratulations for the decent, straight-2-the-point guide ,

    and for the anniversary as well.

    Now, just a couple of useless remarks:

    DvD is physically quite different from BD –
    it has lower capacity and a different wavelength to its red laser, and is slower –
    a 15mbs bitrate, much lower than the 40mbps of blu-ray discs, is highly suggested.
    Actually, the DVD media has a lower "data density" than the BD media, and so a DVD containing high-bitrate stuff has to be spinned at a higher speed than a Blu-Ray disc. On its own, a DVD cannot be "slower" (nor "faster") than a BD.

    Suggestion:

    MeGUI
    http://doom10.org/index.php?topic=47.0
    Last edited by El Heggunte; 12th Oct 2011 at 20:08.
    Quote Quote  
  11. Member
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Search Comp PM
    Great guide (and happy birthday)!
    A link to this thread should be posted in the "Guides" section.
    Quote Quote  
  12. Member
    Join Date
    Sep 2015
    Location
    Chicago
    Search Comp PM
    A few things...

    1) That's nice that x264 has a billion things to tweak. It's also nice that identified that we can further enforce Blu Ray compatibility as to override anything we set outside that scope. But, after reading pages of info, I'm still left with the same "get to the point, what should the command look like" that I already had before finding the thread. Is there a simple(r) answer than re-interpreting the manuscripts on my own?

    2) Is there an easy way to do SD widescreen, and automatically fill the screen without distorting the original aspect? And of course the extension to this... including stripping letterbox and making it widescreen when the original was fake widescreen (letterbox)?

    3) Scenario: I have full seasons of various shows on DVD. Most are typically 24 or fewer episodes. I only speak 1 language, though sometimes I don't hear so well. Eliminating foreign languages, both audio and subtitles is preferred. Keeping the subtitles NOT burned in are preferred. Where possible, I DO NOT want to compress the audio. If I can keep the original AC3 (or whatever format the original has) that would be great. And of course, the final version would be SD h264, often but not always widescreen.

    Summary:
    - Original, unedited subtitles, but eliminate foreign languages.
    - Original, unedited, audio, but eliminating foreign languages.
    - Convert video from DVD MPEG2 to good looking, blu-ray compliant video, hopefully as small of a file as possible to fit the entire season on a 25GB BDR.

    I can get 850MB-1.2GB Apple TV3 compliant h264, Profile 4.1, video that look amazing. (Using HandBrake) Everything I've tried with any other tools, including professional tools, usually push me to 2.5GB-5GB for the exact same video and it looks crappy.

    If anyone knows how to make HandBrake spit out Blu-ray compliant video directly that would address a ton of our older footage that only has Stereo audio and no subtitles.
    Quote Quote  
  13. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    Needed to check with Scenarist to answer this (don't have it at home).

    And doing a re-write of this guide right now on a holiday Monday here in CA - which just so happens to be exactly 4 years later today.

    Originally Posted by ct2193
    1) That's nice that x264 has a billion things to tweak. It's also nice that identified that we can further enforce Blu Ray compatibility as to override anything we set outside that scope. But, after reading pages of info, I'm still left with the same "get to the point, what should the command look like" that I already had before finding the thread.
    That IS the point. Blu-ray compatibilty is very, very picky, and has many requirements, and many are conditional upon Source and other factors. And each needs further explanation as to the possibilities they branch out too. I wish it was easy.

    Yes the guide could use a re-write, but that's only because much of the info simply wasn't easily available then. Also, other discussion isn't as relevant to blu-ray compatibility today either as it was 4 years ago.

    However, even today several applications that promise "blu-ray compatibility" still only produce something that should play in a blu-ray player - only an X-factor. And even today I still warn folks that other factors (pulldown, GOPs, etc) are still problematic if not treated properly, and/or still viewed in a naïve sense. Some content here will stay intact a bit longer.

    You really do need every detail, otherwise it won't be blu-ray compatible. The standard was never straight-forward. This guide promises 100% compatibility. And "100%" tends to be finicky.

    Originally Posted by ct2193
    Is there a simple(r) answer than re-interpreting the manuscripts on my own?
    Just look at the command lines in Post #4. , and let's break it down a bit. (But am re-writing it as such, including ridding those "code-wrappers" that make the longer commandlines rather obscure.)

    1) To build your commandline, start with what's necessary. Below is what you input in all commandlines to ensure blu-ray compatibility:

    x264 --level 4.1 --crf 18 --bluray-compat --aud --nal-hrd vbr --vbv-maxrate 15000 --vbv-bufsize 15000 --b-pyramid strict --bframes 3 --ref 3 --weightp 0 --cabac --slices 4 --partitions p8x8,b8x8,i8x8,i4x4

    The above used CRF (18). Other encoding methods, such as 2-pass, are also fine within constraints.

    2) Then you can add "cosmetics", as noted. These are only suggestions that can be tweaked:

    --aq-mode 1 --aq-strength 1.0 --deblock -1:2 --tune film --preset medium --chroma-qp-offset -2 --b-adapt 2

    3) Then choose your profile. Suppose you want NTSC, 30/1001=29.97fps (30i-INTERLACED DISPLAY), Aspect Ratio 4:3 (Full-Screen), then add the following to your command-line:

    --keyint 60 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 10:11 --interlaced

    The above is the only thing that will change in the commandline. Just choose your profile and use that commandline fragment instead. They're all itemized in Post #4. Just copy and paste into your commandline.

    4) And I/O:

    --input Source.avi --output bdstream.264

    5) Put them all together:

    Full commandline for NTSC, 30/1001=29.97fps (30i-INTERLACED DISPLAY), Aspect Ratio 4:3 (Full-Screen) 100% blu-ray compatibility:

    x264 --level 4.1 --crf 18 --bluray-compat --aud --nal-hrd vbr --vbv-maxrate 15000 --vbv-bufsize 15000 --b-pyramid strict --bframes 3 --ref 3 --weightp 0 --cabac --slices 4 --partitions p8x8,b8x8,i8x8,i4x4 --aq-mode 1 --aq-strength 1.0 --deblock -1:2 --tune film --preset medium --chroma-qp-offset -2 --b-adapt 2 --keyint 60 --min-keyint 2 --open-gop bluray --colorprim "smpte170m" --transfer "smpte170m" --colormatrix "smpte170m" --sar 10:11 --interlaced --input Source.avi --output bdstream.264

    This, of course, is assuming your source/script has the proper attributes (resolution, fps, etc). The chart in Post #4 should help with that.

    Originally Posted by ct2193
    2) Is there an easy way to do SD widescreen, and automatically fill the screen without distorting the original aspect? And of course the extension to this... including stripping letterbox and making it widescreen when the original was fake widescreen (letterbox)?
    This is covered in Post #5, with the headings "Resolution", "Display Aspect Ratio (DAR)" and "Pixel Aspect Ratio (PAR)" and also demonstrated in an example in Post #7 with cropping black banding from native 16:9 displays trapped in 4:3.

    (But maybe should re-write them to emphasize their importance.)

    The problem here with blu-ray compatibility with H.264 is IMO a complete ignorance regarding PAR, making assumptions consistent with MPEG-4 Part 2 codecs of the early 2000s regarding certain displays.

    If your Source has true DvD PAR, you will have to accept an error margin to make it blu-ray compatible. You will either just accept the slightly (but not terribly noticeable) distortion from, say DAR=8:9 to DAR 10:11, or simply add 8 pixels (of black banding) to each of the left and right borders - no way around this.

    It can work in the real hardware at DAR 8:9 (LG's come to mind), but, again, this is an X-factor, and not theoretically 100% blu-ray compliant.

    Originally Posted by ct2193
    3) Scenario: I have full seasons of various shows on DVD. Most are typically 24 or fewer episodes. I only speak 1 language, though sometimes I don't hear so well. Eliminating foreign languages, both audio and subtitles is preferred. Keeping the subtitles NOT burned in are preferred. Where possible, I DO NOT want to compress the audio. If I can keep the original AC3 (or whatever format the original has) that would be great. And of course, the final version would be SD h264, often but not always widescreen.

    Summary:
    - Original, unedited subtitles, but eliminate foreign languages.
    - Original, unedited, audio, but eliminating foreign languages.
    As for audio - if it was authored in DvD, and worked in DvD, there's no reason why it shouldn't in BD without any re-encoding. However, Scenarist has rejected some fully compliant DvD audio streams. I read somewhere however that this may be a bug.

    Audio is briefly covered in Post #9 as a supplementary feature. At worst, a re-encode with Aften to A/52 AC-3 (Dolby Digital) guarantees blu-ray compatiblity - at least always with Scenarist.

    As per subtitles, this too is a completely separate topic, and a broad science. Again, the concern here was getting the video streams 100% compliant, and even without a complete deliverable authored solution this alone is a challenge.

    A starting point is covered in Post #9 with subtitles, just after Audio, again as a supplementary feature. Hopefully better info is available today elsewhere, as well as newer, and simpler, accompanying tools today 4 years later.

    Originally Posted by ct2193
    Convert video from DVD MPEG2 to good looking, blu-ray compliant video, hopefully as small of a file as possible to fit the entire season on a 25GB BDR.
    So many uses I have found for this guide, and this was one of them. Yes, the quality is fabulous and the size is always convenient.

    (Still keep the Source, but it's collecting dust.)

    Originally Posted by ct2193
    I can get 850MB-1.2GB Apple TV3 compliant h264, Profile 4.1, video that look amazing. (Using HandBrake) Everything I've tried with any other tools, including professional tools, usually push me to 2.5GB-5GB for the exact same video and it looks crappy.

    If anyone knows how to make HandBrake spit out Blu-ray compliant video directly that would address a ton of our older footage that only has Stereo audio and no subtitles.
    Very interesting you bring this up with a wonderful tool over the years like HandBrake.

    Unfortunately, the answer with HandBrake, at least until it accepts scripts and, especially, until it can output raw streams is, no, it can't produce 100% compatible blu-ray streams.

    As per the AviSynth scripts, you can get around that with middle solutions in your workflow, like lossless video.

    However, a raw stream is absolutely necessary. Post #8 discusses this limitation in the "MP4/MKV" section. Much of the blu-ray necessities are lost when going through a container like MP4 or MKV. Hence, anything you do with HandBrake, however legit, will be lost in the muxing to MP4/MKV. Scenarist will not accept the streams, even if de-muxed to raw .avc - MUI Generator will fail beforehand.

    But, if you really want something that may work in BD from HandBrake, and I only say may, you can try the following, with absolutely no guarantee, but the closest you will get to blu-ray compatibility as of version 0.9.9.5530.

    Assuming your source is in the right spec according to the chart in Post #4, or a lossless conversion of your script is, then try the following.

    In the "Picture" tab, choose none for anamorphic, and no cropping.

    In the "Filters" tab be careful with, for example, "Detelecine" if it changes your framerate. This could be done in your Source actually.

    In the "Video" tab choose your codec, "Constant Framerate", and your "Quality" settings, but enable "Use Advanced Tab instead".

    In the "Advanced" tab, using our example from before, and exact same commandline, just copy and paste it into the "x264 Encoder Options:", which should override all click options above.

    But with the following modifications:

    Omit the following (unnecessary within the context of the GUI)

    x264 --crf 18--input Source.avi --output bdstream.264

    And convert to the classic Mencoder format (equal signs and colons) for HandBrake to recognize it. Just copy and paste the following into "x264 Encoder Options:".

    Code:
    level=4.1:bluray-compat:aud:nal-hrd:vbr:vbv-maxrate=15000:vbv-bufsize=15000:b-pyramid=strict:bframes=3:ref=3:weightp=0:cabac:slices=4:partitions=p8x8,b8x8,i8x8,i4x4:aq-mode=1:aq-strength=1.0:deblock=-1,2:tune=film:preset=medium:chroma-qp-offset=-2:b-adapt=2:keyint=60:min-keyint=2:open-gop bluray:colorprim="smpte170m":transfer="smpte170m":colormatrix="smpte170m":sar=10:11:interlaced
    (I had to use a wrapper above to avoid the icons generated with the colons.)

    Audio in HandBrake is moot, even using passthrough, since you'll have to de-mux the above yield from HandBrake (or convert anyway if not compliant) and re-mux both A/V into an M2TS container, or blu-ray structure. It should work, but won't be 100% blu-ray compliant in theory.

    Hope it helps. At any rate, I will be re-writing this guide over the next couple of weeks.

    Thanks to the kind words above, and from the emails as well.

    Check back anytime.
    I hate VHS. I always did.
    Quote Quote  
  14. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Simply put, Blu-ray SD is best left as MPEG.

    The big reason? Interlacing. H.264 handles it poorly.

    You seem to already know this. And I'm betting that many others already know this, and is why the post isn't getting much attention.

    I'm sure you mean well, but this is one of those video truths that's hard to fight. It reminds me too much of xVCD/kVCD, and attempts to squeeze more content on a disc. You make sacrifices.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  15. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    Hey LS, good to see you here.

    Originally Posted by lordsmurf
    Simply put, Blu-ray SD is best left as MPEG.
    Still loving MPEG-2 here, and if “it fits”, yes, use it. I did recommend it too. H.264 SD on blu-ray is much more arduous, but it too does work, and does that extra packing.

    Originally Posted by lordsmurf
    The big reason? Interlacing. H.264 handles it poorly.
    Agreed that x264 could be more efficient here. The interlaced compression advantage over MPEG-2 isn’t great, and diminishes further with higher bitrates.

    But it does work well regardless. The H.264 standard fully supports MBAFF/PAFF, and quality variance is at the implementation stage. x264 uses MBAFF only. If you really need PAFF in H.264, you can use MainConcept. However MBAFF is more efficient anyway, and really all you'd need for most, if not all, source.

    (Note: H.264's successor, "H.265"/HEVC, dropped interlacing entirely - so forget it for UHDBD, or whatever they will call it...)

    Originally Posted by lordsmurf
    You seem to already know this. And I'm betting that many others already know this,
    Pre-2010, I’d too be in the “x264 handles interlacing poorly” camp, but have you tried interlaced encoding with x264 lately, or have you long given up on it? It’s actually improved, and quite good now producing better compression. Like MPEG-2 - no need to deinterlace on blu-ray with x264.

    The red flags I was waving here though weren’t really about interlacing in general, just to have care with it in muxing, or if deinterlacing or applying pulldown to add appropriate commands like --pulldown 32, --interlaced, etc, and/or for when migrating to different containers or decoding schemes. But even MPEG-2 needs to “fool” DvD/BD with a form of "fake interlaced", and again "fool" players for 3:2 pulldown to 23.976fps for the sake of efficiency in content that is "visually progressive".

    Originally Posted by lordsmurf
    and is why the post isn't getting much attention.
    My concern was if this would breed a similar flamewar to H.264 VFW in AVI. (And did get a go-ahead from a Mod too.)

    I’m not selling H.264 SD on blu-ray in any way - fully aware it's niche, and felt its "politics" previously. It's clear here as an option, but one that works advantageously with H.264 when applied properly.

    But regarless of MPEG-2, H.264 or VC-1, many also never knew SD even existed on blu-ray - even amongst the most knowledgeable - which included you, which leaves me with little to be surprised with here.

    Originally Posted by lordsmurf
    I'm sure you mean well,
    I appreciate that. I do hope it’s helped some folks.

    But, as an example: 10 seasons of a TV show on one BD disc? How cool is that? H.264 makes it more possible.

    And it’s even cooler when lending it to a friend – none of that passenger support: “install/download/only plays with this/that”, and codecs, drivers, firmware, versions, models, …., etc, etc, etc.

    Isn’t it better to just say, “pop it in your player”? There’s millions of blu-ray players out there, almost in every home now.

    Like I said, this option is not for everybody, but this would be cool for some who share this passion.

    Originally Posted by lordsmurf
    but this is one of those video truths that's hard to fight.
    I’ll agree – fully - that encoding to H.264 to the blu-ray spec is certainly NOT the best H.264 encode, and never said BD should be its flagship playback option.

    My promise was to deliver a method to encode SD H.264 video streams to verified 100% blu-ray compliancy – and I certainly did this, along with its audio, for those wishing to have this option. And it works well, and still has a net compression advantage over MPEG-2 in the end, on the same platform.

    Originally Posted by lordsmurf
    It reminds me too much of xVCD/kVCD, and attempts to squeeze more content on a disc. You make sacrifices.
    Oh yes, you sacrifice to squeeze here, and I won’t sugar-coat it. However, only at the cost of effort mostly, not quality/compression.

    But, to be fair, I will indeed get around to include a sort of “vent/warning section” highlighting some of the problems of H.264 SD on blu-ray: complexity, PAR error, high overhead of M2TS, and the fact that once you encode to H.264 blu-ray, you would need another encode for other playback options since the "blu-ray elements" can be problematic elsewhere.

    But I honestly wouldn't have bothered if there was no advantage to using SD H.264 on blu-ray.
    Last edited by PuzZLeR; 19th Oct 2015 at 17:22.
    I hate VHS. I always did.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!