Richard45
Posts: 4
Joined: Tue Jan 19, 2016 1:36 am

omxplayer --key-config file

Wed Jan 20, 2016 2:57 am

I'm creating this post because I could not find the correct information online. There were some posts that were helpful, but not 100% correct, and "man omxplayer" isn't quite correct.

I wanted to remap my keyboard (actually a wireless remote control that has a few keyboard keys) to some controls for the omxplayer.

Here's what you actually need to do:

To execute:
omxplayer --key-config=/home/pi/Desktop/omxkeys.txt
(where omxkeys.txt is the file containing the remapping. "man omxplayer" left out the "=", which makes a difference!)

Here's what my omxkeys.txt file contains:
PAUSE:p
PAUSE:hex 0X20 #SPACE key
PAUSE:hex 0X0A #ENTER key
EXIT:q
SEEK_FORWARD_LARGE:hex 0X5B41
SEEK_BACK_LARGE:hex 0X5B42
SEEK_FORWARD_SMALL:hex 0X5B43
SEEK_BACK_SMALL:hex 0X5B44

Note, the hex number referred to in "man omxplayer" isn't correct for the arrow key (at least it doesn't work for my keyboard). Finding the hex values for the different keys was a pain. For the newbies like me, here's the key:
If you look at www.asciitable.com, then it will get you half-way there. For example, it says that the ASCII code for "C" is hex 43. For the omxplayer file, you need "hex 0X43". For the ENTER key, I had to experiment; it works out to "hex 0X0A", which is ASCII hex 0A, which is "new line feed". For the arrow keys, I experimented.

hex 0X5B43 is the right arrow key, but where is this documented???

It would be really nice to see the default mapping of omxplayer, so someone like me could copy and paste it and make the changes I need. It would certainly be a huge time saver!

How can I "see" what the hex value of a key that I'm pressing is? I think there is a command you can use in LXTerminal, but it only worked for some of the keys that I tried. I don't remember what the command was...

Randys90
Posts: 2
Joined: Sat Dec 02, 2017 9:19 pm

Re: omxplayer --key-config file

Sat Jan 27, 2018 10:27 pm

To find out the hex codes you qould use xxd. I was looking for the same thing and found the answer here

https://stackoverflow.com/questions/363 ... ombination

Return to “Graphics, sound and multimedia”