Category Archives: Raspberry Pi
TNG LCARS NASA HDEV live stream viewer.

So I enjoy watching the NASA’s High Definition Earth-Viewing System (HDEV) live stream on ustream and NASA’s page.

however I don’t like to have to keep a window on my browser dedicated to viewing this. So I decided to build a viewer box with a raspberry pi. So I can put it on my already cluttered desktop but have a constant view of the stream. The stream will drop out/black out depending on the position of the International Space Station (ISS). I also am a trekkie , so I decided to combine the two together. So I feel like I’m on the Enterprise of TNG watching earth , much like the movie “First Contact.”

Here is the final result:

File 4-18-16, 20 21 57

 

 

 

 

 

 

 

 

 

 

 

 

 

So what did I use?

Hardware:

  1.  Raspberry Pi B+ (cause I had some lying around from a previous project)
  2.   7 Inch HDMI Screen.  (any screen would do but I wanted a small screen factor so I could position it on my desk among the other things )

Software:

  1. Jessie Lite ( I wanted to run the Raspberry in a minimal configuration and not use the X-windows, so I went no X windows , Jessie Lite)
  2. OMX Player (this is the actual core player playing the video feed and the background. -I’ll explain more later)
  3. libav-tools (mainly avconv to create a looping video of the LCARS background)
  4. livestreamer (the grab the stream of the ustream.tv NASA channel and feed it to omxplayer)

Once it ran , it seemed simple but the process wasn’t.

Initially I thought of just building a raspberry pi with a TFT shield , running the Iceweasel browser in full screen. This was a long road into the abyss, the TFT shield I have did not like the frame buffer output , Iceweasel can’t play the ustream etc etc…Now there might be a way but I also felt it was a bit of overkill for a simple stream viewer to have a full X-windows+browser setup. So omxplayer to the rescue.  With omxplayer I can still view the stream via live streamer without having to boot fully into a x-windows environment.

So based on the Miguel Grinberg’s blog post about building a raspberry pi NASA live stream viewer , the first step it to set up  livestreamer to capture the NASA’s stream and hand it over to omxplayer.

#!/bin/bash
while true 
do
livestreamer http://www.ustream.tv/embed/17074538?html5ui mobile_478p –player omxplayer –fifo –player-args “–win \”75 110 710 564\” {filename} –layer 20″
done

So , livestreamer grabs the mobile_478p stream and passes it to the omxplayer and creates a window(size 710 x 564, at the position x=75,y=110)

Now to make the video play inside the LCARS container , its actually 2 layered videos. The lower video  is a loop video (mkv) of the LCARS interface generated by using avconv.

sudo avconv -loop 1 -i lcars.png -tune stillimage -t 10 -y -r 5 lcars.mkv

So the idea is that the lcars.mkv is playing at a lower layer and the NASA feed is on top of that video. (thanks to Brad’s Blah Blog for the idea)

lcars2

basic LCARS image. (lcars.png)

This is were the omxplayer “–layer” option comes in, the higher the number , the closer to the screen the video play is. So the LCARS video plays on layer 10 and the NASA video plays on layer 20. Now since the LCARS interface is just there as a container this video does not have to loop indefinitely , so I decided to pause it after it loads. So using FIFO file , I send a “p” to the player causing to the stream to pause. (updated: I realised I could use the fbi image viewer to layout the background  instead of using 2 instances of omxplayer, the background generating one tended to crap out randomly anyway . )

so the final script to launch the viewer is:

#!/bin/bash

while true
do

livestreamer http://www.ustream.tv/embed/17074538?html5ui mobile_478p –player omxplayer –fifo –player-args “–win \”75 110 710 564\” {filename} –layer 20″

done &

sudo fbi -T 1 –noverbose –fitwidth –autozoom /home/pi/lcars.png

#mkfifo t

#cat t | omxplayer –loop lcars.mkv –layer 10 &

#sleep 1s

#echo p >t

#rm t

 

The last step was to adjust the positioning of the NASA video feed so it would play inside the black container area of the LCAR’s video. After some tweaking I settled on on

–win (omxplayer window positioning option) \”75 110 710 564\”   = Postion the video at x=75 from the left of the screen, y=110 from the top of the screen, size 710 x 564.

added the the script to the profile of the user “pi”and enabled autologon so the viewer would automatically boot overtime I reboot the pi. And now I have a ISS HDEV LCARS viewer.

References:

File 4-18-16, 20 22 19