Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th August 2019, 15:52   #1  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 619
DolbyE Decoding Guide

One of the reason why I'm opening up this topic is that I wanna describe how to decode one of the most common audio format used in mezzanine files by TV Stations: DolbyE.
Although there are still no free open source DolbyE encoders yet Link, there are DolbyE decoders, however they are not very documented.

In my first attempt to index an .MXF masterfile that had a DolbyE stream, I tried to use FFAudioSource, LWLibavAudioSource and DGIndex but they all failed.
The reason why they failed is the non-standard configuration of having a DolbyE with 5.1+2.0 within the same track.
Let me explain this.
In general, whenever you have an XDCAM Masterfile, you could have the following configuration:

CH.1-2 DolbyE Dubbed Language 5.1
CH.3-4 DolbyE Original Language 5.1
CH.5-6 Stereo Downmix Dubbed Language 2.0
CH.7-8 Stereo Downmix Original Language 2.0

In this scenario, indexing the DolbyE streams (CH.1-2 and CH.3-4) works perfectly fine along with indexing the normal stereo tracks in CH.5-6 and CH.7-8, however, this configuration is hardly used.
Why? Well, that's because the playout ports generally only look for CH.1-2 and CH.3-4 as they are gonna be the ones that are gonna be re-encoded on the fly and then aired... So... what about the downmix information in the other channels? Well, by DolbyE specifications is actually possible to include 8 channels within a single stream, namely a 5.1 + 2.0 configuration which is gonna be:

- Front Left
- Front Right
- Center
- LFE
- Surround Left
- Surround Right
- Stereo Downmix Left
- Stereo Downmix Right

By doing so, broadcast engineers are generally happy as they can have the following audio configuration:

- CH.1-2 DolbyE Dubbed 5.1+2.0
- CH.3-4 DolbyE Original 5.1+2.0
- CH.5-6 PCM Stereo Downmix Dubbed 2.0
- CH.7-8 PCM Stereo Downmix Original 2.0

So, the streams in CH.1-2 and CH.3-4 are gonna be encoded on the fly and aired correctly, while CH.5-6 and CH.7-8 are just gonna be discarded and they are only gonna be kept for archival purposes in the mezzanine file.

Everything works, so we're good, right? No!
Here comes the first problem: although this way of having a 5.1+2.0 stream works for professional broadcast decoders along with the proprietary Dolby decoders, it really confuses open source indexers like FFAudioSource and LWLibavAudioSource as they think that it's a 7.1 stream and they try to decode it that way, thus getting a horrible, just horrible track full of undetermined noise. Using ffmpeg itself without Avisynth has the same result 'cause ffmpeg thinks that it's a 7.1 pcm_s24 stream and fails to decode it properly, however MediaInfo can detect that it's a DolbyE 5.1 + 2.0 stream, so... what's going on here? Something "fishy" is happening.
Well, in order to properly decode a DolbyE 5.1 + 2.0 stream, you need to first remux in a .u8 file with ffmpeg and then decode and encode it with ffmpeg, 'cause this way it's gonna be identified correctly by ffmpeg:

Code:
ffmpeg.exe  -i %1  -acodec copy  -f u8 -y out.u8
ffmpeg.exe  -i out.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.0:0.0.0 -y out1.wav
ffmpeg.exe  -i out.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.1:0.0.0 -y out2.wav
ffmpeg.exe  -i out.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.2:0.0.0 -y out3.wav
ffmpeg.exe  -i out.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.3:0.0.0 -y out4.wav
ffmpeg.exe  -i out.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.4:0.0.0 -y out5.wav
ffmpeg.exe  -i out.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.5:0.0.0 -y out6.wav
ffmpeg.exe  -i out.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.6:0.0.0 -y out7.wav
ffmpeg.exe  -i out.u8 -acodec pcm_s24le -ar 48000 -ac 1 -map_channel 0.0.7:0.0.8 -y out8.wav

pause

That's pretty much it.
I hope it helps you folks trying to decode and re-encode DolbyE 5.1 + 2.0 streams.

Cheers,
Frank.
__________________
Broadcast Encoder
LinkedIn

Last edited by FranceBB; 6th August 2019 at 15:56.
FranceBB is offline   Reply With Quote
Old 10th August 2019, 08:55   #2  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 717
Many thanks !
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..."
Emulgator is offline   Reply With Quote
Old 12th August 2019, 10:42   #3  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,393
Try adding this before -i:

-guess_layout_max 0

which will cause ffmpeg to stop guessing channel order. I think it simply treats your source as 7.1, which is typical for ffmpeg and 8 channels input (which in case of DolbyE is of course causing massive issues).
You may want after mapping tell it how many ac it actually has, eg -ac 2. No idea if this is needed for DolbyE or not.
If you have not seen it already:

https://trac.ffmpeg.org/wiki/AudioChannelManipulation

very useful.

If DolbyE track is detected properly it should work. If not you may want to map it to be stereo and then decode. All can be done in 1 command I think.

Last edited by kolak; 12th August 2019 at 11:10.
kolak is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 17:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.