Archive

Archive for July, 2014

YouTube on the Raspberry Pi At Last

July 12th, 2014 subogero Comments off

To cut a long story short: YouTube finally works in HD on my TV with RemotePi. I can’t stop watching LaFerrari and McLaren P1 videos in HD with great sound!

Why was it so difficult?

In the old times, youtube-dl -g spat out YouTube stream URLs, and omxplayer could play them straight away. The excellent ncurses based yt worked this way. But things have changed. YouTube now only streams the video if a session cookie is presented. But omxplayer can’t use cookie jars.

But curl can! We tell youtube-dl to save the cookie, and let curl save/stream the video using the cookie.

curl -b jar `youtube-dl -g --cookies jar --write-thumbnail`

will spit out the video stream.

1st Attempt – Save to File

Let curl save to a file, and start omxplayer a few seconds later to play it back. Keep fingers crossed that curl saves faster than omxplayer reads.

It does not. This solution is so disk/sdcard IO intensive, that omxplayer will reach the EOF too soon and exit.

2nd Attempt – Stream via FIFO

Let’s create a FIFO file, and let curl write the video stream into that. And start omxplayer immediately to read the video stream from the FIFO. It works beautifully:

  • there is no disk IO at all, so curl writes faster than omxplayer reads
  • even if it’s not the case due to a slow network, the player does not exit, just blocks until curl catches up. Bacause the FIFO is a character device!
  • if omxplayer exits for any reason, curl gets a SIGPIPE and exits too

The Result – rpyt

It’s all wrapped up in a new script packaged with omxd: rpyt.

And the RemotePi remote-control web-app also uses that from now. See the project homepage and the code on Github.

RemotePi Cover Art

July 8th, 2014 subogero Comments off
Avi Nissim and Lior Perlmutter

Avi Nissim and Lior Perlmutter

This is the current state of RemotePi. Note the progress bar for the current track (fully text based), and the cover art. Involving no MP3 tags, no 3rd party databases, just good old directories and files.

Also note my current taste in music. Most say it’s crap. Others say it’s fun. It’s definitely controversial and definitely not mainstream.

Quiz: What model is the phone used as remote control?

Categories: Uncategorized Tags: