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
Extremely helpful post.
Thanks a lot.
@ Gale
Yes, that’s a good explanation.
With a sample file from samples.mplayerhq.hu
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.
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?
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:
"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
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)
Doh
I needed to set Audacity …
Preferences > Import/Export
“Use custom mix” instead of “Always mix all tracks down”
Now with FFmpeg
ffmpeg -i - -c:a dca -strict -2 -ar 48000 "%f"
The final result is
dts, 6 channels, 48KHz, 16 bits.
Hello again
If the file is exported from Audacity as a .wav file with
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.
Hmm
Audacity is able to export 24 bit PCM without FFmpeg.
File > Export Audio > Other uncompressed files > Options > Signed 24 bit PCM
Is
-c:a
the same as
-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 recent versions of FFmpeg, yes.
For me
ffmpeg -sample_fmts
shows
name depth
u8 8
s16 16
s32 32
flt 32
dbl 64
u8p 8
s16p 16
s32p 32
fltp 32
dblp 64
But I don’t know if they are applicable for dca codec.
The exported file from Audacity is now:-
pcm, 6 channels, 48KHz, 24 bits
I’ll leave it for others to decide what they’re going to do with it, dts or whatever.
OK I was using FFmpeg 0.6.
In FFmpeg 1.0 I get the output you show from
ffmpeg -sample_fmts

But I don’t know if they are applicable for dca codec.
They look like pcm formats, and no 24-bit.
In FFmpeg 1.0, following the syntax given in -help:
ffmpeg -i <name of input.file> -sample_fmt <format in format list> <output.file>
gives an error.
As far as I can see, core DTS Coherent Acoustics is lossy and the bit depth only has meaning for lossless encoding using the DTS-HD extension.
Gale