[FFmpeg-user] Feeding SPDIF from ffmpeg (Was: Re: Ingest of SMPTE-377M)

Moritz Barsnick barsnick at gmx.net
Thu Jan 7 23:30:02 CET 2016

On Thu, Jan 07, 2016 at 14:28:29 +0000, Carl Eugen Hoyos wrote:
> Moritz Barsnick <barsnick <at> gmx.net> writes:
> EAC3, TrueHD and DTS-HD are only supported via HDMI, 
> AC3 and DTS (without HD) work both via HDMI and TOSLINK.


> > Now I need to know how to output raw DTS or raw SPDIF 
> > to my PC's SPDIF dongle. 
> See my earlier email in this thread, replace eac3 
> with ac3 and 192k with 48k and choose the correct 
> alsa device, could be hw=0.1.

I got it to work as such (generator and encoder piped to an extra
command for feeding alsa):

$ ffmpeg -f lavfi -i sine=200 -f lavfi -i sine=390 -filter_complex amerge -map "[a]" -c:a dca -strict experimental -ac 2 -ar 48k -f spdif - \
  | ffmpeg -f s16le -ac 2 -ar 48k -i - -c:a copy -f alsa hw:2,0

SPDIF over TOSLINK only supports up to 48k sample rate? I thought I had
read differently, but my memory is really bad (see below).

My audio player recognizes this as "dts". Funnily, if I use "ac3" as
ffmpeg's codec in the first command, it also plays fine, but *doesn't*
say "Dolby Digital" as it usually would. (Neither if I use six channels
via amerge=inputs=6.) *sigh* Whatever, should be fine all the same. It
*must* be Dolby. If I feed the "ffmpeg SPDIF to ALSA feeder" with:
$ ffmpeg -i Test\ AC3\ v2.0.avi -map 0:a -c:a copy -f spdif -
it does say "DD Digital" on the display. Must be something in the
stream AC3 perhaps?

Thanks so much!

By this, I can also confirm that MP3 or MP2 in SPDIF doesn't work for
me, which was the whole point of this experiment.


More information about the ffmpeg-user mailing list