DennisJ
DennisJ

Reputation: 11

FFmpeg - how to set output sample_size

Trying to create a simple command line player for .dsf (DSD audio) files, and output to an alsa device that supports up to 24-bit 192 kHz sample rate. The following command almost works and it does play the track. Examining the bold text below, the dsf input file is converted to 24-bit/192 kHz, but the output is then truncated to 16-bit 192 kHz (pcm_s16le i.e, 16 bit little endian).

ffmpeg -i '01 - Sweet Georgia Brown.dsf' -f alsa hw:0,0

After displaying the ffmpeg banner and song metadata (tags), here is the result, bold is my emphasis:

Duration: 00:05:14.83, start: 0.000000, bitrate: 9234 kb/s Stream #0:0: Audio: flac, 192000 Hz, stereo, s32 (24 bit)
Stream mapping: Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, alsa, to 'hw:0,0':

Since I can play this and many other tracks at full resolution using another player (foobar2000) it seems there might be an option in the encoder which is part of FFmpeg: Lavf57.83.100 I can find no information in any of the FFmpeg documentation that helps. Tried finding options in FFplay and even guessing using other FFmpeg options like this example.
ffmpeg -sample_fmt s24 -i '01 - Sweet Georgia Brown.dsf' -f alsa hw:0,0 ***** same results.

I'm stuck. Any suggestions?

Environment: Linux Mint 19.2, 64-bit, ASUS Xonar STXii sound card.

Upvotes: 1

Views: 1746

Answers (1)

Gyan
Gyan

Reputation: 93329

Each output format or device has a default encoder registered for each media type it accepts. ALSA accepts audio and its default encoder is 16-bit signed PCM.

You can change the encoder by specifying one.

ffmpeg -i '01 - Sweet Georgia Brown.dsf' -c:a pcm_s24le -f alsa hw:0,0

Upvotes: 0

Related Questions