Difference between revisions of "Omxplayer"

From eLinux.org
Jump to: navigation, search
(Streaming: Added section for RTSP (backed up with a source!! - from the GitHub project page)). Split into two subsections, one for each protocol (as "RTSP" is very close to "RTMP"/"RTMPT").)
(KEY BINDINGS)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:RaspberryPi]]
 
[[Category:RaspberryPi]]
  
[https://github.com/huceke/omxplayer Omxplayer] is a video player specifically made for the Raspberry Pi's GPU made by Edgar (gimli) Hucek from the XBMC project.
+
[https://github.com/popcornmix/omxplayer Omxplayer] is a video player specifically made for the Raspberry Pi's GPU made by Edgar (gimli) Hucek from the XBMC/Kodi project. It relies on the [https://en.wikipedia.org/wiki/OpenMAX OpenMAX] hardware acceleration API, which is the [https://en.wikipedia.org/wiki/VideoCore Broadcom's VideoCore] officially supported API for GPU video/audio processing.
  
 
Raspberry Pi forum user ''spenning'' made precompiled binaries available on the forum. See [http://www.raspberrypi.org/phpBB3/viewtopic.php?f=2&t=5543 here].
 
Raspberry Pi forum user ''spenning'' made precompiled binaries available on the forum. See [http://www.raspberrypi.org/phpBB3/viewtopic.php?f=2&t=5543 here].
  
== Hotkeys ==
+
== KEY BINDINGS ==
 
<pre>
 
<pre>
z           Show Info
+
1          decrease speed
1           Increase Speed
+
2          increase speed
2           Decrease Speed
+
<           rewind
j          Previous Audio stream
+
>           fast forward
k          Next Audio stream
+
z           show info
i          Previous Chapter
+
j          previous audio stream
o          Next Chapter
+
k          next audio stream
n          Previous Subtitle stream
+
i          previous chapter
m          Next Subtitle stream
+
o          next chapter
s          Toggle subtitles
+
n          previous subtitle stream
d          Subtitle delay -250 ms
+
m          next subtitle stream
f          Subtitle delay +250 ms
+
s          toggle subtitles
q          Exit OMXPlayer
+
w          show subtitles
Space or p Pause/Resume
+
x          hide subtitles
-          Decrease Volume
+
d          decrease subtitle delay (- 250 ms)
+           Increase Volume
+
f          increase subtitle delay (+ 250 ms)
Left Arrow Seek -30
+
q          exit omxplayer
Right Arrow Seek +30
+
p / space  pause/resume
Down Arrow Seek -600
+
-          decrease volume
Up Arrow   Seek +600
+
+ / =      increase volume
 +
left arrow seek -30 seconds
 +
right arrow seek +30 seconds
 +
down arrow seek -600 seconds
 +
up arrow   seek +600 seconds
 +
</pre>
 +
 
 +
== Usage ==
 +
 
 +
<pre>
 +
omxplayer [OPTIONS] [FILE]
 +
 
 +
-h  --help                  Print this help
 +
-v  --version              Print version info
 +
-k  --keys                  Print key bindings
 +
-n  --aidx  index          Audio stream index    : e.g. 1
 +
-o  --adev  device          Audio out device      : e.g. hdmi/local/both
 +
-i  --info                  Dump stream format and exit
 +
-I  --with-info            dump stream format before playback
 +
-s  --stats                Pts and buffer stats
 +
-p  --passthrough          Audio passthrough
 +
-d  --deinterlace          Force deinterlacing
 +
    --nodeinterlace        Force no deinterlacing
 +
    --nativedeinterlace    let display handle interlace
 +
    --anaglyph type        convert 3d to anaglyph
 +
    --advanced              Allow advanced deinterlace for HD videos
 +
-w  --hw                    Hw audio decoding
 +
-3  --3d mode              Switch tv into 3d mode (e.g. SBS/TB)
 +
-M  --allow-mvc            Allow decoding of both views of MVC stereo stream
 +
-y  --hdmiclocksync        Display refresh rate to match video (default)
 +
-z  --nohdmiclocksync      Do not adjust display refresh rate to match video
 +
-t  --sid index            Show subtitle with index
 +
-r  --refresh              Adjust framerate/resolution to video
 +
-g  --genlog                Generate log file
 +
-l  --pos n                Start position (hh:mm:ss)
 +
-b  --blank                Set background to black
 +
    --loop                  Loop file. Ignored if file not seekable
 +
    --no-boost-on-downmix  Don't boost volume when downmixing
 +
    --vol n                set initial volume in millibels (default 0)
 +
    --amp n                set initial amplification in millibels (default 0)
 +
    --no-osd                Do not display status information on screen
 +
    --no-keys              Disable keyboard input (prevents hangs for certain TTYs)
 +
    --subtitles path        External subtitles in UTF-8 srt format
 +
    --font path            Default: /usr/share/fonts/truetype/freefont/FreeSans.ttf
 +
    --italic-font path      Default: /usr/share/fonts/truetype/freefont/FreeSansOblique.ttf
 +
    --font-size size        Font size in 1/1000 screen height (default: 55)
 +
    --align left/center    Subtitle alignment (default: left)
 +
    --no-ghost-box          No semitransparent boxes behind subtitles
 +
    --lines n              Number of lines in the subtitle buffer (default: 3)
 +
    --win 'x1 y1 x2 y2'    Set position of video window
 +
    --win x1,y1,x2,y2      Set position of video window
 +
    --crop 'x1 y1 x2 y2'    Set crop area for input video
 +
    --crop x1,y1,x2,y2      Set crop area for input video
 +
    --aspect-mode type      Letterbox, fill, stretch. Default: stretch if win is specified, letterbox otherwise
 +
    --audio_fifo  n        Size of audio output fifo in seconds
 +
    --video_fifo  n        Size of video output fifo in MB
 +
    --audio_queue n        Size of audio input queue in MB
 +
    --video_queue n        Size of video input queue in MB
 +
    --threshold  n        Amount of buffered data required to finish buffering [s]
 +
    --timeout    n        Timeout for stalled file/network operations (default 10s)
 +
    --orientation n        Set orientation of video (0, 90, 180 or 270)
 +
    --fps n                Set fps of video where timestamps are not present
 +
    --live                  Set for live tv or vod type stream
 +
    --layout                Set output speaker layout (e.g. 5.1)
 +
    --dbus_name name        default: org.mpris.MediaPlayer2.omxplayer
 +
    --key-config <file>    Uses key bindings in <file> instead of the default
 +
    --alpha                Set video transparency (0..255)
 +
    --layer n              Set video render layer number (higher numbers are on top)
 +
    --display n            Set display to output to
 +
    --cookie 'cookie'      Send specified cookie as part of HTTP requests
 +
    --user-agent 'ua'      Send specified User-Agent as part of HTTP requests
 +
    --lavfdopts 'opts'      Options passed to libavformat, e.g. 'probesize:250000,...'
 
</pre>
 
</pre>
  
Line 48: Line 119:
 
<pre>
 
<pre>
 
omxplayer -o local rtsp://192.168.3.100:8554/stream1
 
omxplayer -o local rtsp://192.168.3.100:8554/stream1
 +
</pre>
 +
 +
==Audio==
 +
 +
It is possible to select the audio output by specifying -o or --adev on the command line between:
 +
* local: analog output
 +
* hdmi: hdmi output (hdmi_drive=2 is then required in config.txt)
 +
* both: both outputs
 +
 +
Example:
 +
<pre>
 +
omxplayer -o hdmi file.qt
 
</pre>
 
</pre>
  
 
== Troubleshooting ==
 
== Troubleshooting ==
 
=== Black screen after playback ===
 
=== Black screen after playback ===
If you get a black screen on your X11 sesktop after Omxplayer is finished, you can use this command to restore your view:
+
If you get a black screen on your X11 desktop after Omxplayer is finished, you can use this command to restore your view:
 
<pre>
 
<pre>
 
xrefresh -display :0
 
xrefresh -display :0
Line 86: Line 169:
 
* [http://www.brianhensley.net/2012/07/how-to-get-debian-working-on-my.html How to install Debian Raspberry Pi]
 
* [http://www.brianhensley.net/2012/07/how-to-get-debian-working-on-my.html How to install Debian Raspberry Pi]
 
* [http://omxplayer.sconde.net/ Omxplayer Build Bot] (up to date binary packages available here)
 
* [http://omxplayer.sconde.net/ Omxplayer Build Bot] (up to date binary packages available here)
 +
 +
==References==
 +
<references/>

Latest revision as of 10:13, 18 February 2016


Omxplayer is a video player specifically made for the Raspberry Pi's GPU made by Edgar (gimli) Hucek from the XBMC/Kodi project. It relies on the OpenMAX hardware acceleration API, which is the Broadcom's VideoCore officially supported API for GPU video/audio processing.

Raspberry Pi forum user spenning made precompiled binaries available on the forum. See here.

KEY BINDINGS

1           decrease speed
2           increase speed
<           rewind
>           fast forward
z           show info
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
w           show subtitles
x           hide subtitles
d           decrease subtitle delay (- 250 ms)
f           increase subtitle delay (+ 250 ms)
q           exit omxplayer
p / space   pause/resume
-           decrease volume
+ / =       increase volume
left arrow  seek -30 seconds
right arrow seek +30 seconds
down arrow  seek -600 seconds
up arrow    seek +600 seconds

Usage

omxplayer [OPTIONS] [FILE]

-h  --help                  Print this help
-v  --version               Print version info
-k  --keys                  Print key bindings
-n  --aidx  index           Audio stream index    : e.g. 1
-o  --adev  device          Audio out device      : e.g. hdmi/local/both
-i  --info                  Dump stream format and exit
-I  --with-info             dump stream format before playback
-s  --stats                 Pts and buffer stats
-p  --passthrough           Audio passthrough
-d  --deinterlace           Force deinterlacing
    --nodeinterlace         Force no deinterlacing
    --nativedeinterlace     let display handle interlace
    --anaglyph type         convert 3d to anaglyph
    --advanced              Allow advanced deinterlace for HD videos
-w  --hw                    Hw audio decoding
-3  --3d mode               Switch tv into 3d mode (e.g. SBS/TB)
-M  --allow-mvc             Allow decoding of both views of MVC stereo stream
-y  --hdmiclocksync         Display refresh rate to match video (default)
-z  --nohdmiclocksync       Do not adjust display refresh rate to match video
-t  --sid index             Show subtitle with index
-r  --refresh               Adjust framerate/resolution to video
-g  --genlog                Generate log file
-l  --pos n                 Start position (hh:mm:ss)
-b  --blank                 Set background to black
    --loop                  Loop file. Ignored if file not seekable
    --no-boost-on-downmix   Don't boost volume when downmixing
    --vol n                 set initial volume in millibels (default 0)
    --amp n                 set initial amplification in millibels (default 0)
    --no-osd                Do not display status information on screen
    --no-keys               Disable keyboard input (prevents hangs for certain TTYs)
    --subtitles path        External subtitles in UTF-8 srt format
    --font path             Default: /usr/share/fonts/truetype/freefont/FreeSans.ttf
    --italic-font path      Default: /usr/share/fonts/truetype/freefont/FreeSansOblique.ttf
    --font-size size        Font size in 1/1000 screen height (default: 55)
    --align left/center     Subtitle alignment (default: left)
    --no-ghost-box          No semitransparent boxes behind subtitles
    --lines n               Number of lines in the subtitle buffer (default: 3)
    --win 'x1 y1 x2 y2'     Set position of video window
    --win x1,y1,x2,y2       Set position of video window
    --crop 'x1 y1 x2 y2'    Set crop area for input video
    --crop x1,y1,x2,y2      Set crop area for input video
    --aspect-mode type      Letterbox, fill, stretch. Default: stretch if win is specified, letterbox otherwise
    --audio_fifo  n         Size of audio output fifo in seconds
    --video_fifo  n         Size of video output fifo in MB
    --audio_queue n         Size of audio input queue in MB
    --video_queue n         Size of video input queue in MB
    --threshold   n         Amount of buffered data required to finish buffering [s]
    --timeout     n         Timeout for stalled file/network operations (default 10s)
    --orientation n         Set orientation of video (0, 90, 180 or 270)
    --fps n                 Set fps of video where timestamps are not present
    --live                  Set for live tv or vod type stream
    --layout                Set output speaker layout (e.g. 5.1)
    --dbus_name name        default: org.mpris.MediaPlayer2.omxplayer
    --key-config <file>     Uses key bindings in <file> instead of the default
    --alpha                 Set video transparency (0..255)
    --layer n               Set video render layer number (higher numbers are on top)
    --display n             Set display to output to
    --cookie 'cookie'       Send specified cookie as part of HTTP requests
    --user-agent 'ua'       Send specified User-Agent as part of HTTP requests
    --lavfdopts 'opts'      Options passed to libavformat, e.g. 'probesize:250000,...'

Streaming

RTMP

You do not need to download an MP4 file to watch it with Omxplayer. If you have the URL of a (H.264) rtmp:// stream, just stream it with:

omxplayer rtmp://...

To stream a (H.264) rtmpt://... URL with Omxplayer, just change the head rtmp:// to rtmpt://.

RTSP

Support for RTSP was added in 2012[1] (for instance, allowing the use of VLC media player as the streaming server).

Example:

omxplayer -o local rtsp://192.168.3.100:8554/stream1

Audio

It is possible to select the audio output by specifying -o or --adev on the command line between:

  • local: analog output
  • hdmi: hdmi output (hdmi_drive=2 is then required in config.txt)
  • both: both outputs

Example:

omxplayer -o hdmi file.qt

Troubleshooting

Black screen after playback

If you get a black screen on your X11 desktop after Omxplayer is finished, you can use this command to restore your view:

xrefresh -display :0

Or you can use a small Bash script for video playback to do this every time:

#/bin/bash
omxplayer "$@"
xrefresh -display :0

On Raspbian, xrefresh is part of the x11-xserver-utils package (apt-get install x11-xserver-utils).

No rights to VCHIQ

On bare installations of the default distributions, Omxplayer often has insufficient permissions to access /dev/vchiq. One solution would be to run Omxplayer as root, but a nicer solution is to add a udev rule so that /dev/vchiq is also accessible from other users. To accomplish this, do the following under root:

# echo 'SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules

Now add yourself to the group named 'video':

# usermod -aGvideo USERNAME

Reboot the Raspberry Pi, and you should be able to run Omxplayer without the vchiq-error showing up.

HDMI

When using HDMI make sure to pass '-o hdmi' to Omxplayer if you want the audio to play through the HDMI cable:

omxplayer -o hdmi videofile.mp4

Helpful Links

References