VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Good afternoon,

    I'm trying to make an uncut BD with a scene from the uncensored DVD. All my attaments to create a compatible MKV from the cut scene have failed so far. Here are my steps:
    • Losslessly convert M2TS from the BD to MKV with ffmpeg
    • Slice the MKV in two parts with Avidemux (the parts before and after the cut), I name it P_01.mkv and P_03.mkv
    • Make MKV from the DVD with Avidemux, I name it P_02.mkv
    • Add P_01.mkv to MKVToolNix and append P_02.mkv + P_03.mkv

    That doesn't work, I always get the warning:

    The track number 0 from the file 'P_02.mkv' can probably not be appended correctly to the track number 0 from the file 'P_01.mkv': The codec's private data does not match (lengths: 39 and 191). Please make sure that the resulting file plays correctly the whole time. The author of this program will probably not give support for playback issues with the resulting file.
    Here's MediaInfo from P_01.mkv:

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L4.1
    Format settings : CABAC / 2 Ref Frames
    Format settings, CABAC : Yes
    Format settings, RefFrames : 2 frames
    Format settings, GOP : M=1, N=10
    Codec ID : V_MPEG4/ISO/AVC
    Duration : 50 min 20 s
    Bit rate mode : Variable
    Bit rate : 23.6 Mb/s
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 23.976 (24000/1001) FPS
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.475
    Stream size : 8.31 GiB (95%)
    Default : No
    Forced : No
    And here from P_02.mkv:

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : Baseline@L4.1
    Format settings : 2 Ref Frames
    Format settings, CABAC : No
    Format settings, RefFrames : 2 frames
    Codec ID : V_MPEG4/ISO/AVC
    Duration : 18 s 561 ms
    Bit rate : 23.6 Mb/s
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 23.976 (24000/1001) FPS
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.475
    Stream size : 50.4 MiB (94%)
    Writing library : x264 core 152 r2854 e9a5903
    Encoding settings : cabac=0 / ref=2 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=2pass / mbtree=1 / bitrate=23600 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
    Default : Yes
    Forced : No
    Any suggestions how to set up Avidemux to make this work?
    The result in this example was done with the preset "fast". I also tried individual settings with CABAC on and max. Ref. frames = 2, but this always resulted in Ref. frames > 2.

    Thanks,
    SH
    "The age-old success of the ideologists of the State is perhaps the most
    gigantic hoax in the history of mankind" --- Murray N. Rothbard
    Quote Quote  
  2. 1. Matching settings 100% can be very difficult if not impossible because the encoder for the Blu-Ray is likely not x264. Either way MediaInfo is not sufficient to 100% compare H.264 headers. You need an H.264 analyzer for that ...
    2. The warning from mkvmerge isn't necessarily fatal. It's only saying the lengths of the headers are different but it is sufficient for the core parts to be compatible.


    Try something like:
    Code:
    x264 [INPUT] -o "P_02.264" --fps 24000/1001 --preset medium --level 4.1 --crf 16 --bluray-compat --b-pyramid none --ref 2 --vbv-maxrate 40000 --vbv-bufsize 30000 --keyint 24 --slices 4 --sar 1:1 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --stitchable
    1. Make sure output is to ".264". Then x264 will put SPS/PPS to every keyframe. (This should already be the case for the Blu-Ray copy assuming ffmpeg and AviDemux didn't mangle it too much.)
    2. Mux:
    Code:
    mkvmerge -o "P_02.mkv" "P_02.264"    (+audio/subs ...)
    3. Append:
    Code:
    mkvmerge -o "output.mkv" "P_01.mkv" +"P_02.mkv"
    (ignore warning about private header)
    (Step 2 and 3 might be combinable but I don't know your complete case so I'm gonna leave it at this ...)


    This kinda relies on storing SPS/PPS "in-band". It's not as ideal as having identical headers for both parts but often this is good enough esp. if we don't have access to the Blu-Ray encoding software.
    Last edited by sneaker; 3rd Feb 2019 at 12:27.
    Quote Quote  
  3. Hi sneaker,

    in the first step, should [INPUT] be the DVD scene? Isn't the syntax "x264 [options] -o outfile infile", i.e. the input file at the end? And shouldn't I add "--vf resize:1920,1080" to the options (if input is the DVD)?
    "The age-old success of the ideologists of the State is perhaps the most
    gigantic hoax in the history of mankind" --- Murray N. Rothbard
    Quote Quote  
  4. Originally Posted by Sheriff Hobbes View Post
    in the first step, should [INPUT] be the DVD scene? Isn't the syntax "x264 [options] -o outfile infile", i.e. the input file at the end?
    The order of the parameters doesn't make any difference (for the most part).

    Originally Posted by Sheriff Hobbes View Post
    And shouldn't I add "--vf resize:1920,1080" to the options (if input is the DVD)?
    If you want x264cli to do the upscaling: yes. I just assumed you were using something like AviSynth ...
    Quote Quote  
  5. Thanks, I'm one step further now! The mkvtoolnix still gives the warning, but instead of a white screen, the cut scene is now displayed!
    However, the x264 command only encodes the video stream. What further option do I need to include the first audio track?
    "The age-old success of the ideologists of the State is perhaps the most
    gigantic hoax in the history of mankind" --- Murray N. Rothbard
    Quote Quote  
  6. I still don't know about your source formats so it's difficult for me to answer. Basically, you need the same audio format just like you need the same video format. If that's already the case and your file is e.g. "DVD_SOURCE.MKV" then change Step 2 to:
    Code:
    mkvmerge -o "P_02.mkv" "P_02.264" --no-video --no-subtitles "DVD_SOURCE.MKV"
    Again: you might need to adapt this. I don't know about your specifics.
    Quote Quote  
  7. The DVD has two DD 5.1 tracks (English + Spanish), I only need the English track. Sample rate is 384 kb/s, that needs to be changed to 640 kb/s to match the BD.
    I need to do that in step 1, because that's the step where the audio got lost. I can see in MediaInfo that P_02.264 has no audio.
    "The age-old success of the ideologists of the State is perhaps the most
    gigantic hoax in the history of mankind" --- Murray N. Rothbard
    Quote Quote  
  8. Then before Step 2:
    Code:
    ffmpeg -i "DVD_SOURCE.MKV" -map 0:a:0 -c:a ac3 -b:a 640k "dvd_audio_eng.ac3"
    Step 2 (well, 3, now ...):
    Code:
    mkvmerge -o "P_02.mkv" "P_02.264" "dvd_audio_eng.ac3"
    Test sync. If needed, adapt using --sync parameter.
    Quote Quote  
  9. Thank you so much, sneaker. I have the full movie now the way I want.
    Everything, except for the short scene from the DVD, is lossless now.
    I did this project before with TMPGEnc Video Mastering Works, but though all quality settings were set to max., the result was poor.
    Only one stept left: Burn it to BD with multiAVCHD and run it on hardware, but there shouldn't be any problems.
    "The age-old success of the ideologists of the State is perhaps the most
    gigantic hoax in the history of mankind" --- Murray N. Rothbard
    Quote Quote  
  10. Damn, the last step was not successful!
    The MKV played perfectly in VLC Media Player. But in the M2TS that was created by multiAVCHD, the converted DVD part is displayed distorted, it's shrunk horizontally, displaying black borders to the left and right. What additional filtering option to the x264 command do I need?
    "The age-old success of the ideologists of the State is perhaps the most
    gigantic hoax in the history of mankind" --- Murray N. Rothbard
    Quote Quote  
  11. Try --vf resize:1920,1080,1:1

    Show x264 log and MediaInfo of P_02.mkv
    Quote Quote  
  12. Yes, that fixed the aspect problem. However, the M2TS result is still not usuable. When the film reaches the DVD snippet, it turns in some kind of slow motion, leaving the audio behind. I'm giving up on this.
    "The age-old success of the ideologists of the State is perhaps the most
    gigantic hoax in the history of mankind" --- Murray N. Rothbard
    Quote Quote  



Similar Threads

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