[pulseaudio-discuss] [WIP] Passthrough support
Kelly Anderson
kelly at silka.with-linux.com
Thu Mar 24 19:04:33 PDT 2011
On 03/24/11 19:35, Dark Shadow wrote:
> On Thu, Mar 24, 2011 at 7:19 PM, Kelly Anderson
> <kelly at silka.with-linux.com> wrote:
>> On 03/24/11 18:58, Dark Shadow wrote:
>>> On Thu, Mar 24, 2011 at 10:50 AM, Anssi Hannula<anssi.hannula at iki.fi>
>>> wrote:
>>>> On 24.03.2011 16:18, pl bossart wrote:
>>>>>> It seems that 384k sample rates aren't supported directly in alsa, I
>>>>>> did
>>>>>> some patching to no avail yet.
>>>>>>
>>>>>> In any case if the channel count can be specified with passthrough the
>>>>>> following should work.
>>>>>>
>>>>>> paplay --raw --channels=2 --rate=192000 --passthrough
>>>>>> File.dts.spdif192khz (
>>>>>> this works).
>>>>>>
>>>>>> paplay --raw --channels=4 --rate=192000 --passthrough
>>>>>> File.dts.spdif384khz (
>>>>>> this fails).
>>>>>>
>>>>>> To passthrough dolby true-hd it looks like it'll be necessary for more
>>>>>> than
>>>>>> two channels to work.
>>>>> There was a thread on dts-hd in alsa-devel at some point. Anssi
>>>>> (cc:ed) contributed some patches for HDMI and provided the information
>>>>> below on ffmpeg configurations.
>>>>> You may want to try at the alsa level before trying with pulseaudio to
>>>>> make sure your setup is correct. I tend to believe you have to go for
>>>>> 8ch @ 192kHz to make this work based on my limited understanding of
>>>>> HBR.
>>>> Indeed for HBR you need to always specify 8 channels and use rate to
>>>> control the final rate (i.e. you either use "normal" 2 channel
>>>> passthrough or HBR 8 channel passthrough).
>>>>
>>>> For example to passthrough the abovementioned 384 kHz stream you need to
>>>> use 8 channels and rate of 96000. However, I think 384kHz DTS bitstream
>>>> is generally *not* supported by A/V receivers, so you probably want to
>>>> use 768kHz (8 channels, 192kHz).
>>>>
>>>> (note: I haven't tested whether HBR works with pulseaudio or not)
>>>>
>>>>
>>>>> The DTS-HD part is not merged yet (patch is in ffmpeg-devel@), but the
>>>>> TrueHD and E-AC-3 support is already there in ffmpeg trunk.
>>>>>
>>>>> The ffmpeg commandline to use is:
>>>>> ffmpeg -i input.file -f spdif output.spdif
>>>>>
>>>>> For DTS-HD files, to get full passthrough (i.e. not only core), a
>>>>> -dtshd_rate parameter is needed, which sets the output IEC958 rate.
>>>>> ffmpeg -i input.file -f spdif -dtshd_rate 192000 output.spdif
>>>>> ffmpeg -i input.file -f spdif -dtshd_rate 768000 output.spdif
>>>>> 192000Hz is enough for streams that have a bitrate below 6.144Mbps,
>>>>> which
>>>>> means all DTS-HD High Resolution Audio files and even many of the DTS-HD
>>>>> Master Audio (the latter are lossless VBR).
>>>>>
>>>>> To play the spdif files back, I use
>>>>> aplay -D hdmi:CARD=$CARDNAME,DEV=$DEVICENUM,AES0=0x06 -c $CHANCOUNT -r
>>>>> $RATE file.spdif
>>>>>
>>>>> - replacing $CARDNAME with the card name
>>>>> - replacing $DEVICENUM with 0..3 depending on card and hdmi port (for
>>>>> non-zero DEVICENUM you'll need a patch from alsa git:
>>>>>
>>>>> http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=e6d5dcf1f625984605d362338d71162de45a6c60
>>>>> )
>>>>> - set $CHANCOUNT and $RATE as per below
>>>>> - rate 192000 and channels 2 for IEC958 rate 192 kHz (for e.g. 48 kHz
>>>>> E-AC-3, and DTS-HD when the IEC958 rate was set to 192000 in ffmpeg)
>>>>> - rate 192000 and channels 8 for IEC958 rate 768 kHz (for most TrueHD
>>>>> files, and for DTS-HD when the rate was set to 768000)
>>>>> - note that having the 0x02 bit (non-pcm) set in AES0 is mandatory when
>>>>> $CHANCOUNT is larger than 2, as ALSA uses it to determine whether to use
>>>>> HBR or not. The additional 0x04 (non-copyright) I use above is not
>>>>> mandatory, but is the alsa default so I kept it.
>>>> --
>>>> Anssi Hannula
>>>> _______________________________________________
>>>> pulseaudio-discuss mailing list
>>>> pulseaudio-discuss at mail.0pointer.de
>>>> https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
>>>>
>>> Would anyone know where I could get a hold of some DTS-HD samples in
>>> 192Khz and 384kHz for testing?
>> You can extract the dts-hd tracks from your mkv's with mkvextract. You can
>> make them with spdifer (part of AudioFilter).
>>
>>
>>> _______________________________________________
>>> pulseaudio-discuss mailing list
>>> pulseaudio-discuss at mail.0pointer.de
>>> https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
>> _______________________________________________
>> pulseaudio-discuss mailing list
>> pulseaudio-discuss at mail.0pointer.de
>> https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
>>
> Unless I am missing something all the movies I play say 48kHz on my
> receivers OSD when played through my PS3 so I thought that was the
> best they have, and higher was not used on average Blu-Ray's.
The original samples are taken at 48khz and then compressed into dts or
dts-hd. AudioFilter is muxing the dts/dts-hd packets into zero padded
packets that contain the dts/dts-hd stream. A typical dts-hd stream is
going to have packets around the 8k size. If it is muxed at 192khz
packets that exceed it's size limit will be clipped. In my experience I
was seeing maybe 200 bytes dropped on some packets. Now if you mux it
at 384khz you effectively double the size of the packets that can be
sent to the receiver and you don't have to resort to clipping.
In a nutshell the 192khz and 384khz rates are spdif muxed rates not the
original sample rate.
More information about the pulseaudio-discuss
mailing list