Streaming NASA ISS live on Raspberry Pi

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-librtmpneeds 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

PI Streaming youtube twitch

put it in /usr/local/bin/

#!/bin/bash
#Different formats are: 18-360p, 22-720p, 37-1080p
omxplayer -o hdmi $(youtube-dl -g "$1") #Standard definition
#omxplayer -o hdmi $(youtube-dl -f 22 -g "$1") #720
#omxplayer -o hdmi $(youtube-dl -f 37 -g "$1") #1080

#tip
#after executing ./ytcli enter "chosen_url"

 

 

Continue reading “PI Streaming youtube twitch”

Write raspian image to sdcard

  • Format the SDcard before installation, if needed.

  • First, find out which device (/dev/sd??) your USB stick or Sdcard is. then look at the output of
    sudo fdisk -l
    
  • After that unmount the device/partition (if necessary) by running
    sudo umount /dev/sd??
    
  • To format The partition as FAT32 use
    mkdosfs -F 32 -I /dev/sd??
    

    Again replace ?? with your respective letters.

 

 

Write raspian image to sdcard

$df
$ dd bs=4M if=2016-11-25-raspbian-jessie.img of=/dev/mmcblk0
 

To see the progress of the copy operation, run pkill -USR1 -n -x dd in another terminal, prefixed with sudo if you are not logged in as root. The progress will be displayed in the original window and not the window with the pkill command;

  • Run sync; this will ensure the write cache is flushed and that it is safe to unmount your SD card.
  • Remove the SD card from the card reader.

Small Note: if you’re running dd to either format or write images to large SDcard, you may like to see more frequent progress bar. DO THIS.

watch -n1 -x command ##to AUTOMATICALLY repeat 'pkill -USR1 -n -x dd' COMMAND every -N seconds,
watch -n30 -x pkill -USR1 -n -x dd

##rerun the above command every 30s which updated the dd progress bar, especially relevent for the big storage Drives & SD cards.
##works for all dd commands
##see more in watch [options] commands.

thanks to