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 30th October 2021, 14:22   #1  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
Dolby TrueHD encoder? / DTS HD MA re-muxing issue

Hi all,

Except Dolby Media Producer, do you know any software which encodes PCM tracks to Dolby TrueHD?

I tried to mux a .dtshd audio file into BDedit but it results a m2ts file without an audio track. It seems it doesnt't occur with TrueHD files. Maybe is this link to this: https://forum.doom9.org/showthread.php?t=153498 ?

Thanks.

Last edited by Lucius Snow; 30th October 2021 at 18:24.
Lucius Snow is offline   Reply With Quote
Old 30th October 2021, 21:36   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by Lucius Snow View Post
Except Dolby Media Producer, do you know any software which encodes PCM tracks to Dolby TrueHD?
ffmpeg -i "INPUT" -vn -strict -2 -acodec truehd "OUTPUT.thd"

Quote:
I tried to mux a .dtshd audio file into BDedit but it results a m2ts file without an audio track. It seems it doesnt't occur with TrueHD files. Maybe is this link to this: https://forum.doom9.org/showthread.php?t=153498 ?
In that thread have enough info about .dtshd, use eac3to to remove the extra header if BDedit don't support it.
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 1st November 2021 at 10:51.
tebasuna51 is offline   Reply With Quote
Old 30th October 2021, 22:36   #3  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
[QUOTE=tebasuna51;1956181]
Quote:
Originally Posted by Lucius Snow View Post
Except Dolby Media Producer, do you know any software which encodes PCM tracks to Dolby TrueHD?[/QUOTE

ffmpeg -i "INPUT" -vn -strict -2 -acodec truehd "OUTPUT.thd"
Good to know! A few questions about this:

- Should I make a single wave file with L/R/C/LFE/Ls/Rs audio mapping for a 5.1?

- Is it possible to configure the downmix options?

- When running the command with this kind of file, the encoder says "Only mono and stereo are supported at the moment". Strange thing because Mediainfo confirms the multichannel:

Quote:
General
Complete name : E:\test1.thd
Format : MLP FBA
Format/Info : Meridian Lossless Packing FBA
Commercial name : Dolby TrueHD
File size : 271 MiB
Overall bit rate mode : Variable

Audio
Format : MLP FBA
Format/Info : Meridian Lossless Packing FBA
Commercial name : Dolby TrueHD
Bit rate mode : Variable
Maximum bit rate : 9 597 kb/s
Channel(s) : 6 channels
Channel layout : L R C LFE Ls Rs
Sampling rate : 48.0 kHz
Frame rate : 1 200.000 FPS (40 SPF)
Compression mode : Lossless
BDFix requires the AC3 file with it. I suppose it's the core. Should it be a separate encode in 640 kbit/s? By the way, the bitrate reaches almost 10 Mbit/s which looks high comparing to others similar files that I checked.

Quote:
In that thread have enough info about .dtshd, use eac3to to remove the extra header if BDedit don't support it.
I haven't found the right line command to rewrite the file from a .dtshd file input.

Last edited by Lucius Snow; 30th October 2021 at 22:50.
Lucius Snow is offline   Reply With Quote
Old 30th October 2021, 23:41   #4  |  Link
Richard1485
Guest
 
Posts: n/a
Quote:
Originally Posted by Lucius Snow View Post
BDFix requires the AC3 file with it. I suppose it's the core.
You should be able to add a "core" with eac3to:
Code:
eac3to input.thd output.thd+ac3
AFAIK, ffmpeg doesn't yet have the option to encode TrueHD with a "core". If it does, I'd like to know how myself...
  Reply With Quote
Old 31st October 2021, 11:17   #5  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Also you can use eac3to to remove the extra header of a dtshd created with DTS-HD Master Audio:

eac3to input.dtshd output.dts

the output remain DTS HD but without the extra header.
DTS-HD Master Audio can create the same if you use extension .cpt
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 31st October 2021, 11:39   #6  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by Lucius Snow View Post
A few questions about this:

- Should I make a single wave file with L/R/C/LFE/Ls/Rs audio mapping for a 5.1?
ffmpeg accept many formats like input, of course a correct wav or w64 uncompresed file but also dtshd, flac, ...

Quote:
- Is it possible to configure the downmix options?

- When running the command with this kind of file, the encoder says "Only mono and stereo are supported at the moment". Strange thing because Mediainfo confirms the multichannel
The codec is experimental (for that the -strict -2), undocumented and not optimized. It is not a recommended lossless format use only for compatibility reasons.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 31st October 2021, 13:31   #7  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
Thank you guys for these details.

Well, even with the extra header removed from the DTS file, BDFix corrupts the .m2ts remuxing. I have no idea why. However, I know it works with MultiAVCHD (through TSmuxer) but Eclipse software check fails in replication. BDFix doesn't.

BDFix with Dolby TrueHD may be the solution but would it be 100% compliant as it is experimental? We don't know how the downmix would be made. Also, the .thd file should integrate a framerate metadata that ffmpeg can't do, it seems.

Anyone would be able to check what's going on with BDFix and DTS HD?

EDIT : Just checked the .thd size file, it's 271 MB while the .wav takes 1,14 GB. Conclusion: It actually takes only two channels (stereo) since the ratio compression is 70%. Let' forget ffmpeg :\

Last edited by Lucius Snow; 31st October 2021 at 13:42.
Lucius Snow is offline   Reply With Quote
Old 31st October 2021, 14:22   #8  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
Using a 6 channel pcm.wav as a source, a few hours ago I managed to create a 6 channel TrueHD .thd audio stream.

However, after muxing the .thd stream within the .mkv container along with some video (using mkvtoolnix-gui) and playing it with my OPPO, nothing could be heard.

I also tried adding an AC3 core (using UsEac3to) and muxing everything into the .m2ts container (using TSmuxerGUI), but again nothing can be heard.

On the good side... The OPPO reports that the Dolby TrueHD streams are present for both containers...
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 31st October 2021, 14:30   #9  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
Quote:
Originally Posted by SeeMoreDigital View Post
Using a 6 channel pcm.wav as a source, a few hours ago I managed to create a 6 channel TrueHD .thd audio stream.
That's what Mediainfos's metadatas show here too. But the size file shows it can only contain two channels, like ffmpeg warns about when we run the command.
Lucius Snow is offline   Reply With Quote
Old 31st October 2021, 14:51   #10  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
Quote:
Originally Posted by Lucius Snow View Post
But the size file shows it can only contain two channels, like ffmpeg warns about when we run the command.
Actually no, the TrueHD encode does have 6 channels.

Indeed, this can easily be checked by re-encoding the TrueHD audio stream to a different audio format, such as FLAC... Which is what I have done for confirmation
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 31st October 2021, 14:55   #11  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
Quote:
Originally Posted by SeeMoreDigital View Post
Actually no, the TrueHD encode does have 6 channels.

Indeed, this can easily be checked by re-encoding the TrueHD audio stream to a different audio format, such as FLAC... Which is what I have done for confirmation
Can you please give me your source size file (all PCM 6 channels cumulated) and the .thd one?
Lucius Snow is offline   Reply With Quote
Old 31st October 2021, 14:59   #12  |  Link
Richard1485
Guest
 
Posts: n/a
Yeah, I split the TrueHD 5.1 file that ffmpeg produced back to wavs and got my original mono wavs back. Maybe try burning eact3o's output to disc to see if that works in the Oppo.

Last edited by Richard1485; 31st October 2021 at 15:09.
  Reply With Quote
Old 31st October 2021, 15:06   #13  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
Here you go: https://www.sendspace.com/file/utrnry
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 31st October 2021, 15:47   #14  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
You're right, all 6 channels are here. But there's something wrong...

My sample test files - 20 min - 6 channels :

WAVE - PCM (source) : 1 GB
TrueHD (by Dolby Media Producer) : 608 MB
TrueHD (by ffmpeg) : 187 MB

If you convert back your TrueHD made by ffmpeg, you'll see it 16 bit only! So why doesn't ffmpeg support 24 bit as TrueHD output?
Lucius Snow is offline   Reply With Quote
Old 31st October 2021, 16:00   #15  |  Link
richardpl
Registered User
 
Join Date: Jan 2012
Posts: 271
I doubt that is case, use -c:a pcm_f24le when muxing into wav. As default one is pcm16 always.
richardpl is offline   Reply With Quote
Old 31st October 2021, 16:05   #16  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
Quote:
Originally Posted by richardpl View Post
I doubt that is case, use -c:a pcm_f24le when muxing into wav. As default one is pcm16 always.
That doesn't change anything, fffmpeg already considers the source as 24 bit.

Input #0, wav, from 'E:\test.wav':
Metadata:
date : 2021-10-31T16:15:02+01:00
encoder : Adobe Audition 12.1 (Windows)
Duration: 00:23:37.33, bitrate: 6912 kb/s
Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1, s32 (24 bit), 6912 kb/s
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 0, only the last option '-c:a truehd' will be used.
File 'E:\test3.thd' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s24le (native) -> truehd (native))
Press [q] to stop, [?] for help
[truehd @ 000001f060ac1b80] Only mono and stereo are supported at the moment.
Output #0, truehd, to 'E:\test3.thd':
Metadata:
date : 2021-10-31T16:15:02+01:00
encoder : Lavf59.4.101
Stream #0:0: Audio: truehd, 48000 Hz, 5.1, s16, 128 kb/s <- that's not a lossless bitrate
Metadata:
encoder : Lavc59.4.100 truehd

EDIT

It's a know bug:
https://www.mail-archive.com/search?...2&o=newest&f=1

Fixed in 2019:
http://ffmpeg.org/pipermail/ffmpeg-d...ly/246357.html

But where is the right ffmpeg version which includes the fix?

Last edited by Lucius Snow; 31st October 2021 at 16:13.
Lucius Snow is offline   Reply With Quote
Old 31st October 2021, 16:15   #17  |  Link
Richard1485
Guest
 
Posts: n/a
Quote:
Originally Posted by Lucius Snow View Post
So why doesn't ffmpeg support 24 bit as TrueHD output?
AFAIK, it simply doesn't at present.

Code:
ffmpeg -h encoder=truehd
Output:
Quote:
Encoder truehd [TrueHD]:
General capabilities: delay small exp
Threading capabilities: none
Supported sample rates: 44100 48000 88200 96000 176400 192000
Supported sample formats: s16
Supported channel layouts: stereo 5.0 5.1
EDIT: Sorry. I didn't see your edit. But I've tried multiple builds and can't find one that supports 24-bit.
  Reply With Quote
Old 31st October 2021, 16:25   #18  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
I've jut wrote to the developper to ask if a build including the fix would exist somewhere.

Have you tried the DTS remux with BDFix on your side?
Lucius Snow is offline   Reply With Quote
Old 31st October 2021, 16:26   #19  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
No doubt, if the PCM.wav audio stream is not a genuine 24-bit encoded source it's superfluous/padded bits will be removed...
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 31st October 2021, 17:01   #20  |  Link
Lucius Snow
Registered User
 
Join Date: Oct 2003
Posts: 157
Quote:
Originally Posted by SeeMoreDigital View Post
No doubt, if the PCM.wav audio stream is not a genuine 24-bit encoded source it's superfluous/padded bits will be removed...
Mine is genuine. It looks like a ffmpeg limitation to 16 bit. But why this fix from 2019 was not integrated into the builds?
Lucius Snow 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 02:36.


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