checking bit-perfect playing by log

Need help with MPD?
Post Reply
lulumeya
Posts: 4
Joined: July 4th, 2019, 3:03 am

checking bit-perfect playing by log

Post by lulumeya » July 4th, 2019, 4:05 am

Jul 04 12:01 : ffmpeg: detected input format 'mov,mp4,m4a,3gp,3g2,mj2' (QuickTime / MOV)
Jul 04 12:01 : ffmpeg/mov,mp4,m4a,3gp,3g2,mj2: Before avformat_find_stream_info() pos: 31974 bytes read:34485 seeks:0 nb_streams:1
Jul 04 12:01 : ffmpeg/mov,mp4,m4a,3gp,3g2,mj2: format: start_time: 0.000 duration: 181.742 bitrate=321 kb/s
Jul 04 12:01 : ffmpeg/mov,mp4,m4a,3gp,3g2,mj2: After avformat_find_stream_info() pos: 32902 bytes read:34485 seeks:0 frames:1
Jul 04 12:01 : decoder: audio_format=44100:f:2, seekable=true
Jul 04 12:01 : alsa_output: format=S32_LE (Signed 32 bit Little Endian)
Jul 04 12:01 : output: opened plugin=alsa name="SABRE ESS 9038 PRO" audio_format=44100:32:2

this is my log.
How can I know that I am playing bit-perfectly?

max
Forum team
Posts: 899
Joined: January 15th, 2013, 3:43 pm

Re: checking bit-perfect playing by log

Post by max » July 4th, 2019, 6:53 am

Code: Select all

decoder: audio_format=44100:f:2
output: opened plugin=alsa name="SABRE ESS 9038 PRO" audio_format=44100:32:2
This is not bit-perfect; FFmpeg provides 32-bit floating point samples, which your sound chip cannot play, so MPD converts to 32-bit integer, which is the best approximation suported by your sound chip.

But the worst problem is that you're using a lossy codec. Can't argue about bit-perfectness when the source file is lossy.

lulumeya
Posts: 4
Joined: July 4th, 2019, 3:03 am

Re: checking bit-perfect playing by log

Post by lulumeya » July 4th, 2019, 7:23 am

Yes, I am streaming from a service which only supports only lossy files, but I just want to play without any converting.
So, If I want to send file directly without converting, which configuration changes I have to make?
I am gonna try to set mixer_type="none", Am I pointing right direction?

max
Forum team
Posts: 899
Joined: January 15th, 2013, 3:43 pm

Re: checking bit-perfect playing by log

Post by max » July 4th, 2019, 9:12 am

lulumeya wrote:
July 4th, 2019, 7:23 am
So, If I want to send file directly without converting, which configuration changes I have to make?
Can't. Your sound chip is unable to play floating point, and since all MPD gets from FFmpeg is floating point, you can't configure anything to prevent the conversion to integer samples. At some point, it needs to happen.
But really, don't mind this conversion. The fact that FFmpeg returns floating point is just an implementation detail. In most lossy codecs, the term "bit depth" is just not applicable, it does not make sense, and codec implementations (such as FFmpeg) can choose to return whatever sample format they want. FFmpeg just happens to choose float, which is a good choice, because that is usually what the codec uses internally, and returning it directly avoids one stage of unnecessary conversion. This conversion may happen later, but it's good to postpone it to when you're really sure you can't avoid it. And when it happens, the software can then choose the best sample format supported by your sound chip without chopping away too many bits of precision, and 32 bit integer is the next best choice.
Remember that for the human ear, having more than 16 bits of precision is useless; of course, chaining several processing stages together accumulates to some precision loss, but with 32 bit float and 32 bit integer, you have lots of spare bits, and you can be sure nothing audible is lost.

Post Reply