gbballpack/MKVToolNix-missing-ctts-atom-repair

Drops any additional audio streams in final merge MP4

Opened this issue · 0 comments

Heya! Found your lovely script(s) to fix a lot of my issues from older files. Thank you.

WARNING: Do not run any of these scripts on any multi-audio files. You will strip out any additional streams of audio in the final output MP4.

Input #0, matroska,webm, from 'Movie (Year)/Movie.mkv':
  Metadata:
    encoder         : libebml v1.4.2 + libmatroska v1.6.4
    creation_time   : 2022-09-05T01:17:12.000000Z
  Duration: 01:49:19.76, start: 0.000000, bitrate: 2450 kb/s
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv), 1920x1036 [SAR 1:1 DAR 480:259], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      BPS             : 2000601
      DURATION        : 01:49:19.720000000
      NUMBER_OF_FRAMES: 157276
      NUMBER_OF_BYTES : 1640423128
      _STATISTICS_WRITING_APP: mkvmerge v70.0.0 ('Caught A Lite Sneeze') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2022-09-05 01:17:12
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(chi): Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
    Metadata:
      BPS             : 224000
      DURATION        : 01:49:02.677000000
      NUMBER_OF_FRAMES: 306688
      NUMBER_OF_BYTES : 183194966
      _STATISTICS_WRITING_APP: mkvmerge v70.0.0 ('Caught A Lite Sneeze') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2022-09-05 01:17:12
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:2(eng): Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
    Metadata:
      BPS             : 224000
      DURATION        : 01:49:18.570000000
      NUMBER_OF_FRAMES: 307433
      NUMBER_OF_BYTES : 183639979
      _STATISTICS_WRITING_APP: mkvmerge v70.0.0 ('Caught A Lite Sneeze') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2022-09-05 01:17:12
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Output #0, mp4, to 'Movie (Year)/Movie.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv), 1920x1036 [SAR 1:1 DAR 480:259], q=2-31, 23.98 fps, 23.98 tbr, 16k tbn, 1k tbc (default)
    Metadata:
      BPS             : 2000601
      DURATION        : 01:49:19.720000000
      NUMBER_OF_FRAMES: 157276
      NUMBER_OF_BYTES : 1640423128
      _STATISTICS_WRITING_APP: mkvmerge v70.0.0 ('Caught A Lite Sneeze') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2022-09-05 01:17:12
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(chi): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp (default)
    Metadata:
      BPS             : 224000
      DURATION        : 01:49:02.677000000
      NUMBER_OF_FRAMES: 306688
      NUMBER_OF_BYTES : 183194966
      _STATISTICS_WRITING_APP: mkvmerge v70.0.0 ('Caught A Lite Sneeze') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2022-09-05 01:17:12
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)

Seems omitting -map 0 in the end ffmpeg script command: ffmpeg -i "$i" -y -flags +global_header -movflags faststart -c:v copy -c:a copy "${i%.mkv}.mp4"; gives only one video stream and one audio stream.

Adding -map 0 properly preserves additional streams:

Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)

Unfortunately, I found out after running this script and have to fix a bunch of my files now. Sadfacey.

Is there any adverse effect to putting -map 0 into the final MP4 conversion line? Just want to make sure I'm not fixing one issue and introducing another.