Posts Tagged ‘omxd’

omxd Debian package

January 1st, 2015 subogero Comments off

I’m through my most swearword-intensive development ever: creating a Debian package from the omxd Raspberry Pi media-player daemon. Debian developers take note: if strange freak-accidents happen to you and your families, it’s my fault. I’m currently being treated with post-traumatic stress disorder and want to forget the whole experience.

Except, I decided to write down the most interesting stations of my journey through the Valley of the Shadow of De… Debian. Documentation is available but hard to find, as most Google hits are about using deb packages, not creating them.

If you are an experienced Debian developer and find that I’m a noob, an idiot and a luser, you’re right. But then, why does Linus Torvalds refuse to provide SubSurface binaries for Linux? Exactly. Because he did not let his brain rot by thinking that creating deb or rpm packages is something sane. And no, the problem is not fragmentation. Once you’ve created you deb package, alien will turn it into and rpm in no time. It’s creating the deb that’s so difficult.

Init Scripts

Originally make install just inserted an omxd call into /etc/rc.local and started omxd. But better don’t mess with existing files, so I changed it to create /etc/init.d/omxd with start/stop/restart verbs and registered it for auto-start by

update-rc.d omxd defaults

and finally doing a

service omxd start

How naive I was…

Automated Releases

I copied the make tag rule from szg, which creates releases, where the tag message is a commit list in Debian changelog format.


In your Makefile, use the $(DESTDIR) prefix whereever you install something.

cp omxd $(DESTDIR)/usr/bin


I did not remember this, but this file is needed with a list of directories you install files into. Note the lack of leading slash:



Lintian throws an error that you need a force-reload verb in your init script. So I gave in.

Auto start/restart/stop omxd – The Real Troubles Begin

Having make install starting and registering your daemon does not help. dpkg-buildpackage just uses this rule to collect the installed files. Later when the deb is installed, it’s not run. You need a debian/postinst maintainer script to do a

service omxd start

But during upgrades you need to stop it first, so add prerm and preinst scripts too with

service omxd stop


But a reinstall/upgrade will fail if your init script returns an error when attempting starting an already started daemon or stopping an already stopped one or trying to do anything with a non-existing one. So make sure they are idempotent: running them repeatedly has no effect at all, not even an error. In case of preinst:

service omxd stop || true

Also make sure the init scripts start/stop verbs don’t fail for these cases.

debian/conffiles, Bloody conffiles

dpkg-buildpackage considers anything you install into the /etc directory a configuration file and adds them automatically to the debian/conffiles file. Result: if you develop something using make install/uninstall, then install the deb package again, dpkg will refuse to install the those files, because their lack is a modification by the sysadmin. Unbelievable but true. And there is no obvious workaround, either. All you can do, and this is confirmed by the Debian docs, is to create anything in /etc by the debian/postinst script.

There are no words for the idiocy of the Debian conffiles policy. How often have you been prompted by Ubuntu/Debian package upgrades about mysterious config file changes you’ve never ever touched? It’s all because it’s so difficult to get it right.

And why is anything in /etc added to conffiles with no possibility to override? Sure, /etc/init.d/omxd is a config file. But it’s the init system’s config file, not mine!

And Finally, lintian

I used lintian. Did it complain about the lacking debian/omxd.dirs file? No. Did it warn me about the auto-start idempotency problems? No. Did it complain about a completely useless force-reload initscript verb? Yes. Did it complain about the lack of all the useless and paranoid GCC warning options in my makefile? Yes. And finally did it throw an error upon the only existing workaround for the conffile-hell? Yes.

Lintian is a useless piece of shite. I threw it out.

make utag

During packaging I had to undo release commits and tags countless times. I even automated it with make utag.


The Debian packages for omxd and the latest stable omxplayer are available in my repo. Just add it to your software sources by adding the file /etc/apt/sources.list.d/subogero.list containing this:

deb /

The install

apt-get update
apt-get install omxd

I’m also accepting donations for my post-traumatic stress disorder treatment on my PayPal account.

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.

The (semi) Ultimate YouTube Party

February 7th, 2014 subogero Comments off


YouTube parties have a few flaws. Five to ten people gather around a small laptop, an even smaller tablet or a tiny smartphone. Nobody can see the screen really well. It’s no biggie, actually, as nobody cares for videos someone else wants to show. You only want to show off yours. And here is the problem:

You have to wait until the end of that lame boring clip, just to start the search for that brilliant masterpiece you’ve come across last night.

And that’s where remotepi and youtube-dl come for the help of the party, to fix the small problem and the big problem. First, the actual video is played on your huge flatscreen TV by the Raspberry Pi. Second, everyone can search for the next clip on their mobile phones in the meantime!

Head to the homepage or to solve your YouTube problems.

And why semi-ultimate? Erm, a few small problems. The omxd playlist daemon may or may not work properly with the freshest omxplayer. Also, a few video URLs can’t be played by the latter, probably due to authentication problems. But give it a try, anyway.

Categories: Uncategorized Tags: , ,

My Raspberry Pi Media Player Suite

September 26th, 2013 subogero Comments off
RemotePi screenshot

RemotePi browsing music

My Raspberry Pi media player suite has reached a generally usable level. At the bottom of the stack there is omxplayer, then the omxd playlist daemon, the command-line internet radio player and, finally, RemotePi the remote control web-app, optimized for smart-phone screens.

Check out its home page.

Why Not XBMC?

I admit I suffer from severe NIH (Not Invented Here) symptoms. But this time, I actually tried to install XBMC from Michael Gorven’s Debian package. But what do I see?

I need to get 44 MB of archives. 120 MB additional disk space will be used. RemotePi, and omxd are 3 MB including all sources, all binaries and all git repositories.

And lo and behold, who are among the dependencies?

  • qt3
  • mysql-common
  • samba-common-bin

Come on! I never use my Raspberry’s GUI. All the GUI RemotePi has is a web-app.

MySQL? Probably a sign of a nice tag-based media library which, in real life, is an absolute pain in the neck to use. You have a DJ-set album, from all sorts of different artists, and a tag-based player just refuses to play it in the order intended by the DJ. I’ll stick to my files and directories, thank you very much.

Samba? I’m one of those smug Penguinistas whose home is Windows-free. So no thanks.

RemotePi omxd

September 26th, 2013 subogero Comments off
Controls and playlist

Controls and playlist

My Raspberry Pi media player suite.


Browse music/videos, internet radio stations and even YouTube on your Raspberry Pi and play them on your audio system or non-smart HDMI TV.

Control everything from your smartphone via the RemotePi web-app. You don’t need an extra remote control, you don’t need SSH, you don’t need to connect physically to the Raspberry Pi, and you definitely don’t need to start the GUI.


RemotePi uses the omxd/omxplayer backend.

Show what omxd is playing now, including album art or YouTube thumbnail and actual/overall clip time.

Limit file browsing within the Raspberry Pi’s file system to a root directory specified in a config file /etc/remotepi.cfg.

Insert, add and append files, directories or internet radio streams to the omxd playlist.

You can even interrupt the playlist to play a single file or a YouTube clip. The playlist resumes after the end of the movie.

Control buttons: Play/pause/stop playback, or navigate in the playlist with repeat, previous/next, Rewind/FastForward 30/600s, or previous or next album buttons.

Delete actual track or entire playlist.

Cycle through subtitles and soundtracks, switch audio output to HDMI of Jack.

RemotePi is strictly file and directory based and could not care less for MP3 tags in files. It does not use 3rd party databases for metadata, except for internet radio. Best used with a nicely arranged folder structure.

Browsing files

Browsing files

Goa internet radio stations

Goa stations

Watch YouTube on your TV

Watch YouTube on your TV


Source code and installation instructions on Github.


RemotePi is a single HTML5 webpage, you load it once and then it communicates with the Raspberry Pi with AJAX calls using JavaScript. It won’t work it JavaScript is disabled.


From rg3, RemotePi uses this program to extract direct stream links from YouTube page URLs. You can install it from Raspbian, as well.

Who does not love internet radio stations? Who does not like to listen to Liquid Funk or Detroit Techno or Verdi all day long? Now you can do it easily on your Raspberry Pi. is an interactive command line tool that allows you to browse hundreds of genres and thousands of stations from the database of

Check out the details on Github. also uses the omxd media player daemon for playback.


But what the hell is omxd, you may ask. Well, you probably know the brilliant omxplayer that plays full HD videos using the GPU of the Raspberry Pi. It has a few limitations, though. It can play only one file at a time, unless you are a scary shell-wizard.

Would not it be great, if you could add your entire music collection to its playlist in one step?

Would not it be great if you could log out of your SSH/GUI session and it would keep cranking out Psytekk?

Would not it be great to interrupt your music playlist, watch a movie, and continue your playlist where you left off, after Vincent Vega and Jules leave the restaurant?

Exactly. That’s what omxd, the omxplayer daemon does. Maintain, manipulate a playlist, and play it in the background. It’s the heart and soul of RemotePi and

Check it out on Github.

Future Features

Debian packages for all three tools. So all you have to do for installation is:

sudo apt-get install remotepi