Sunday, August 11, 2013

Raspberry Pi Journal #4

Video Playback Trouble
OMXPlayer Trouble. MPlayer2 works fine.

So, I was connecting my USB flash drive to Raspberry Pi, and I played some videos I have that I recorded using my Windows 8 camera. The resolution is HD. Omxplayer plays fine as usual, but somehow, there's no sound! That's strange. I looked at the boot configuration, it says hdmi_force=2, which means HDMI output. Furthermore, I believe that I did play the video with sound before.

Putting in -o hdmi didn't work, believe it or not. I was very disappointed. So I tried various options. This works:

omxplayer -r -o hdmi filename

I was so very happy, until it reaches the end of the video, and the whole screen went blank! Uh-oh. Not good. So very not good!

I wasted several hours trying to debug the process. In the end, though, I gave up. It's nice to be able to use hardware decoding, but if in the end I have to shutdown the computer and reboot, then that's not the way I'm going to do it! Maybe there is a command that I can use to reset the display. If so, then I can simply write a script just to make sure the command to reset the display is run after omxplayer finished playing. I don't know such command.

Obviously, I'm not going to use that program ever again.

So, I went to the package directory. I did a search and found mplayer2. Looks good. The package seems to be rather well-developed. So it's pretty simple to just download the whole package.

sudo apt-get install mplayer2

Curiously, when I did a which mplayer2, I came up blank. So, I did which mplayer. Bingo! There it is! Obviously, there'd be a conflict if I ever install mplayer, instead of mplayer2. Will have to be careful in the future.

Then I ran some test videos.

  • Nintendo 3DS video: Ran fine, no problem.
  • Flip Videos: Ran fine, no problem. Can do Full Screen. 50% CPU
  • WIndows 8: Ran slow. Out of sync. 100% CPU

None of the videos ran smooth, BTW. I had to use -framedrop option to run it. I was extremely disappointed that the Windows videos can't be shown. I'll have to make sure to record in low resolution mode from now on. Or, I can simply use my Nintendo 3DS to record the video. It ran just fine!

Here's the screen capture of the video in action:

Not bad for a windowed application that does not take over the whole screen. Unlike omxplayer, I may add. So, I'm happy for now.

Finally figured out the command to refresh the screen. There is a couple seconds delay at the end, but at least I get my screen back! I ended up making a script called "omxplay", do a chmod 755 and put it in /bin

omxplay -o hdmi -r "$1"
fbset -depth 8 && fbset -depth 16

No comments:

Post a Comment