VideoHelp Forum
+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. The track number 0 from the file '2.mp4' can probably not be appended correctly to the track number 0 from the file '1.mp4': The codec's private data does not match (lengths: 44 and 44). 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.
    I'm getting the same error regarding appending file 2 to file 3, and then the rest of them are fine.

    MediaInfo seems the same:
    Code:
    General
    Complete name                            : 1.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media / Version 2
    Codec ID                                 : mp42 (mp42/mp41/isom/avc1)
    File size                                : 47.2 MiB
    Duration                                 : 2 min 32 s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 2 592 kb/s
    Encoded date                             : UTC 2013-04-23 02:26:50
    Tagged date                              : UTC 2013-04-23 02:26:50
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 2 min 32 s
    Bit rate                                 : 2 426 kb/s
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 29.970 (29970/1000) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.088
    Stream size                              : 44.2 MiB (94%)
    Writing library                          : x264 core 129 r2245 bc13772
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=90 / keyint_min=30 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=2426 / ratetol=1.0 / qcomp=0.60 / qpmin=5 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=3750 / vbv_bufsize=12500 / nal_hrd=none / ip_ratio=1.40 / aq=1:1.00
    Encoded date                             : UTC 2013-04-23 02:26:50
    Tagged date                              : UTC 2013-04-23 02:26:50
    
    Audio
    ID                                       : 2
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format profile                           : LC
    Codec ID                                 : 40
    Duration                                 : 2 min 32 s
    Source duration                          : 2 min 32 s
    Bit rate mode                            : Variable
    Bit rate                                 : 158 kb/s
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Code:
    General
    Complete name                            : 2.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media / Version 2
    Codec ID                                 : mp42 (mp42/mp41/isom/avc1)
    File size                                : 204 MiB
    Duration                                 : 10 min 58 s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 2 599 kb/s
    Encoded date                             : UTC 2013-04-23 13:14:45
    Tagged date                              : UTC 2013-04-23 13:14:45
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 10 min 58 s
    Bit rate                                 : 2 437 kb/s
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 29.970 (29970/1000) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.088
    Stream size                              : 191 MiB (94%)
    Writing library                          : x264 core 129 r2245 bc13772
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=90 / keyint_min=30 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=2437 / ratetol=1.0 / qcomp=0.60 / qpmin=5 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=3750 / vbv_bufsize=12500 / nal_hrd=none / ip_ratio=1.40 / aq=1:1.00
    Encoded date                             : UTC 2013-04-23 13:14:45
    Tagged date                              : UTC 2013-04-23 13:14:45
    
    Audio
    ID                                       : 2
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format profile                           : LC
    Codec ID                                 : 40
    Duration                                 : 10 min 58 s
    Source duration                          : 10 min 58 s
    Bit rate mode                            : Variable
    Bit rate                                 : 158 kb/s
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 44.1 kHz
    Frame rate                               : 43.066 FPS (1024 spf)
    Compression mode                         : Lossy
    Stream size                              : 12.4 MiB (6%)
    Source stream size                       : 12.4 MiB (6%)
    Encoded date                             : UTC 2013-04-23 13:14:45
    Tagged date                              : UTC 2013-04-23 13:14:45
    And even the non-matching numbers are identical. It creates the file but it won't play back properly, as implied.

    Is there anything I can do to get file 2 to match the rest? Just trying to combine about ten shorter videos, with chapter markers in between.
    Quote Quote  
  2. Originally Posted by koberulz View Post
    Is there anything I can do to get file 2 to match the rest?
    Re-encode to make it match the first. MediaInfo doesn't show detailed info about H.264 headers (PPS/SPS). You'd need a more in-depth H.264 analyzer like e.g. Zond. Maybe x264's header optimization resulted in different headers (--stitchable option didn't exist yet in revision 2245).

    Workaround can be to spread SPS/PPS to every keyframe. Try ffmpeg's concat demuxer instead of mkvmerge for appending (there are more options, e.g. run dump_extra filter filter on all source files individually, then append while ignoring mkvmerge warning).
    Quote Quote  
  3. What's Zond and where do I find it? Googling turns up nothing video-related.

    I tried the concat demuxer and had the same playback issues as with the mkvmerge version.
    Quote Quote  
  4. Then try dump_extra.
    Quote Quote  
  5. So I have to run that command on all of them, then the concat command? Is there a way to batch them, I have ten files here.
    Quote Quote  
  6. I would test with two files first. Then if you are successful try batching.

    Code:
    md "work_folder"
    for %%a in (*.mp4) do ffmpeg -y -i "%%~a" -map 0 -c copy -bsf:v "h264_mp4toannexb,dump_extra=freq=k" "work_folder\%%~a"
    (for %%b in (*.mp4) do @echo file '%%~b') > "work_folder\filelist.txt"
    pushd "work_folder"
    ffmpeg -y -f concat -safe 0 -i "filelist.txt" -c copy "..\output.mp4"

    /edit:
    FWIW: I see it's mp4 and not mkv. IIRC mp4 even "officially" allows multiple PPS/SSP and has a way to store them though I don't know which muxer/how. It's probably not needed to make it work but ...
    Last edited by sneaker; 27th May 2019 at 16:06.
    Quote Quote  
  7. The following is just some extra info. It's not required to solve the problem but can help find out why there are such problems with certain combinations of input files when appending.


    Originally Posted by sneaker View Post
    Originally Posted by koberulz View Post
    Is there anything I can do to get file 2 to match the rest?
    Re-encode to make it match the first. MediaInfo doesn't show detailed info about H.264 headers (PPS/SPS). You'd need a more in-depth H.264 analyzer like e.g. Zond. Maybe x264's header optimization resulted in different headers (--stitchable option didn't exist yet in revision 2245).
    Originally Posted by koberulz View Post
    What's Zond and where do I find it? Googling turns up nothing video-related.
    Zond 265 demo/info can be found here.

    But actually ffmpeg also has some features to print SPS/PPS: trace_headers bsf.
    Code:
    ffmpeg -y -i "INPUT" -map 0:v -c copy -frames:v 1 -bsf:v trace_headers -f matroska NUL 2> headers.txt
    Then in headers.txt you can find the H.264 header values.
    With x264's header optimization "pic_init_qp_minus26" can differ even with the very same command-line. This can cause decoding problems when appending. You can search for it directly:
    Code:
    ffmpeg -y -i "INPUT" -map 0:v -c copy -frames:v 1 -bsf:v trace_headers -f matroska NUL 2>&1 | findstr "pic_init_qp_minus26"
    MediaInfo does not display this so it is difficult to find.


    When encoding with x264 header optimization can be turned off via --stitchable.
    Quote Quote  
  8. The dump_extra batch file seems to have fixed the issue. I still get a warning but the file plays back just fine.
    Quote Quote  
  9. I just realized there is no reason to put this into separate ffmpeg calls. So a short batch would be simply:
    Code:
    (for %%a in (*.mp4) do @echo file '%%a') > "filelist.txt"
    ffmpeg -y -f concat -i "filelist.txt" -map 0 -c copy -bsf:v "h264_mp4toannexb,dump_extra=freq=k" "output.mp4"
    Quote Quote  
  10. Creating the work folder with the individual parts allows me to go back to MKVtoolnixGUI and append them with chapter markers, though. The single output.mp4 file your command creates has no chapters.
    Quote Quote  
  11. All roads lead to Rome.
    Quote Quote  
  12. Member
    Join Date
    Apr 2018
    Location
    Croatia
    Search Comp PM
    You always can create chapters with ffmpeg ffmetadata demuxer/muxer and some text editing.
    Quote Quote  
  13. Member
    Join Date
    Sep 2010
    Location
    Australia
    Search PM
    sneaker @9, that batch file to merge mp4 files is very useful - thank you!

    Is there any chance you could adapt it to merge MKV files? (Just changing mp4 to mkv throughout doesn't work.
    (Error parsing bitstream filter sequence 'h264_mkvtoannexb, dump_extra=freq=k': Bitstream filter not found.)
    Quote Quote  
  14. Member
    Join Date
    Sep 2010
    Location
    Australia
    Search PM
    Oops, the modification is easy.

    Code:
    (for %%a in (*.mkv) do @echo file '%%a') > "filelist.txt"
    ffmpeg -y -f concat -i "filelist.txt" -map 0 -c copy -bsf:v "h264_mp4toannexb,dump_extra=freq=k" "output.mkv"
    The filenames must have no spaces and no special characters.
    Quote Quote  



Similar Threads

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