Pages

Showing posts with label omxplayer. Show all posts
Showing posts with label omxplayer. Show all posts

Wednesday, October 26, 2016

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
Read More..

Sunday, May 15, 2016

Setting up OMXPlayer GUI on the Raspberry Pi Updated

This is a nice little trick to get OMXPlayer to work nice and pretty within the file manager so that the keypresses work and you dont need to use the command line. 

I got my Raspberry Pi in the mail and started setting it up as a  media server with my projector, external HDDs, and sound system.

You can do this in Arch Arm or in Raspbian Wheezy (Its easier in Wheezy since in Arch you have to get LXDE and omxplayer installed).

First thing, I noticed that the resolution auto-selection script didnt work properly with my projector.
I went into /opt/vc/bin and ran:
tvservice -d /home/pi/projector
edidparser /home/pi/projector /home/pi/available

Most of the options you need to change are in /boot/config.txt

This will give you the available resolutions. Each one has a code associated with it and is either a CEA code (hdmi_group=1) or a DMT code (hdmi_group=2). Then you can set the code with the hdmi_mode=? (I like hdmi_mode=15 and hmdi_mode=5).
Sometimes audio doesnt work over HDMI. If it doesnt, set hdmi_drive=2

Overclocking the Raspberry Pi is really easy, you can definitely get up to 850 MHz by adding this into the /boot/config.txt file:
arm_freq=855
sdram_freq=500

I got up to 1 GHz easily with the following options:
over_voltage=6
arm_freq=1000
sdram_freq=500
core_freq=500

I made the mistake of installing vlc. Dont! The ARM processor cant really handle it (unless overclocked and then its still buggy).
Use omxplayer instead.

Unfortunately omxplayer is a command line tool and that can get bothersome. To easily get around this and use it, install xterm by running:

Note: You dont have to use xterm, you can use the built in lxterminal instead by replacing xterm with lxterminal in all the examples below. However, xterm allows for the nice fullscreen option that omxplayer messes up.

sudo apt-get install xterm

Then right click one of your avi files and select open with, then click custom command line tool, type in:
xterm -fullscreen -fg black -bg black -e omxplayer -o hdmi -r %f

and check the box saying always do this so you only have to double click on any avi file in the future and it will do the same thing.


This opens up omxplayer in a new terminal so the key presses, such as p (pause) and q (quit), work. It also opens it up in fullscreen (the -r flag and the -fullscreen flag for xterm). Note: The rest of the display goes to sleep after a while so if the screen is black when the movie quits, shake the mouse or press a key to wake it up.

Omxplayer Problems

For detail on issues and how to fix them, see here:
Updating Raspberry Pi packages, kernel, and firmware (also fixing omxplayer)

If you are having problems with the video not working or not showing or the screen locking, make sure your raspberry pi is up to date by running:
sudo apt-get update && sudo apt-get upgrade

**HELP my mouse and keyboard dont work  (SOLUTION)**
If it still doesnt work, you may need to upgrade your firmware (which is generally a good idea anyways) using:
sudo apt-get -y dist-upgrade
and also 
sudo rpi-update
The guide for updating your firmware can be found here:
https://github.com/Hexxeh/rpi-update

Also make sure your gpu_mem split is at a reasonable level such as 128/128 by adding the line
gpu_mem=128
in the /boot/config.txt file in the newer firmware versions

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

Omxplayer Key Bindings:

  • 1 Increase Speed
  • 2 Decrease Speed
  • j Previous Audio stream
  • k Next Audio stream
  • i Previous Chapter
  • o Next Chapter
  • n Previous Subtitle stream
  • m Next Subtitle stream
  • s Toggle subtitles
  • q Exit
  • Space or p Pause/Resume
  • - Decrease Volume
  • + Increase Volume
  • Left Seek -30
  • Right Seek +30
  • Down Seek -600
  • Up Seek +600

Check out my other Raspberry Pi Fixes/How tos:
http://stevenhickson.blogspot.com/2012/10/using-raspberry-pi-as-web-server-media.html
http://stevenhickson.blogspot.com/2012/10/fixing-raspberry-pi-crashes.html

Consider donating to further my tinkering.


Places you can find me
Read More..

Saturday, March 19, 2016

Updating your Raspberry Pi Packages Kernel and Firmware Also fixing omxplayer problems

**Note, this is for Raspbian and other Debian based distros**

Also, this tends to fix Omxplayer when it wont work

Ive found that almost all of the omxplayer problems are solved by properly updating your raspberry pi. Before you say "I already did that!", read below to make sure you have taken all of the steps since the kernel and the firmware require different commands.

Updating Packages

sudo apt-get update && sudo apt-get upgrade

This updates the package list and upgrades all the packages. You can use the -y flag if you hate typing yes. After the kernel and all packages are upgraded, this command should show you:
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded

Updating the Kernel

sudo apt-get update && sudo apt-get -y dist-upgrade

This upgrades your linux kernel distribution. These are regularly released. You can see which version you have by running:
uname -a

Right now I have "Linux raspberrypi 3.6.11+"

Updating the Firmware

sudo rpi-update

This upgrades the firmware as long as you have the Hexxeh script downloaded. It and instructions can be found here:
https://github.com/Hexxeh/rpi-update

If you are having issues with video, make sure your memory split is set appropriately. I uses 128/128.
You can set this by editing /boot/config.txt and adding the line gpu_mem=128

If something is wrong, especially with omxplayer, make sure your packages, firmware, and kernel are all up to date. When they are, your problems will most likely be fixed.

Consider donating to further my tinkering.


Places you can find me
Read More..