Opened 2 years ago
Last modified 2 years ago
#9479 new enhancement
DolbyE not recognized in mxf container
Reported by: | Francesco Bucciantini | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Francesco Bucciantini | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description (last modified by )
Summary of the bug: Dolby E tracks in an mxf container aren't recognized as such, but rather as pcm_s24le, 48000 Hz, 7.1, s32 (24 bit), 9216 kb/s, which is wrong.
How to reproduce:
% ffmpeg -i "DolbyE.mxf"-acodec pcm_s24le -ar 48000 -ac 1 -y "out1.wav" ffmpeg version r103791+10 master-447cf53774 built on Sep 23 2021 03:17:02 with gcc 11.1.0 (GCC)
Sample File: https://we.tl/t-R8dRX8gIzT
Step 1: Download the sample file from here: https://we.tl/t-R8dRX8gIzT
Step 2: use ffprobe to check the file
Step 3: it's detected as 7.1 pcm instead of DolbyE 5.1 + 2.0
ffprobe.exe -show_format -show_streams -i "\\mibctvan000\Ingest\MEDIA\temp\DolbyE.mxf" pause
shows:
but the sample channel layout actually is:
Track 1: DolbyE 5.1 + 2.0 Stereo Downmix
Track 2: DolbyE 5.1 + 2.0 Stereo Downmix
Track 3: PCM S24LE 2.0 Stereo Downmix
Track 4: PCM S24LE 2.0 Stereo Downmix
Mediainfo:
General Complete name : \\mibctvan000\Ingest\MEDIA\temp\DolbyE.mxf Format : MXF Commercial name : XDCAM HD422 Format version : 1.3 Format profile : OP-1a Format settings : Open / Incomplete File size : 872 MiB Duration : 1 min 2 s Overall bit rate : 116 Mb/s Encoded date : 2021-10-25 12:27:15.452 Writing application : Omneon Inc. Omneon Media Subsystem 8.2.0.0.1 Writing library : Omneon Media Api (windows) Video ID : 2 Format : MPEG Video Commercial name : XDCAM HD422 Format version : Version 2 Format profile : 4:2:2@High Format settings : CustomMatrix / BVOP Format settings, BVOP : Yes Format settings, Matrix : Custom Format settings, GOP : M=3, N=12 Format settings, picture structure : Frame Format settings, wrapping mode : Frame Codec ID : 0D01030102046101-0401020201040300 Duration : 1 min 2 s Bit rate mode : Constant Bit rate : 50.0 Mb/s Width : 1 920 pixels Clean aperture width : 1 571 pixels / 1 571 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate : 25.000 FPS Standard : Component Color space : YUV Chroma subsampling : 4:2:2 Bit depth : 8 bits Scan type : Interlaced Scan order : Top Field First Compression mode : Lossy Bits/(Pixel*Frame) : 0.965 Time code of first frame : 00:00:00:00 Time code source : Group of pictures header GOP, Open/Closed : Closed Stream size : 375 MiB (43%) Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709 Audio #1 ID : 3-1 Format : Dolby E Format settings : Little Format settings, wrapping mode : Frame (BWF) Muxing mode : SMPTE ST 337 Codec ID : 0D01030102060100-0402020203021C00 Duration : 1 min 2 s Bit rate mode : Constant Bit rate : 1 291 kb/s Channel(s) : 6 channels Channel layout : L C Ls X R LFE Rs X Sampling rate : 48.0 kHz Frame rate : 25.000 FPS (1920 SPF) Bit depth : 20 bits Delay relative to video : -9 h 59 min Stream size : 9.67 MiB (1%) Title : Program_1 Locked : Yes Audio #2 ID : 3-2 Format : Dolby E Format settings : Little Format settings, wrapping mode : Frame (BWF) Muxing mode : SMPTE ST 337 Codec ID : 0D01030102060100-0402020203021C00 Duration : 1 min 2 s Bit rate mode : Constant Bit rate : 505 kb/s Channel(s) : 2 channels Channel layout : X X X L X X X R Sampling rate : 48.0 kHz Frame rate : 25.000 FPS (1920 SPF) Bit depth : 20 bits Delay relative to video : -9 h 59 min Stream size : 3.78 MiB (0%) Title : Program_2 Locked : Yes Audio #3 ID : 5-1 Format : Dolby E Format settings : Little Format settings, wrapping mode : Frame (BWF) Muxing mode : SMPTE ST 337 Codec ID : 0D01030102060100-0402020203021C00 Duration : 1 min 2 s Bit rate mode : Constant Bit rate : 1 291 kb/s Channel(s) : 6 channels Channel layout : L C Ls X R LFE Rs X Sampling rate : 48.0 kHz Frame rate : 25.000 FPS (1920 SPF) Bit depth : 20 bits Delay relative to video : -9 h 59 min Stream size : 9.67 MiB (1%) Title : Program_1 Locked : Yes Audio #4 ID : 5-2 Format : Dolby E Format settings : Little Format settings, wrapping mode : Frame (BWF) Muxing mode : SMPTE ST 337 Codec ID : 0D01030102060100-0402020203021C00 Duration : 1 min 2 s Bit rate mode : Constant Bit rate : 505 kb/s Channel(s) : 2 channels Channel layout : X X X L X X X R Sampling rate : 48.0 kHz Frame rate : 25.000 FPS (1920 SPF) Bit depth : 20 bits Delay relative to video : -9 h 59 min Stream size : 3.78 MiB (0%) Title : Program_2 Locked : Yes Audio #5 ID : 6 Format : PCM Format settings : Little Format settings, wrapping mode : Frame (BWF) Codec ID : 0D01030102060100 Duration : 1 min 2 s Bit rate mode : Constant Bit rate : 2 304 kb/s Channel(s) : 2 channels Sampling rate : 48.0 kHz Frame rate : 25.000 FPS (1920 SPF) Bit depth : 24 bits Stream size : 17.3 MiB (2%) Locked : Yes Audio #6 ID : 7 Format : PCM Format settings : Little Format settings, wrapping mode : Frame (BWF) Codec ID : 0D01030102060100 Duration : 1 min 2 s Bit rate mode : Constant Bit rate : 2 304 kb/s Channel(s) : 2 channels Sampling rate : 48.0 kHz Frame rate : 25.000 FPS (1920 SPF) Bit depth : 24 bits Stream size : 17.3 MiB (2%) Locked : Yes Text ID : 8-777 Format : Teletext Subtitle Muxing mode : Ancillary data / OP-47 / SDP Duration : 1 min 2 s Other #1 ID : 1-Material Type : Time code Format : MXF TC Frame rate : 25.000 FPS Time code of first frame : 10: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 : 25.000 FPS Time code of first frame : 10:00:00:00 Time code settings : Source Package Time code, striped : Yes Other #3 ID : System scheme 1-1-0 Muxing mode : System scheme 1
Therefore it's clear that ffmpeg has a problem supporting the mxf container because Dolby E tracks aren't recognized:
C:\tmp\DolbyE.mxf streams: 0: mpeg2video (4:2:2), yuv422p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16 :9], 50000 kb/s, 25 fps, 25 tbr, 25 tbn 1: pcm_s24le, 48000 Hz, 7.1, s32 (24 bit), 9216 kb/s -> must be dolby_e, 44800 Hz, 7.1, fltp 2: pcm_s24le, 48000 Hz, 7.1, s32 (24 bit), 9216 kb/s -> must be dolby_e, 44800 Hz, 7.1, fltp 3: pcm_s24le, 48000 Hz, stereo, s32 (24 bit), 2304 kb/s 4: pcm_s24le, 48000 Hz, stereo, s32 (24 bit), 2304 kb/s
With the workaround of extracting the tracks as pcm unsigned 8 bits (u8 format):
ffmpeg.exe -i DolbyE.mxf -map 0:1 -acodec copy -f u8 stream1.u8 ffmpeg.exe -i DolbyE.mxf -map 0:2 -acodec copy -f u8 stream2.u8
the extracted stream1.u8 and stream2.u8 are now recognized as Dolby E:
C:\tmp\stream1.u8 streams: 0: dolby_e, 44800 Hz, 7.1, fltp
ffmpeg should improve the mxf support to recognize Dolby E tracks and be capable to decode tracks with something like:
ffmpeg.exe -i DolbyE.mxf -map 0:1 -acodec pcm_s24le -ar 48000 -y "output.wav"
One more thing, even by decoding to u8, ffmpeg still sees the DolbyE as 7.1 rather than 5.1 + 2.0:
-------------- Media Info Audio #1 ID : 3-1 Format : Dolby E Channel(s) : 6 channels Channel layout : L C Ls X R LFE Rs X Title : Program_1 Audio #2 ID : 3-2 Format : Dolby E Channel(s) : 2 channels Channel layout : X X X L X X X R Title : Program_2
When ffmpeg decodes the stream1.u8 audio, it shows:
[dolby_e @ 0000022094688b80] Stream has 2 programs (configuration 0), channels will be output in native order.
We need to be able to select the Program!
ffmpeg should let the user choose the Program in audio streams. Maybe with something like:
-map 0:1:p:1
Currently, the only workaround is doing something like this:
@echo off setlocal EnableDelayedExpansion cd /d %~dp0 for %%a in (%*) do ( call :inizia %%a shift ) exit :inizia ffmpeg.exe -i %1 -map 0:1 -acodec copy -f u8 -y stream1.u8 ffmpeg.exe -i %1 -map 0:2 -acodec copy -f u8 -y stream2.u8 ffmpeg.exe -i stream1.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.0:0.0.0 -y out1.wav ffmpeg.exe -i stream1.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.1:0.0.0 -y out2.wav ffmpeg.exe -i stream1.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.2:0.0.0 -y out3.wav ffmpeg.exe -i stream1.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.3:0.0.0 -y out4.wav ffmpeg.exe -i stream1.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.4:0.0.0 -y out5.wav ffmpeg.exe -i stream1.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.5:0.0.0 -y out6.wav ffmpeg.exe -i stream1.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.6:0.0.0 -y out7.wav ffmpeg.exe -i stream1.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.7:0.0.8 -y out8.wav ffmpeg.exe -i stream2.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.0:0.0.0 -y out9.wav ffmpeg.exe -i stream2.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.1:0.0.0 -y out10.wav ffmpeg.exe -i stream2.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.2:0.0.0 -y out11.wav ffmpeg.exe -i stream2.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.3:0.0.0 -y out12.wav ffmpeg.exe -i stream2.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.4:0.0.0 -y out13.wav ffmpeg.exe -i stream2.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.5:0.0.0 -y out14.wav ffmpeg.exe -i stream2.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.6:0.0.0 -y out15.wav ffmpeg.exe -i stream2.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.7:0.0.8 -y out16.wav pause :eof
which is far from ideal.
Please improve support for DolbyE detection and decoding without relying on the .u8 workaround.
Change History (10)
comment:1 by , 2 years ago
Description: | modified (diff) |
---|
comment:2 by , 2 years ago
Description: | modified (diff) |
---|
comment:3 by , 2 years ago
Description: | modified (diff) |
---|
comment:4 by , 2 years ago
comment:6 by , 2 years ago
There is also a very funny problem that ffplay does not play it as 25 fps but x2 faster. mpv works correctly though. (Ffplay with and without -vf yadif x2 in both cases, there is also a problem with editlist.)
comment:7 by , 2 years ago
This file uses WAV container (or as correctly noted BWF inside mxf). That is not supported, first this should be applied besides the first patch in series (first patch is already "applied" by actually writing a parser that allowed perfect seeking in Dolby E bare .dat files) (https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=2593)
I am not sure how big is the support for BWF though, it is there, but... #3163
comment:8 by , 2 years ago
Not to forget that DolbyE can come in different configurations than in a stereo track, the container for DolbyE is afaik limited to pcm_s16le or pcm_s24le. In MXF, the only known to me way to indicate the presence of DolbyE is to utilize the fixedchannelstatus metadata Field of the AES3Essence descriptor but this is not required by any standard.
In IMX D10 MXF, DolbyE was often carried in 2 of 4 pcm_s16le channels of one single audio track.
In XDCAMHD, DolbyE is often carried in a pair of 2 mono tracks.
As we see in the above example on top of IMX and XDCAM audio track layouts, people get creative and come up with generic audio layouts in MXF where they they either have only stereo pairs or even a mix of stereo and mono tracks in the same file.
In my humble opinion, it would be best to have DolbyE decoding implemented as an Audio Filter which accepts a stereo PCM stream on input. This way one could decode DolbyE totally independent of the Source Track layout or container.
comment:9 by , 2 years ago
Here's another sample:
(unfortunately it's just 1 second 'cause GitHub is picky about 10 MB max file size)
I'm also gonna bring up the magic word: if someone is willing to address each and every DolbyE configuration in FFMpeg for both mxf and mov containers and decode them accordingly as if I was decoding any other codec, I can pay.
great solution
should be implemented