Friday, July 13, 2012

How to get 1080p videos running on my Raspberry Pi

      So one of the first things I was very interested in the Raspberry Pi doing was running 1080p videos. All that power coming from one little controller, I couldn't believe it. So here is my success story of how I got my new raspberry pi to run 1080p videos right after installing Debian onto it.

Here is a video of my working success:



 PARTS:

Installation
There are a few different tools I found that play back HD content. The one I chose to use was called Omxplayer. From a terminal window lets install all the prerequisite applications first.

sudo apt-get install libpcre3-dev libpcrecpp0 libva-dev libva-x11-1 libva1

After some amount of time it will finish and then next we need to install the omxplayer.

wget http://seyrsnys.myzen.co.uk/rpi/omxplayer_0.0.1-arm.deb

After it's downloaded unzip it and install

sudo dpkg -i omxplayer_0.0.1-arm.deb

And that's it!!


Playing a movie
The last part of the tutorial will be playing a movie and how to call and use the omxplayer. Make sure you have a movie file i'm using an episode of friends that is located on a flash drive (extension MKV), many other extensions work too. Here is a list of all the omxplayer options and a general how to use them.


pi@raspberrypi:~$ omxplayer --help
Usage: omxplayer [OPTIONS] [FILE]
Options :
         -h / --help                          print this help
         -a / --alang language          audio language        : e.g. ger
         -n / --aidx  index               audio stream index    : e.g. 1
         -o / --adev  device             audio out device      : e.g. hdmi/local
         -i / --info                          dump stream format and exit
         -s / --stats                         pts and buffer stats
         -p / --passthrough             audio passthrough
         -d / --deinterlace              deinterlacing
         -w / --hw                         hw audio decoding
         -3 / --3d                          switch tv into 3d mode
         -y / --hdmiclocksync         adjust display refresh rate to match video
         -t / --sid index                  show subtitle with index
         -r / --refresh                     adjust framerate/resolution to video


For me i'm going to use my HDMI to DVI cable to output video and standard 3.5mm for audio output. So i'm going to use the command.

sudo omxplayer -o local /My/Folder/MyVideoFileName.videoextension

If I was wanting to send my audio through the HDMI cable I would call something like this.

sudo omxplayer -o hdmi /MyFolder/MyVideoFileName.videoextension

And that's it, your 1080p Video will now run!! Please feel free to check out my other blogs or leave questions and comments below.




Useful Links
http://elinux.org/Omxplayer
https://github.com/huceke/omxplayer/blob/master/README.md

39 comments:

  1. hey, cool post.
    I was trying to follow your instructions, and got to the following line:
    sudo dpkg -i omxplayer_0.0.1-arm.deb

    but it came up with errors:
    omxplayer depends on libpcre3-dev
    omxplayer depends on libpcrecpp0
    omxplayer depends on libva-dev
    omxplayer depends on libva-x11-1
    omxplayer depends on libva1

    i did install all of these with the command libpcre3-dev libpcrecpp0 libva-dev libva-x11-1 libva1, but do they need to be in a certain location?

    ReplyDelete
    Replies
    1. When you do 'sudo apt-get install libpcre3-dev libpcrecpp0 libva-dev libva-x11-1 libva1' it will automatically install it to the correct location in the operating system. How did you install them?

      Delete
    2. If you followed the tutorial it will work. I just wiped my SD card and tried it all over again because you were having issues. I starting at how I installed debian, to how I installed the omxplayer. everything worked perfectly the first time I tried to run a movie. It didn't take me more then 15mins to re-do everything. I would try over with debian.

      Delete
    3. Hey mate had same problem, just did sudo apt-get install omxplayer, seems to have fixed it up.

      Delete
  2. Hi, I've been trying to get omxplayer to work under Raspbian, seems like it's a bit different - after some digging around I got it to install:


    wget http://omxplayer.sconde.net/builds/omxplayer_0.2-ec4e7bc4-armhf.deb
    --2012-07-20 22:54:07-- http://omxplayer.sconde.net/builds/omxplayer_0.2-ec4e7bc4-armhf.deb
    Resolving omxplayer.sconde.net (omxplayer.sconde.net)... 176.31.108.16, 2001:41d0:8:1d10::
    Connecting to omxplayer.sconde.net (omxplayer.sconde.net)|176.31.108.16|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 5182562 (4.9M) [application/x-debian-package]
    Saving to: `omxplayer_0.2-ec4e7bc4-armhf.deb'

    100%[===============================================================================>] 5,182,562 1.91M/s in 2.6s

    2012-07-20 22:54:09 (1.91 MB/s) - `omxplayer_0.2-ec4e7bc4-armhf.deb' saved [5182562/5182562]

    pi@raspberrypi:~$ sudo dpkg -i omxplayer_0.0.1-arm.deb^C
    pi@raspberrypi:~$ sudo dpkg -i omxplayer_0.2-ec4e7bc4-armhf.deb
    (Reading database ... 55176 files and directories currently installed.)
    Preparing to replace omxplayer 0.2-ec4e7bc4 (using omxplayer_0.2-ec4e7bc4-armhf.deb) ...
    Deleting old OMXPlayer lib dir...
    Deleting old OMXPlayer doc dir...
    Unpacking replacement omxplayer ...
    Deleting OMXPlayer lib dir...
    Deleting OMXPlayer doc dir...
    Setting up omxplayer (0.2-ec4e7bc4) ...
    pi@raspberrypi:~$

    BUT then:

    pi@raspberrypi:~$ sudo omxplayer -o local The_Gruffalo.mp4
    /usr/bin/omxplayer.bin: error while loading shared libraries: libavutil.so.51: cannot open shared object file: No such file or directory

    ReplyDelete
    Replies
    1. Steve, you seem to be using a different version of Omxplayer than what I described above. I haven't tried using v0.2 yet. Plus the location you are grabbing your omxplayer.deb file was compiled from a different location than mine. If you continue to get errors try downloading v0.1 and try as I did above.

      Delete
  3. hi! thanks for sharing!
    i managed to install omxplayer via synaptic on the new raspbian distro and everything seems to play nice. the only problem i have is i can't get omxplayer to show subtitles. V0.2 seems to support that (there's an option to use on launch, but i can't understand how it works).

    any hint? :)

    Thanks!
    Marcello

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Just installed version 0.2 via 'sudo apt-get install omxplayer' so no special steps needed on Raspbian 7-15.

    ReplyDelete
  6. According the the specs I've found on the Pi it only supports 1080p30. Is that correct?

    ReplyDelete
  7. Hi Antony,

    I guess yes, but I haven't found an official answer yet. Do you have any news?

    Cheers!

    ReplyDelete
  8. excellent works like a charm
    My hat is off
    Cheers
    Fr Ted

    ReplyDelete
  9. Hey Brian!
    thanks buddy this is running great. Apart from this I have two doubts. It would be great if you could help me out.
    I am working for a college project in which I have to use 3.5"LCD screen to show different animation clips which are shuffled by input from PIR sensor.
    1. Is it possible to run videos (not necessarily HD) through RCA video output using omxplayer. (One option that I can think of is using a HDMI to RCA converter, but let me know if it's possible to do without it)
    2. How can I use the signal from sensors to toggle between videos?
    for example if I have video1 and video2. I want video1 to be played as default and video2 when the PIR is in high state.
    thanks,

    ReplyDelete
  10. Great info. Thanks!
    As dervxerox comments, http://seyrsnys.myzen.co.uk is now a dead link but you can get the latest build of the player from http://omxplayer.sconde.net/

    ReplyDelete
  11. On my Video Camera the Videos are AVCHD 1080p50 . First I did not know
    about omxplayer and extracted pure h264 files an played them with
    the hello_video sample program with good results Playing the same files with
    omxplayer resulted in stuttering of the displayed video.
    But now I found out that omxplayer plays the original mts (transport stream)
    files quite well with 50 fps. I edited the config.txt file of the raspberry,
    so that the display runs with 50 fps.

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. So,
      if I start the omxplayer in the way below, I should be able to run mkv files?

      sudo omxplayer -o hdmi /MyFolder/MyVideoFileName.mkv

      Delete
  13. Hi Brian,

    Firstly, great work! :)

    I am able to play 1080p HD videos using my RPi, and I have a wifi dongle with me. Streaming videos through wired connection using NFS seems fine, but streaming over wifi is horribly slow. Did you work a bit in using wifi on RPi? Did you encounter this issue?

    ReplyDelete
  14. Hello,

    i wanted to add when you use

    omxplayer -o hdmi -y *.mkv

    you can even play lossless dts 1080p without stuttering. Just keep in mind to overclock to 950 Mhz.

    greets

    ReplyDelete
  15. Hi! thanks for the video and links.
    Can you tell if you been able to advance chapters?

    i Previous Chapter
    o Next Chapter

    In my case nothing happens... ; l

    Thanks !

    ReplyDelete
  16. Hi

    Any ideas on how to constrain a video to its native resolution on HDMI, rather than fit-to-screen. I wish to run a series of small videos (similar in size to those from utube), but they fill the screen and are very pillexated.

    NB: have been using the TBOPlayer (GUI front end) as well as the command line route (inserting the '- r' arguement but all attempts so far have been unsuccessful.

    ReplyDelete
  17. I will say that I've tried everything to get my video files to play without an audio sync issue, some will but some will not, the common theme on the ones that dont play properly is some are 60 FPS

    pi@raspberrypi ~ $ omxplayer -o hdmi http://192.168.1.129:3000/AUSTRALIA.m4v
    file : http://192.168.1.129:3000/AUSTRALIA.m4v result 0 format mov,mp4,m4a,3gp,3g2,mj2 audio streams 2 video streams 1 chapters 0 subtitles 1 length 9929
    Aspect : num 13 den 11 aspect 2.312399 pixel aspect 1.181893
    Video codec omx-h264 width 720 height 368 profile 100 fps 59.940060
    Audio codec aac channels 2 samplerate 48000 bitspersample 16
    Subtitle count: 1, state: off, index: 1, delay: 0

    ReplyDelete
  18. My omxplayer can not play a stream from php
    i tried everithing but nothing

    omxplayer http://chabad.info/1.php

    the player get stuck ... any ideas ?

    ReplyDelete
  19. Awesome Post btw!!
    I'm wondering if there's an option for full screen? At the moment my desktop is showing up in the background as my videos play. Any ideas?
    Thanks :)

    ReplyDelete
    Replies
    1. Well -r filled the screen, but of course it cropped the sides of movie...anyway to just have the background a guaranteed black?

      Delete
  20. Will this work using the Model A (half as much RAM)?

    ReplyDelete
  21. did you bought the codec licenses, or you did it without_

    ReplyDelete
  22. What kind of keyboard do you have? Can you give me the model please?

    ReplyDelete
    Replies
    1. Hi Decsei,

      The keyboards are mini keyboards that Tektronix sells with all their windows based oscilloscopes. You'll have to call them and give them the following part number 119-7083-xx.The xx represents the revision number and they'll know how to look it up.

      Cheers,
      Brian

      Delete
  23. HI all,
    How to control the omxplayer using scripting?
    can anyone help me?

    Thank you

    ReplyDelete
  24. raspi to hdmi 24" with the command Pablo put up above worked. much to my amazement. copied a 2gb m4v to the desktop, ran sudo....m4v perfect quality. no stutter, audio is coming out too, but I did not know this monitor had speakers :]
    thanks!

    oh, ps, the ram is 256. crazy. it doesn't compute in my brain that it should be working...

    ReplyDelete
  25. Forrest Gump is a classic tale about an inspirational character who’s travels take us through our history. There are so many classic quotes from Forrest Gump, where do I begin? From being a collegiate All-American to a war veteran. running machine

    ReplyDelete
  26. What happens for me is, if I run the following command:
    sudo omxplayer /home/pie/Desktop/mesh.mp4

    I get audio loud and clear, but there is no video at all. What I mean is, there is no window, no player, no nothing, just the audio playing. Weird? Yes, I should say so.

    ReplyDelete
    Replies
    1. I can confirm this issue. Any ideas?

      Delete
  27. Well, omxplayer is playing pretty darn good. The problem is, I want to be able to hack some of my own features into playback and it's an overcomplicated mess for that sort of thing. For example, I tried to hack it into playing multiple short videos in a loop by listing the files on the command line, and it works for a while but crashes at random intervals. Running gdb on it is a pain because it's using private libraries and dbus and a wrapper script and the structure is troublesome to say the least. One question I have is-- where is the bulk of the performance enhancments accomplished? In ffmpeg? If so, I'd just like to get that installed as the standard ffmpeg on the system so I could use things like OpenCV and other more useful tools for playback with it that also work with ffmpeg. Who wrote omxplayer? Is there a developer forum somewhere?

    ReplyDelete