[FFmpeg-trac] #9818(ffmpeg:new): Introduce support for MCA sub-descriptors in mxf and mov container

FFmpeg trac at avcodec.org
Thu Jun 23 21:12:43 EEST 2022


#9818: Introduce support for MCA sub-descriptors in mxf and mov container
----------------------------------+---------------------------------------
             Reporter:  FranceBB  |                     Type:  enhancement
               Status:  new       |                 Priority:  wish
            Component:  ffmpeg    |                  Version:  git-master
             Keywords:  mxf       |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+---------------------------------------
 Summary of the bug: Audio tagging in mxf isn't passed through.

 I have an IMF package with videos and audios and of course the CPL.
 Video file is a MJPEG2000 BT709 SDR 10bit muxed in mxf
 The audio files are PCM lossless 24bit 48'000Hz muxed as .mxf
 To differentiate them, each one has audio tagging inside, so if I use
 Mediainfo I can see for instance:


 {{{
 General
 Complete name : Test.mxf
 Format :        MXF
 Format version :        1.3
 Format profile :        OP-1a
 Format settings :       Closed / Complete
 File size :     6.10 GiB
 Duration :      2 h 6 min
 Overall bit rate :      6 912 kb/s
 Package name :  Material Package / File Package: SMPTE 382M clip wrapping
 of wave audio
 Encoded date :  2022-05-03 22:48:00.768
 Writing application :   Rohde and Schwarz Clipster 6.9.1.0.1
 Writing library :       Windows 8 (64-bit) 2.38.0.20411.1

 Audio
 ID :    2
 Format :        PCM
 Format settings :       Little
 Format settings, wrapping mode :        Clip (BWF)
 Codec ID :      0D01030102060200
 Duration :      2 h 6 min
 Bit rate mode : Constant
 Bit rate :      6 912 kb/s
 Channel(s) :    6 channels
 Channel layout :        L R C LFE Ls Rs
 Sampling rate : 48.0 kHz
 Bit depth :     24 bits
 Stream size :   6.10 GiB (100%)
 Title : FP Sound track
 Language :      Italian
 Locked :        Yes
 MCA Title :     MCA Title
 MCA Title Version :     MCA Title Version
 MCA Audio Content Kind :        MCA Audio Content Kind
 MCA Audio Element Kind :        MCA Audio Element Kind

 Other #1
 ID :    1-Material
 Type :  Time code
 Format :        MXF TC
 Frame rate :    24.000 FPS
 Time code of first frame :      00:59:30:00
 Time code settings :    Material Package
 Time code, striped :    Yes
 Title : Timecode track

 Other #2
 ID :    1-Source
 Type :  Time code
 Format :        MXF TC
 Frame rate :    24.000 FPS
 Time code of first frame :      00:59:30:00
 Time code settings :    Source Package
 Time code, striped :    Yes
 Title : Timecode track

 As you can see, there's the language tagging:

 Language : Italian

 same goes for other tracks that might have a different language like
 English:

 General
 Complete name : Test2.mxf
 Format :        MXF
 Format version :        1.3
 Format profile :        OP-1a
 Format settings :       Closed / Complete
 File size :     6.10 GiB
 Duration :      2 h 6 min
 Overall bit rate :      6 912 kb/s
 Package name :  Material Package / File Package: SMPTE 382M clip wrapping
 of wave audio
 Encoded date :  2022-05-03 22:48:00.768
 Writing application :   Rohde and Schwarz Clipster 6.9.1.0.1
 Writing library :       Windows 8 (64-bit) 2.38.0.20411.1

 Audio
 ID :    2
 Format :        PCM
 Format settings :       Little
 Format settings, wrapping mode :        Clip (BWF)
 Codec ID :      0D01030102060200
 Duration :      2 h 6 min
 Bit rate mode : Constant
 Bit rate :      6 912 kb/s
 Channel(s) :    6 channels
 Channel layout :        L R C LFE Ls Rs
 Sampling rate : 48.0 kHz
 Bit depth :     24 bits
 Stream size :   6.10 GiB (100%)
 Title : FP Sound track
 Language :      English
 Locked :        Yes

 Other #1
 ID :    1-Material
 Type :  Time code
 Format :        MXF TC
 Frame rate :    24.000 FPS
 Time code of first frame :      00:59:30:00
 Time code settings :    Material Package
 Time code, striped :    Yes
 Title : Timecode track

 Other #2
 ID :    1-Source
 Type :  Time code
 Format :        MXF TC
 Frame rate :    24.000 FPS
 Time code of first frame :      00:59:30:00
 Time code settings :    Source Package
 Time code, striped :    Yes
 Title : Timecode track
 }}}


 so:
 Language : English

 however when I do:



 {{{
 ffmpeg.exe -f imf -i "D:\Masterfiles\CPL_IMF.xml" -map 0:0 -map 0:1 -map
 0:2 -map 0:3 -map 0:4 -c:v copy -c:a copy -f mxf -y
 "D:\Masterfiles\test.mxf"

 pause
 }}}


 FFMpeg outputs an error in the language tagging, namely:


 {{{
 [imf @ 000001d283a12a00] Opening 'D:\Masterfiles\ASSETMAP.xml' for reading
 [mxf @ 000001d283a689c0] local tag 0xdff5 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff4 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff3 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff2 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff5 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff4 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff3 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff2 with 0 size
 }}}

 The whole command line output is:


 {{{
 H:\MJPEG2000 DCP Hardsubber (x86) - Final>ffmpeg.exe -f imf -i
 "D:\Masterfiles\CPL_IMF.xml" -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4
 -c:v copy -c:a copy -f mxf -y "D:\Masterfiles\test.mxf"
 ffmpeg version git-2022-01-28-f581139854-20220128 Copyright (c) 2000-2022
 the FFmpeg developers
   built with gcc 11.2.0 (crosstool-NG 1.24.0.498_5075e1f)
   configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static
 --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64
 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug
 --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2
 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp
 --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl
 --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib
 --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-
 libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm
 --enable-frei0r --enable-libgme --enable-libass --enable-libbluray
 --enable-libmp3lame --enable-libopus --enable-librist --enable-libtheora
 --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-
 libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-
 librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-
 libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d
 --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan
 --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265
 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi
 --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-
 ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-
 version=20220128
   libavutil      57. 18.100 / 57. 18.100
   libavcodec     59. 20.100 / 59. 20.100
   libavformat    59. 17.101 / 59. 17.101
   libavdevice    59.  5.100 / 59.  5.100
   libavfilter     8. 25.100 /  8. 25.100
   libswscale      6.  5.100 /  6.  5.100
   libswresample   4.  4.100 /  4.  4.100
   libpostproc    56.  4.100 / 56.  4.100
 IMF CPL ContentTitle: Hitch
 IMF CPL Id: urn:uuid:e945442e-aa35-4961-9b74-7c624fb9d232
 [imf @ 000001d283a12a00] Opening 'D:\Masterfiles\ASSETMAP.xml' for reading
 [mxf @ 000001d283a689c0] local tag 0xdff5 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff4 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff3 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff2 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff5 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff4 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff3 with 0 size
 [mxf @ 000001d283a689c0] local tag 0xdff2 with 0 size
 Input #0, imf, from 'D:\Masterfiles\CPL_IMF.xml':
   Duration: 02:06:22.49, start: 0.000000, bitrate: 0 kb/s
   Stream #0:0: Video: jpeg2000, yuv422p10le(tv, bt709, progressive),
 3840x2160, 23.98 tbr, 23.98 tbn
   Stream #0:1: Audio: pcm_s24le, 48000 Hz, downmix, s32 (24 bit), 2304
 kb/s
   Stream #0:2: Audio: pcm_s24le, 48000 Hz, downmix, s32 (24 bit), 2304
 kb/s
   Stream #0:3: Audio: pcm_s24le, 48000 Hz, 5.1(side), s32 (24 bit), 6912
 kb/s
   Stream #0:4: Audio: pcm_s24le, 48000 Hz, 5.1(side), s32 (24 bit), 6912
 kb/s
 Output #0, mxf, to 'D:\Masterfiles\test.mxf':
   Metadata:
     encoder         : Lavf59.17.101
   Stream #0:0: Video: jpeg2000, yuv422p10le(tv, bt709, progressive),
 3840x2160, q=2-31, 23.98 tbr, 23.98 tbn
   Stream #0:1: Audio: pcm_s24le, 48000 Hz, downmix, s32 (24 bit), 2304
 kb/s (default)
   Stream #0:2: Audio: pcm_s24le, 48000 Hz, downmix, s32 (24 bit), 2304
 kb/s
   Stream #0:3: Audio: pcm_s24le, 48000 Hz, 5.1(side), s32 (24 bit), 6912
 kb/s
   Stream #0:4: Audio: pcm_s24le, 48000 Hz, 5.1(side), s32 (24 bit), 6912
 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
   Stream #0:2 -> #0:2 (copy)
   Stream #0:3 -> #0:3 (copy)
   Stream #0:4 -> #0:4 (copy)
 Press [q] to stop, [?] for help
 frame= 3987 fps=793 q=-1.0 size= 3678208kB time=00:02:46.29
 bitrate=181199.6kbits/s speed=33.1x
 }}}


 and indeed the final file lacks the audio tagging:


 {{{
 General
 Complete name : D:\Masterfiles\test.mxf
 Format :        MXF
 Format version :        1.3
 Format profile :        OP-1a
 Format settings :       Closed / Complete
 File size :     3.64 GiB
 Duration :      2 min 52 s
 Overall bit rate :      181 Mb/s
 Encoded date :  0-00-00 00:00:00.000
 Writing application :   FFmpeg OP1a Muxer 59.17.101.0.0
 Writing library :       Lavf (mingw32) 59.17.101.0.0

 Video
 ID :    2
 Format :        JPEG 2000
 Format profile :        BCS at L5
 Format settings, wrapping mode :        Frame
 Codec ID :      0D010301020C0100-0401020203010100
 Duration :      2 min 52 s
 Bit rate :      163 Mb/s
 Width : 3 840 pixels
 Height :        2 160 pixels
 Display aspect ratio :  16:9
 Frame rate :    23.976 (24000/1001) FPS
 Color space :   YUV
 Chroma subsampling :    4:2:2
 Bit depth :     10 bits
 Scan type :     Progressive
 Bits/(Pixel*Frame) :    0.819
 Stream size :   3.27 GiB (90%)
 Color range :   Limited
 Color primaries :       BT.709
 Transfer characteristics :      BT.709
 Matrix coefficients :   BT.709

 Audio #1
 ID :    3
 Format :        PCM
 Format settings :       Little
 Format settings, wrapping mode :        Frame (AES)
 Codec ID :      0D01030102060300
 Duration :      2 min 52 s
 Bit rate mode : Constant
 Bit rate :      2 304 kb/s
 Channel(s) :    2 channels
 Sampling rate : 48.0 kHz
 Frame rate :    23.976 FPS (2002 SPF)
 Bit depth :     24 bits
 Stream size :   47.4 MiB (1%)
 Locked :        Yes

 Audio #2
 ID :    4
 Format :        PCM
 Format settings :       Little
 Format settings, wrapping mode :        Frame (AES)
 Codec ID :      0D01030102060300
 Duration :      2 min 52 s
 Bit rate mode : Constant
 Bit rate :      2 304 kb/s
 Channel(s) :    2 channels
 Sampling rate : 48.0 kHz
 Frame rate :    23.976 FPS (2002 SPF)
 Bit depth :     24 bits
 Stream size :   47.4 MiB (1%)
 Locked :        Yes

 Audio #3
 ID :    5
 Format :        PCM
 Format settings :       Little
 Format settings, wrapping mode :        Frame (AES)
 Codec ID :      0D01030102060300
 Duration :      2 min 52 s
 Bit rate mode : Constant
 Bit rate :      6 912 kb/s
 Channel(s) :    6 channels
 Sampling rate : 48.0 kHz
 Frame rate :    23.976 FPS (2002 SPF)
 Bit depth :     24 bits
 Stream size :   142 MiB (4%)
 Locked :        Yes

 Audio #4
 ID :    6
 Format :        PCM
 Format settings :       Little
 Format settings, wrapping mode :        Frame (AES)
 Codec ID :      0D01030102060300
 Duration :      2 min 52 s
 Bit rate mode : Constant
 Bit rate :      6 912 kb/s
 Channel(s) :    6 channels
 Sampling rate : 48.0 kHz
 Frame rate :    23.976 FPS (2002 SPF)
 Bit depth :     24 bits
 Stream size :   142 MiB (4%)
 Locked :        Yes

 Other #1
 ID :    1-Material
 Type :  Time code
 Format :        MXF TC
 Frame rate :    24.000 FPS
 Time code of first frame :      00:00:00:00
 Time code settings :    Material Package
 Time code, striped :    Yes

 Other #2
 ID :    1-Source
 Type :  Time code
 Format :        MXF TC
 Frame rate :    24.000 FPS
 Time code of first frame :      00:00:00:00
 Time code settings :    Source Package
 Time code, striped :    Yes

 Other #3
 Type :  Time code
 Format :        SMPTE TC
 Muxing mode :   SDTI
 Frame rate :    24.000 FPS
 Time code of first frame :      00:00:00:00
 }}}


 Changing the remux to mov doesn't improve things either:


 {{{
 ffmpeg.exe -f imf -i "D:\Masterfiles\CPL_IMF.xml" -map 0:0 -map 0:1 -map
 0:2 -map 0:3 -map 0:4 -c:v copy -c:a copy -f mov -y
 "D:\Masterfiles\test.mov"

 pause
 }}}


 {{{
 General
 Complete name : D:\Masterfiles\test.mov
 Format :        MPEG-4
 Format profile :        QuickTime
 Codec ID :      qt 0000.02 (qt )
 File size :     2.06 GiB
 Duration :      1 min 42 s
 Overall bit rate mode : Variable
 Overall bit rate :      173 Mb/s
 Writing application :   Lavf59.17.101

 Video
 ID :    1
 Format :        JPEG 2000
 Codec ID :      mjp2
 Duration :      1 min 42 s
 Bit rate mode : Variable
 Bit rate :      155 Mb/s
 Width : 3 840 pixels
 Height :        2 160 pixels
 Display aspect ratio :  16:9
 Frame rate mode :       Constant
 Frame rate :    23.976 (24000/1001) FPS
 Color space :   YUV
 Scan type :     Progressive
 Bits/(Pixel*Frame) :    0.778
 Stream size :   1.84 GiB (89%)
 Color primaries :       BT.709
 Transfer characteristics :      BT.709
 Matrix coefficients :   BT.709

 Audio #1
 ID :    2
 Format :        PCM
 Format settings :       Little / Signed
 Codec ID :      in24
 Duration :      1 min 42 s
 Bit rate mode : Constant
 Bit rate :      2 304 kb/s
 Channel(s) :    2 channels
 Channel layout :        Lt Rt
 Sampling rate : 48.0 kHz
 Bit depth :     24 bits
 Stream size :   28.1 MiB (1%)
 Default :       Yes
 Alternate group :       1

 Audio #2
 ID :    3
 Format :        PCM
 Format settings :       Little / Signed
 Codec ID :      in24
 Duration :      1 min 42 s
 Bit rate mode : Constant
 Bit rate :      2 304 kb/s
 Channel(s) :    2 channels
 Channel layout :        Lt Rt
 Sampling rate : 48.0 kHz
 Bit depth :     24 bits
 Stream size :   28.1 MiB (1%)
 Default :       No
 Alternate group :       1

 Audio #3
 ID :    4
 Format :        PCM
 Format settings :       Little / Signed
 Codec ID :      in24
 Duration :      1 min 42 s
 Bit rate mode : Constant
 Bit rate :      6 912 kb/s
 Channel(s) :    6 channels
 Channel layout :        L R C LFE Ls Rs
 Sampling rate : 48.0 kHz
 Bit depth :     24 bits
 Stream size :   84.3 MiB (4%)
 Default :       No
 Alternate group :       1

 Audio #4
 ID :    5
 Format :        PCM
 Format settings :       Little / Signed
 Codec ID :      in24
 Duration :      1 min 42 s
 Bit rate mode : Constant
 Bit rate :      6 912 kb/s
 Channel(s) :    6 channels
 Channel layout :        L R C LFE Ls Rs
 Sampling rate : 48.0 kHz
 Bit depth :     24 bits
 Stream size :   84.2 MiB (4%)
 Default :       No
 Alternate group :       1

 }}}


 This is the dump of the source mxf files: [https://github.com/sandflow
 /ffmpeg-imf/files/8959600/Source.MXF.Dump.zip]

 It looks like FFmpeg does not support writing MCA sub-descriptors, which
 contain the language information:

 https://github.com/FFmpeg/FFmpeg/blob/fed07efcde72824ac1ada80d4af4e91ac4fcfc14/libavformat/mxfenc.c#L1430



 How to reproduce:
 {{{
 % ffmpeg f imf -i "D:\Masterfiles\CPL_IMF.xml" -map 0:0 -map 0:1 -map 0:2
 -map 0:3 -map 0:4 -c:v copy -c:a copy -f mxf -y "D:\Masterfiles\test.mxf"
 ffmpeg version 2022-01-28-f581139854-20220128
 built on 2022-01-28
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9818>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list