Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#7150 closed defect (fixed)

MXF: audio length mismatch

Reported by: 2mmi Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mxf
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

Summary of the bug:

Some MP4 source-files will make an MXF file with uneven audio packets.
Only the video stream and the first audio track will have the correct lenght.

Maybe a premature flush ?

Here is an output from "mxfsplit -w testout.MXF":

Closing _0001_00000000, size 0x461f8
Closing _0001_15010500.mpg, size 0x196a163
Closing _0001_16040300.wav, size 0xb6ee2c
Closing _0001_16040301.wav, size 0xb6df2c
Closing _0001_16040302.wav, size 0xb6df2c
Closing _0001_16040303.wav, size 0xb6df2c

How to reproduce:

ffmpeg -i failinput.mp4 -filter_complex channelsplit=channel_layout=quad[1][2][3][4] -map 0:v -map [1] -map [2] -map [3] -map [4] testout.mxf

ffmpeg version: ffmpeg version N-90762-g223f3dff8c

FFmpeg console output with max debug info:

  • Here you can see there is only 2 packets in the last MXF element (3121).

There should be 1 video + 4 audio.

[mxf @ 000001dc8a9f16c0] out st:0 dts:3120
[out_0_0 @ 000001dc8e405200] EOF on sink link out_0_0:default.
[out_0_2 @ 000001dc8aa5b200] EOF on sink link out_0_2:default.
[out_0_4 @ 000001dc8ba9df00] EOF on sink link out_0_4:default.
[out_0_3 @ 000001dc8d1fea00] EOF on sink link out_0_3:default.
[out_0_1 @ 000001dc8b40eb00] EOF on sink link out_0_1:default.
No more output streams to write to, finishing.
[mxf @ 000001dc8a9f16c0] out st:1 dts:3120
[mxf @ 000001dc8a9f16c0] out st:2 dts:3120
[mxf @ 000001dc8a9f16c0] out st:3 dts:3120
[mxf @ 000001dc8a9f16c0] out st:4 dts:3120
[mxf @ 000001dc8a9f16c0] out st:0 dts:3121
[mxf @ 000001dc8a9f16c0] out st:1 dts:3121
[mxf @ 000001dc8a9f16c0] essence container count:2
[mxf @ 000001dc8a9f16c0] edit units count 59
[mxf @ 000001dc8a9f16c0] essence container count:2
    Last message repeated 1 times
[mxf @ 000001dc8a9f16c0] package type:1
[mxf @ 000001dc8a9f16c0] package type:2
frame= 3122 fps=215 q=31.0 Lsize=   78495kB time=00:02:04.88 bitrate=5149.0kbits/s speed=8.59x
video:26024kB audio:46832kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.738997%

Complete console output:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'failinput.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2018-04-12T13:43:17.000000Z
  Duration: 00:02:04.93, start: 0.000000, bitrate: 11506 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 11180 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2018-04-12T13:43:17.000000Z
      handler_name    : Alias Data Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
    Metadata:
      creation_time   : 2018-04-12T13:43:17.000000Z
      handler_name    : Alias Data Handler
File 'testout.mxf' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:1 (aac) -> channelsplit (graph 0)
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (native))
  channelsplit:FL (graph 0) -> Stream #0:1 (pcm_s16le)
  channelsplit:FR (graph 0) -> Stream #0:2 (pcm_s16le)
  channelsplit:BL (graph 0) -> Stream #0:3 (pcm_s16le)
  channelsplit:BR (graph 0) -> Stream #0:4 (pcm_s16le)
Press [q] to stop, [?] for help
Output #0, mxf, to 'testout.mxf':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    encoder         : Lavf58.13.100
    Stream #0:0(eng): Video: mpeg2video (Main), yuv420p, 1920x1080, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2018-04-12T13:43:17.000000Z
      handler_name    : Alias Data Handler
      encoder         : Lavc58.19.100 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 1 channels (FL), s16, 768 kb/s (default)
    Metadata:
      encoder         : Lavc58.19.100 pcm_s16le
    Stream #0:2: Audio: pcm_s16le, 48000 Hz, 1 channels (FR), s16, 768 kb/s (default)
    Metadata:
      encoder         : Lavc58.19.100 pcm_s16le
    Stream #0:3: Audio: pcm_s16le, 48000 Hz, 1 channels (BL), s16, 768 kb/s (default)
    Metadata:
      encoder         : Lavc58.19.100 pcm_s16le
    Stream #0:4: Audio: pcm_s16le, 48000 Hz, 1 channels (BR), s16, 768 kb/s (default)
    Metadata:
      encoder         : Lavc58.19.100 pcm_s16le
frame= 3122 fps=341 q=31.0 Lsize=   78495kB time=00:02:04.88 bitrate=5149.0kbits/s speed=13.6x
video:26024kB audio:46832kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.738997% 

Change History (4)

comment:1 by 2mmi, 6 years ago

The input file is at Google drive:
https://drive.google.com/file/d/1dCYnpMovT2tPD-RGUT3AYI7iCtlyd2nF/view?usp=sharing

I can upload it to some where else, if you want that.

comment:2 by 2mmi, 6 years ago

Version: unspecifiedgit-master

comment:3 by Marton Balint, 5 years ago

Resolution: fixed
Status: newclosed

This is fixed in latest git master, maybe b8351ea0c335f082cba069accc7a3ec68f470ac9 ?

comment:4 by Carl Eugen Hoyos, 5 years ago

Component: undeterminedavformat
Description: modified (diff)
Keywords: mxf added
Note: See TracTickets for help on using tickets.