masmu / pulseaudio-dlna

A lightweight streaming server which brings DLNA / UPNP and Chromecast support to PulseAudio and Linux
GNU General Public License v3.0
1.25k stars 162 forks source link

MP3 streams always are re-encoded with reduced sound quality #372

Open Wasnix opened 5 years ago

Wasnix commented 5 years ago

Playing MP3 files will always re-encode stream because there is missing a null-codec. No way to keep quality.

Output of pulseaudio-dlna while streaming MP3:

... pulseaudio_dlna.streamserver INFO Starting processes "parec --format=s16le -d my_dlna.monitor | lame -b 192 -r -" ... LAME 3.100 64bits (http://lame.sf.net) Using polyphase lowpass filter, transition band: 18671 Hz - 19205 Hz Encoding to Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (7.3x) 192 kbps qval=3 ...

pulseaudio-dlna does double re-encoding. Each MP3 stream is re-encodec by parec to PCM (s16le wave) and then piped to lame and re-re-encoded back to MP3 (192 bit). This will reduce sound quality.

It's easy to keep quality with a null codec. In case of MP3 streams/files you should replace selected MP3 encoder by your '_pulseaudiodlna.encoders.NullEncoder' as you've already done with OGG streams/files.

felagund commented 5 years ago

Would also save some cpu cycles.