Saturday, September 28, 2019

Raspberry Pi 4 as a Media Player

I've bought Raspberry Pi 4 to use it as a DaaS (Desktop as a Service). I've needed a VPN server to securely connect to when I am traveling. I've needed a Cloud Server to replace Dropbox to have unlimited space. I've needed a NAS (Network-attached storage) to share files among mu laptops and computers. I've also needed a Music Player Server to manage my music files and serve as a source for my amplifier. I've also needed a media player like Apple TV to play my movies, youtube etc.

In summary Raspberry Pi as:
1. Cloud server
2. VPN server
3. NAS
4. Music server
5. Media Player (this post)





To be able to do all of the above, I think it is better to keep the original Raspbian distribution. RP 4 is much faster than other RPs however it is still too slow for playing videos in 4K. I found Kodi very slow on RP 4. VLC is performing well if you overclock CPU and GPU and set the memory for GPU higher than default. RP 4 CPU gets hot easily so in order to overclock it I bought a small fan for it and since I wanted to mount ALLO DigiOne HaT on top of it I bought pin header.

sudo emacs /boot/config.txt

Add the following (warning overclocking is never recommended!)

over_voltage=4
arm_freq=2000
gpu_freq=600
gpu_mem=512


reduce your screen resolution.

if you want to play a file using ssh remotely use the following:

 export DISPLAY=:0
 vlc -f file.mp4

to be able to control VLC remotely in preferences>>show all>>Main interfaces check Web and set a password for Lua HTTP

best remote app for VLC can be found here:
https://hobbyistsoftware.com/VLC-more


If you want to control your TV using HDMI cable:

sudo apt install cec-utils
echo 'scan' | cec-client -s -d 1

for turning on the TV:
echo 'on DEVICE_NUMBER' | cec-client -s -d 1


for more info: https://www.linuxuprising.com/2019/07/raspberry-pi-power-on-off-tv-connected.html