[FFmpeg-trac] #11030(undetermined:new): Remuxing a damaged MP4 increases file size noticeably

FFmpeg trac at avcodec.org
Sat May 25 05:51:47 EEST 2024


#11030: Remuxing a damaged MP4 increases file size noticeably
-------------------------------------+-------------------------------------
             Reporter:  PumaD        |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Got a slightly damaged 1.9 GiB MP4 file. When remuxing with ffmpeg the
 resulting file is a whole 224 MiB larger than before (from 1.9 GiB to 2.2
 GiB).

 Remuxing the file with mkvtoolnix instead reduces the file size
 marginally.
 (​​https://gitlab.com/mbunkus/mkvtoolnix; `mkvmerge --output out.mkv
 slightly-damaged-audio-stops-at-00-43-05.mp4`)

 The effect on the sample below is a much more modest increase of ~30 MiB,
 but it does illustrate the problem.

 Sample (from #11028):
 ​https://streams.videolan.org/ffmpeg/incoming/11028/slightly-damaged-
 audio-stops-at-00-43-05.mp4 (~ 1 GiB)

 Note: NSFW

 How to reproduce:
 {{{
 $ ffmpeg -i slightly-damaged-audio-stops-at-00-43-05.mp4 -c copy out.mkv
 ffmpeg version N-115363-g3146b77a7d Copyright (c) 2000-2024 the FFmpeg
 developers
   built with gcc 14.1.1 (GCC) 20240507
   configuration:
   libavutil      59. 19.100 / 59. 19.100
   libavcodec     61.  5.104 / 61.  5.104
   libavformat    61.  3.103 / 61.  3.103
   libavdevice    61.  2.100 / 61.  2.100
   libavfilter    10.  2.102 / 10.  2.102
   libswscale      8.  2.100 /  8.  2.100
   libswresample   5.  2.100 /  5.  2.100
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x624f2ebf8840] Sample size 3043950162 is too
 large
 [h264 @ 0x624f2ebf9800] concealing 1691 DC, 1691 AC, 1691 MV errors in I
 frame
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'slightly-damaged-audio-stops-
 at-00-43-05.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf57.62.100
   Duration: 01:28:36.03, start: 0.000000, bitrate: 1577 kb/s
   Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661),
 yuv420p(progressive), 960x720 [SAR 1:1 DAR 4:3], 3028 kb/s, 29.93 fps, 30
 tbr, 90k tbn (default)
       Metadata:
         handler_name    : VideoHandler
         vendor_id       : [0][0][0][0]
   Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
 stereo, fltp, 93 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         vendor_id       : [0][0][0][0]
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
 Output #0, matroska, to 'out.mkv':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf61.3.103
   Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661),
 yuv420p(progressive), 960x720 [SAR 1:1 DAR 4:3], q=2-31, 3028 kb/s, 29.93
 fps, 30 tbr, 1k tbn (default)
       Metadata:
         handler_name    : VideoHandler
         vendor_id       : [0][0][0][0]
   Stream #0:1(und): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz,
 stereo, fltp, 93 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         vendor_id       : [0][0][0][0]
 Press [q] to stop, [?] for help
 [h264 @ 0x624f2ef99e00] Invalid NAL unit size (-720787532 > 47705).
 [h264 @ 0x624f2ef99e00] missing picture in access unit with size 47709
 [h264 @ 0x624f2ef99e00] Invalid NAL unit size (1049218 > 11473).31e+03x
 [h264 @ 0x624f2ef99e00] missing picture in access unit with size 11477
 [h264 @ 0x624f2ef99e00] Invalid NAL unit size (722808771 > 10603).
 [h264 @ 0x624f2ef99e00] missing picture in access unit with size 10607
 [h264 @ 0x624f2ef99e00] Invalid NAL unit size (526767940 > 14657).+03x
 [h264 @ 0x624f2ef99e00] missing picture in access unit with size 14661
 [h264 @ 0x624f2ef99e00] Invalid NAL unit size (1063190835 > 51).
 [h264 @ 0x624f2ef99e00] missing picture in access unit with size 6615
 Truncating packet of size 268435713 to 355012330kbits/s speed=1.48e+03x
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x624f2ebf8840] Packet corrupt (stream = 1, dts
 = 113707010).
 [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x624f2ebf8580] corrupt input packet in
 stream 1
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x624f2ebf8840] Packet corrupt (stream = 0, dts
 = 240368850).
 [h264 @ 0x624f2ef99e00] Invalid NAL unit size (15412 > 629).
 [h264 @ 0x624f2ef99e00] missing picture in access unit with size 639
 [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x624f2ebf8580] corrupt input packet in
 stream 0
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x624f2ebf8840] stream 0, offset 0x3e803ab9:
 partial file
 [out#0/matroska @ 0x624f2ebfabc0] video:988025KiB audio:64471KiB
 subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead:
 0.138273%
 size= 1053952KiB time=00:44:30.79 bitrate=3232.7kbits/s speed=1.45e+03x
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11030>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list