VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. Member
    Join Date
    Sep 2021
    Location
    Prince Albert
    Search Comp PM
    I am trying to join two video files together with MKV Toolnix.

    Here are the mediainfo files for the first and second parts


    1st part:

    General
    Unique ID : 268522462753766216628893327053354145976 (0xCA038B90A44BE5C9575671F4F1BB98B8)
    Complete name : xxxxxxxxxxxxxxxxxxx.mkv
    Format : Matroska
    Format version : Version 4
    File size : 1.45 GiB
    Duration : 12 min 22 s
    Overall bit rate : 16.8 Mb/s
    Encoded date : UTC 2021-09-09 03:45:08
    Writing application : mkvmerge v60.0.0 ('Are We Copies?') 64-bit
    Writing library : libebml v1.4.2 + libmatroska v1.6.4

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L4.1
    Format settings : CABAC / 4 Ref Frames
    Format settings, CABAC : Yes
    Format settings, Reference frames : 4 frames
    Codec ID : V_MPEG4/ISO/AVC
    Duration : 12 min 22 s
    Bit rate : 16.5 Mb/s
    Width : 1 920 pixels
    Height : 1 064 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 59.940 (60000/1001) FPS
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.135
    Stream size : 1.43 GiB (99%)
    Writing library : x264 core 161 r3027 4121277
    Encoding settings : cabac=1 / ref=4 / deblock=1:-3:-3 / analyse=0x3:0x133 / me=umh / subme=11 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=48 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=24 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=0 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=150 / rc=crf / mbtree=0 / crf=20.0 / qcomp=0.70 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=62500 / vbv_bufsize=78125 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.30 / pb_ratio=1.20 / aq=1:0.80
    Language : English
    Default : Yes
    Forced : No

    Audio
    ID : 2
    Format : AAC LC
    Format/Info : Advanced Audio Codec Low Complexity
    Codec ID : A_AAC-2
    Duration : 12 min 22 s
    Bit rate : 221 kb/s
    Channel(s) : 2 channels
    Channel layout : L R
    Sampling rate : 48.0 kHz
    Frame rate : 46.875 FPS (1024 SPF)
    Compression mode : Lossy
    Stream size : 19.6 MiB (1%)
    Default : Yes
    Forced : No

    2nd part:

    General
    Unique ID : 296390059574882479876311870158615375396 (0xDEFAA62B1DB3A7B04C92543BBDE06E24)
    Complete name : xxxxxxxxxxxxxxxxxxx.mkv
    Format : Matroska
    Format version : Version 4
    File size : 13.2 GiB
    Duration : 2 h 11 min
    Overall bit rate : 14.4 Mb/s
    Encoded date : UTC 2021-09-10 16:13:02
    Writing application : mkvmerge v60.0.0 ('Are We Copies?') 64-bit
    Writing library : libebml v1.4.2 + libmatroska v1.6.4

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L4.1
    Format settings : CABAC / 4 Ref Frames
    Format settings, CABAC : Yes
    Format settings, Reference frames : 4 frames
    Codec ID : V_MPEG4/ISO/AVC
    Duration : 2 h 11 min
    Bit rate : 14.2 Mb/s
    Width : 1 920 pixels
    Height : 1 064 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 59.940 (60000/1001) FPS
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.116
    Stream size : 13.0 GiB (98%)
    Writing library : x264 core 161 r3027 4121277
    Encoding settings : cabac=1 / ref=4 / deblock=1:-3:-3 / analyse=0x3:0x133 / me=umh / subme=11 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=48 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=24 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=0 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=150 / rc=crf / mbtree=0 / crf=19.6 / qcomp=0.70 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=62500 / vbv_bufsize=78125 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.30 / pb_ratio=1.20 / aq=1:0.80
    Language : English
    Default : Yes
    Forced : No

    Audio
    ID : 2
    Format : AAC LC
    Format/Info : Advanced Audio Codec Low Complexity
    Codec ID : A_AAC-2
    Duration : 2 h 11 min
    Bit rate : 221 kb/s
    Channel(s) : 2 channels
    Channel layout : L R
    Sampling rate : 48.0 kHz
    Frame rate : 46.875 FPS (1024 SPF)
    Compression mode : Lossy
    Stream size : 208 MiB (2%)
    Default : Yes
    Forced : No


    I load the first file into MKVtoolnix then right click and append the 2nd one. When I playback the resulting file it works perfectly up until the join point. After the join point the audio is fine, but the video is just a bunch of squigly lines and blurry mess. I've tried just muxing the video first. I've tried each part individually. It seems no matter how I do it it ends up the same. Not sure what I'm doing wrong.
    Quote Quote  
  2. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    My suggestion: extract the video streams in their "raw" format (.264), concatenate them with the old copy /b

    copy /b video1.264 + video2.264 videofull.264
    ,

    and then remux with ffmpeg.

    Reasoning: some multiplexers are not so smart as they should be. ==> https://mailman.videolan.org/pipermail/x264-devel/2013-July/010167.html
    "Programmers are human-shaped machines that transform alcohol into bugs."
    Quote Quote  
  3. I'm a Super Moderator johns0's Avatar
    Join Date
    Jun 2002
    Location
    canada
    Search Comp PM
    Try remuxing the 2 video by itself to see if there's any issues with it.
    I think,therefore i am a hamster.
    Quote Quote  
  4. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    A second thing to try is Avidemux, open the first, append the second
    Quote Quote  
  5. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    Try this.
    Drag and drop both videos onto this batch file.
    This will sort out problems wit B frames and open GOPS. (I hope)
    Then try MKVtoolnixGUI with the newly created files.


    mkvmerge DROP v10.cmd
    Code:
    @echo off
    :loop
    "C:\Program Files\MKVToolNix\mkvmerge.exe" --ui-language en --output "%~n1-New.mkv" --no-subtitles --language 0:eng --language 1:eng "%~1" --track-order 0:0,0:1 --probe-range-percentage 0.50
    shift
    if not %1=="" goto :loop

    Cheers.
    Last edited by pcspeak; 14th Sep 2021 at 17:01.
    Quote Quote  
  6. The copy /B method suggested above seems rather crude to me, and if it works at all it's bound to cause synchronization issues.

    Another thing to try is using ffmpeg with a temporary conversion to TS (transport stream). I'll copy what I already posted there earlier today.

    Some years ago I struggled to find a method that would losslessly join three or four MP4 / H.264 videos with no synchronization issue. The only one that worked flawlessly was ffmpeg with a temporary TS remuxing.

    Code:
    ffmpeg -i "input1.mp4" -c copy -bsf h264_mp4toannexb "temp1.ts"
    ffmpeg -i "input2.mp4" -c copy -bsf h264_mp4toannexb "temp2.ts"
    ffmpeg -i "input3.mp4" -c copy -bsf h264_mp4toannexb "temp3.ts"
    ffmpeg -i "concat:temp1.ts|temp2.ts|temp3.ts" -c copy -absf aac_adtstoasc "output.mp4"
    Disclaimer : I merely copied the content of the .bat file I used back then, with an older version of ffmpeg, I'm not sure what the "-bsf h264_mp4toannexb" and "-absf aac_adtstoasc" options were for, or if they were actually necessary, or if they still exist with recent versions. Someone may chime in to elaborate on this.
    Quote Quote  



Similar Threads

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