Problem Importing 24-bit DTS

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
LulaMolusco
Posts: 4
Joined: Fri May 16, 2014 5:00 am
Operating System: Please select

Problem Importing 24-bit DTS

Post by LulaMolusco » Fri May 16, 2014 5:14 am

Everytime i try to import a multichannel 24-bit DTS audio track from a movie it ends up showing in audacity as 6 16-bit tracks and not 24-bit.
Am I doing something wrong or is it just a limitation from audacity or the decoder?

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Problem Importing 24-bit DTS

Post by Gale Andrews » Fri May 16, 2014 7:05 am

LulaMolusco wrote:Everytime i try to import a multichannel 24-bit DTS audio track from a movie it ends up showing in audacity as 6 16-bit tracks and not 24-bit.
Am I doing something wrong or is it just a limitation from audacity or the decoder?
Assuming you are using FFmpeg to import the file, it's a limitation of Audacity's support for FFmpeg.

FFmpeg does support more than 16-bit samples, but not all codecs supported by FFmpeg support more than 16-bit samples.

Audacity does not directly import audio files. Instead Audacity makes a copy of files in lossless PCM (maintaining the existing quality of lossy files) at the bit depth chosen at Default Sample Format in Quality Preferences. So the bit depth shown in the track is not the bit depth of the file but the "Default Sample Format" setting, unless a restriction like that for FFmpeg forces the bit depth to be lower. OGG has a similar restriction - OGG only supports 8-bit or 16-bit samples and Audacity minimum sample format is 16-bit, so OGG files will always be imported at 16-bit resolution irrespective of what the Default Sample Format is.

Given all the above, it was decided not to try to force all FFmpeg-supported codecs to import at 32-bit (and a case-by-case approach according to what each format could be expanded to would take a lot of lot of time). This situation may change in future because Audacity's support for FFmpeg is limited to version 0.10 (or 0.6.2 on Windows and Mac), so we are looking at solutions to that.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

LulaMolusco
Posts: 4
Joined: Fri May 16, 2014 5:00 am
Operating System: Please select

Re: Problem Importing 24-bit DTS

Post by LulaMolusco » Fri May 16, 2014 11:17 am

Extremely helpful post.
Thanks a lot. ;)

bat999
Posts: 22
Joined: Mon Apr 28, 2014 5:45 pm
Operating System: Please select

Re: Problem Importing 24-bit DTS

Post by bat999 » Fri May 16, 2014 10:01 pm

@ Gale
Yes, that's a good explanation. 8-)

With a sample file from samples.mplayerhq.hu

Code: Select all

wget "samples.mplayerhq.hu/A-codecs/DTS/dts/Master%20Audio%205.1%2024bit.dts"
mediainfo "Master Audio 5.1 24bit.dts" shows
dts, 6 channels, 48KHz, 24 bits.

When imported into Audacity using FFmpeg import library result shows
pcm, 6 channels, 48KHz, 16 bits.

I suppose the workaround is to convert it to pcm with FFmpeg before importing it into Audacity.

Code: Select all

ffmpeg -i "Master Audio 5.1 24bit.dts" -c:a pcm_s24le tester.wav
Then mediainfo "tester.wav" shows
pcm, 6 channels, 48KHz, 24 bits.

And when imported into Audacity (FFmpeg library not needed) result shows
pcm, 6 channels, 48KHz, 32 bits.

But after processing the file in Audacity, how would it be exported?
Is there a command-line dts encoder that could be used as "external program" to achieve same quality as the original "Master Audio 5.1 24bit.dts" file?
8-)

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Problem Importing 24-bit DTS

Post by Gale Andrews » Fri May 16, 2014 10:50 pm

bat999 wrote:After processing the file in Audacity, how would it be exported?
Is there a command-line dts encoder that could be used as "external program" to achieve same quality as the original "Master Audio 5.1 24bit.dts" file?
The only way I know is to use a recent build of FFmpeg (like those from Zeranoe ) then use the "dca" (DTS Coherent Acoustics) encoding. So on Windows the command would look something like:

Code: Select all

"C:Program Files (x86)ffmpeg-2.0-win32-staticbinffmpeg.exe" -i - -acodec dca -strict -2 "%f"
and you would add the ".dts" extension (without quotes) to the end of the file name.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

bat999
Posts: 22
Joined: Mon Apr 28, 2014 5:45 pm
Operating System: Please select

Re: Problem Importing 24-bit DTS

Post by bat999 » Fri May 16, 2014 11:27 pm

Gale Andrews wrote:... then use the "dca" (DTS Coherent Acoustics) encoding.
Hi
I had tried that, but when exported the result is
dts, 2 channels, 48KHz, 16 bits.

Maybe FFmpeg's dts encoder is not good enough. :?
@Xubuntu:~$ ffmpeg
ffmpeg version 2.2.git-3690393 Copyright (c) 2000-2014 the FFmpeg developers
built on May 14 2014 15:40:01 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)

bat999
Posts: 22
Joined: Mon Apr 28, 2014 5:45 pm
Operating System: Please select

Re: Problem Importing 24-bit DTS

Post by bat999 » Sat May 17, 2014 12:18 am

Doh :o
I needed to set Audacity ...

Preferences > Import/Export

"Use custom mix" instead of "Always mix all tracks down"

Now with FFmpeg

Code: Select all

ffmpeg -i - -c:a dca -strict -2 -ar 48000 "%f"
The final result is
dts, 6 channels, 48KHz, 16 bits.

bat999
Posts: 22
Joined: Mon Apr 28, 2014 5:45 pm
Operating System: Please select

Re: Problem Importing 24-bit DTS

Post by bat999 » Sat May 17, 2014 3:28 pm

Hello again :roll:
If the file is exported from Audacity as a .wav file with

Code: Select all

ffmpeg -i - -c:a pcm_s24le -ar 48000 -ac 6 "%f"
The result is
pcm, 6 channels, 48KHz, 24 bits.

So all the original parameters are now kept (including bit depth).
And it could then be converted to dts or whatever with a "suitable" encoder.
8-)

bat999
Posts: 22
Joined: Mon Apr 28, 2014 5:45 pm
Operating System: Please select

Re: Problem Importing 24-bit DTS

Post by bat999 » Sat May 17, 2014 3:50 pm

Hmm
Audacity is able to export 24 bit PCM without FFmpeg. ;)
File > Export Audio > Other uncompressed files > Options > Signed 24 bit PCM

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Problem Importing 24-bit DTS

Post by Gale Andrews » Sat May 17, 2014 8:47 pm

bat999 wrote:"Use custom mix" instead of "Always mix all tracks down"

Now with FFmpeg

Code: Select all

ffmpeg -i - -c:a dca -strict -2 -ar 48000 "%f"
The final result is
dts, 6 channels, 48KHz, 16 bits.
Is

Code: Select all

-c:a
the same as

Code: Select all

-acodec
I am not an expert in this, I just quoted what someone told me had worked for DTS export at unknown bit depth ;)

Typically you set sample format for PCM by specifying this in -acodec.

According to the built-in ffmpeg help :
-sample_fmt format
set sample format, 'list' as argument shows all the sample formats supported
I have not figured out the correct syntax to use for listing or setting - it just returns
Unrecognized option 'sample_format'
Perhaps you really need to encode in DTS-HD but FFmpeg cannot do that yet according to: http://www.ffmpeg.org/general.html .

If you are really keen you could ask here https://lists.ffmpeg.org/mailman/listinfo/ffmpeg-user/ or on a specialist forum like Doom9 or hydrogenaudio and see if you can get a definitive answer.

Or you can try (at your own legal risk) dcaenc .

Let us know how you get on...


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Post Reply