omxplayer is good command line player, will be suing it for streaming videos on Pi, it also support hardware decoding. and also with omxplayer you do not even need to run GUI to watch videos on pi on the console.
$ sudo apt-get install omxplayer
The livestreamer utility helps simplify the process of downloading video from UStream and other video stream providers. It does the processing and converts stream to a standard video file that can be sent to a player like omxplayer.
$ sudo apt-get install python-pip
$ sudo pip install livestreamer
In order to access ustream’s HD streams, Livestreamer needs python-librtmp, which also is available using pip
. The library needs cffi, so we have to install its dependencies, too. They are python2.7-dev
and libffi-dev
. python-librtmp
needs librtmp-dev
.
sudo apt-get install python2.7-dev libffi-dev librtmp-dev
After installing those development headers, we can install cffi
and python-librtmp
.
sudo pip install cffi
sudo pip install python-librtmp
Once that is done, Livestreamer can be installed.
sudo pip install livestreamer
NOW START AND RUN THE STREAMING WITH
$ livestreamer http://ustream.tv/channel/iss-hdev-payload mobile_480p --player omxplayer --fifo
The command that combines livestream and omxplayer and starts the ISS stream in full screen mode is as follows:
$ livestreamer http://ustream.tv/channel/iss-hdev-payload mobile_480p --player omxplayer --fifo \ > --player-args "--win \"0 0 1600 1200\" {filename}"
Finally
To avoid having to manually restart the process each time it stops, a wrapper bash script can be created to do this for us:
#!/bin/bash while true do livestreamer http://ustream.tv/channel/iss-hdev-payload mobile_480p --player omxplayer --fifo --player-args "--win \"0 0 1600 1200\" {filename}" done
so If above file is named iss-streamer make it executable and run it as command:
$ chmod +x iss-streamer $ ./iss-streamer
I thought it would also be useful to have the stream autostart when the Pi is plugged in, so that it can run completely unattended. This is achieved by adding the command to the /etc/rc.localfile, right before the exit 0 line: # start the ISS video stream sudo -u pi /home/pi/iss/iss-streamer >/dev/null 2>&1 &
THANKS TO:
https://blog.miguelgrinberg.com/post/watch-live-video-of-earth-on-your-raspberry-pi/page/0#
For fixing the issues with python-librtmp, thanks — https://cooco.de/installing-livestreamer-with-ustream-support-on-ubuntu-1404.html
Thanks for all the work to update this. I keep getting 2 errors when I try to run the livestreamer code. The first one says there is no stream at that URL. If I try again, it says there was a bad handshake. Ideas? Thanks!
LikeLike