Running omxplayer from the command line easily using alias

Although I have previously written about running omxplayer via GUI, sometimes I like to control it via command line.
However, since I have my raspberry pi hooked up via HDMI and I like the show to be fullscreened, this requires typing:
omxplayer -r -o hdmi FILE
each time.
In order to make this easier we can use aliases. An alias lets you run a command with a shorter command. For instance:
ll is really an alias of ls - l

You can see what aliases you have by typing alias in the command line.
To temporarily add an alias you can use the command:
alias play=omxplayer -r -o hdmi

However, I want to permanently add this. To do that, Ill edit /home/pi/.bash_aliases
you can do this using vim or nano. Simply add the line alias play=omxplayer -r -o hdmi to this file.

Make sure you log out and log back in for this change to be made. Now we can just type: 

play FILE

To be able to easily find and intelligently play videos automatically, see this page:
http://stevenhickson.blogspot.com/2013/03/playing-videos-intelligently-with.html

Consider donating to further my tinkering.


Places you can find me

Related Posts by Categories

0 comments:

Post a Comment