mardi 22 septembre 2020

 MPD et les streams Radio France

J'utilise MPD sur un raspberry conjointement avec l'interface web mympd.
J'écoute principalement des streams de Radio France en haute qualité (AAC 192 kbs) et depuis quelques semaines et le matin seulement je constate des coupures du son voir l'abandon par MPD du stream qui passe au suivant de la playlist.

J'ai corrigé ce problème en remplacent le plugin d'entrée curl par ffmpeg
J'ai modifier le plugin d'entrée:
input {
        plugin "ffmpeg"
}
 
#input {
#        plugin "curl"
#}
... et ça ne résou rien :(
 
J'ai regardé les paquets TCP échangés. 
J'ai remarqué que le dns renvoyé plusieurs adresses IP pour le serveur radiofrance:
Première essai de connexion: 
Domain Name System (response)
Transaction ID: 0xbeed
Flags: 0x8180 Standard query response, No error
Questions: 1
Answer RRs: 7
Authority RRs: 0
Additional RRs: 0
Queries
Answers
icecast.radiofrance.fr: type CNAME, class IN, cname icecasta.prods1public.radiofrance.fr
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 163.172.182.190
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 51.158.65.164
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 212.47.251.152
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 51.158.117.244
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 51.158.104.58
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 163.172.145.72
[Request In: 1]
[Time: 0.027922000 seconds]

le player utilise la dernière proposée:
-> icecasta.prods1public.radiofrance.fr: type A, class IN, addr 163.172.145.72

Deuxième essai de connexion:
Domain Name System (response)
Transaction ID: 0x101d
Flags: 0x8180 Standard query response, No error
Questions: 1
Answer RRs: 7
Authority RRs: 0
Additional RRs: 0
Queries
Answers
icecast.radiofrance.fr: type CNAME, class IN, cname icecasta.prods1public.radiofrance.fr
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 163.172.182.190
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 51.158.117.244
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 51.158.104.58
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 163.172.145.72
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 51.158.65.164
icecasta.prods1public.radiofrance.fr: type A, class IN, addr 212.47.251.152
[Request In: 1]
[Time: 0.026924000 seconds]


le player utilise la dernière proposée:
 -> icecasta.prods1public.radiofrance.fr: type A, class IN, addr 212.47.251.152 
 
Je pense que le player web du site radiofrance "jongle" avec ces adresses pour utiliser le serveur le plus disponible au lieu de prendre le dernier..
Un coup d'oeil sur les paquets échangés lors de l'utilisation du player web, montre des échanges bien plus complexes.
Le player fini par utiliser 2.21.132.169 comme serveur de stream, soit : a2-21-132-169.deploy.static.akamaitechnologies.com  ...
 

 


 

jeudi 10 septembre 2020

Music Player Daemon build on Raspberry Pi

Build MPD from sources on Raspberry Pi 

Original post here:

Get the sources:

git clone https://github.com/MusicPlayerDaemon/MPD.git 
cd MPD 

Get all necessary dependencies

sudo apt-get install g++ \
  libpcre3-dev \
  libmad0-dev libmpg123-dev libid3tag0-dev \
  libflac-dev libvorbis-dev libopus-dev \
  libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
  libfluidsynth-dev libgme-dev libmikmod2-dev libmodplug-dev \
  libmpcdec-dev libwavpack-dev libwildmidi-dev \
  libsidplay2-dev libsidutils-dev libresid-builder-dev \
  libavcodec-dev libavformat-dev \
  libmp3lame-dev libtwolame-dev libshine-dev \
  libsamplerate0-dev libsoxr-dev \
  libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \
  libzzip-dev \
  libcurl4-gnutls-dev libyajl-dev libexpat-dev \
  libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \
  libpulse-dev libshout3-dev \
  libsndio-dev \
  libmpdclient-dev \
  libnfs-dev libsmbclient-dev \
  libupnp-dev \
  libavahi-client-dev \
  libsqlite3-dev \
  libsystemd-dev libwrap0-dev \
  libgtest-dev \
  libboost-dev \
  libicu-dev \
  libgcrypt-dev \
  libsidplayfp-dev

Install messon and ninja tools:

sudo apt-get install python3 python3-pip ninja-build
sudo pip3 install meson 

Stop mpd service:

sudo service mpd stop 

Compile mpd:

meson . output/release --buildtype=debugoptimized -Db_ndebug=true
meson configure output/release
ninja -C output/release
sudo ninja -C output/release install  
  • mpd is in ./output/release
  • service files are ./output/release/systemd
  • use the mpdconf.example in ./doc for configuration

Workarrounds and errors:

mpd binary is located in /usr/local/bin and this mpd binary try to open mpd.conf located in /usr/local/etc NOT in usual folder /etc

So, you have to link these file and folder:

sudo mv /usr/bin/mpd /usr/bin/mpd_old
sudo ln -s /usr/local/bin/mpd /usr/bin/mpd

Check if folder /usr/local/etc already exists:

ls /usr/local

If an etc folder exists, rename it to etc_bak

sudo mv /usr/local/etc /usr/local/etc_old

Link etc folder:

sudo ln -s /etc /usr/local

move old etc files to linked folder:

sudo mv /usr/local/etc_old/* /usr/local/etc