*

Welcome, Guest. Please login or register.
Did you miss your activation email?

Pages: [1] 2 3 4 ... 13
Print
Author Topic: MPlayer working on the XO  (Read 133888 times)

MPlayer working on the XO

Roto
Contributor
*
Posts: 44



December 29, 2007, 12:47:24 AM

This evening I got MPlayer working on my XO.  I've tested it with several different codecs and it plays back full-screen XviD and MPEG-4 quite nicely.  Click here for a proof-of-concept video.  I apologize for the poor audio quality; my camera's microphone isn't very good.

The video that's playing back in that clip is a short clip from the A Bug's Life DVD, encoded with ffmpeg in MPEG-4 with AAC audio.  The video is at 640x480 at 1.5Mbps and the audio is 128Kbps.

Also, note that I'm using the game buttons to control the video.  I mapped checkmark to play/pause, square to mute, X to quit, and the directional pad to fast forward/rewind.

I've also tried some higher bitrate (not quite sure what, but they're around 233MB for a 25-minute file) XviD encoded files at 640x480.  These look quite nice; there's no pixelation and hardly any compression artifacts visible, even if you look closely.  Every now and then, it drops a few frames during high-motion sequences (and outputs the "Your system is too slow!" message to the console) but it's quite watchable.

Anything higher than 640x480 seems to be the limit (i.e. it won't do HD without slowing down.)  It should do soft subtitles, but I haven't tested this yet.  It does handle MKV (and I'd assume OGM) files (given that the video is small enough and the bitrate is low enough).

If you want to try it out for yourself, I've posted a compiled binary (click here) and you can get the source code I'm using (click here).  Take a look at build.sh to see how I'm compiling it.  I did the compilation on a virtual machine running Ubuntu Gutsy.  Note that if you have certain packages installed on your linux machine, mplayer might try and dynamically link against them and it won't run if those packages are not on the XO.  So, you might have to modify build.sh to work on your machine.

If you just want to be able to play videos, these instructions should get you up and running:

Code:
cd ~

wget -O - http://www.orderedpixels.com/xo/mplayer/mplayer.tar.bz2 | tar xj

This will download mplayer to your home directory.  Now, assuming you have a video file called "video.avi" on an SD card called "SD":

Code:
./mplayer -fs /media/SD/video.avi

should start playing the video.  It will always play full screen even if you leave off -fs, but you should use it anyway to ensure that the aspect ratio is correct (otherwise it stretches non-4:3 video to fill the entire screen.)

You may also have to do:

Code:
mkdir -p ~/.mplayer

ln -s /usr/share/fonts/dejavu-lgc/DejaVuLGCSans.ttf ~/.mplayer/subfont.ttf

if it complains about not being able to load the subtitle font.

The GUI works, if you put a skin in .mplayer and start it with the -gui option.  Most skins are way too small to read on the XO because of its resolution, but someone could probably make a nice XO skin.

Soon, I plan to turn this into an XO activity so you can play videos with MPlayer from the journal.  But first, I need to learn some Python. Wink

Oh yeah, a few final caveats:
1. I'll do my best to answer questions, but I can't spend too much time supporting this.  YOYO, use at your own risk, so on and so forth.
2. This works on my XO; I'm running joyride-1489 at the moment and have installed a few extra libraries.  However, I'm fairly confident that this should run on the Ship.2 build without modification.  If not, tell me and I'll try to make it work.
3. If you're running a build with power management, it might shut off the processor while the video is playing.  I'm not sure how to tell Ohm not to do this.  The option to disable the X screensaver in MPlayer may or may not have an effect.  For best results, run with the power adapter plugged in.
4. It doesn't work with the screen rotated to any position other than normal.  (When I say this, I mean rotated in software; it doesn't care if the screen is physically rotated into the e-book mode, which works great.)
« Last Edit: December 29, 2007, 02:18:26 PM by Roto » Logged

#1 Re: MPlayer working on the XO

magnuan
Commenter

Posts: 7


December 29, 2007, 08:21:24 AM

Brilliant. Works like a charm.
Logged

#2 Re: MPlayer working on the XO

tamichan
Contributor
*
Posts: 56


December 29, 2007, 08:40:00 AM

Fantastic!

Tami (Masaaki) Takamiya
Logged

#3 Re: MPlayer working on the XO

Mike Lee
Global Moderator
Master Contributor
****
Posts: 348


I'm curious about everything.


WWW
December 29, 2007, 09:36:17 AM





Roto! My 4-year-old daughter thanks you!


Now we can load up some PBS Super Why! for Super Readers

http://pbskids.org/superwhy/
Logged

Member of the OLPC Learning Club - Washington, D.C., and a sponsor of the Simplicity Research Consortium at the MIT Media Lab.

#4 Re: MPlayer working on the XO

Atif
Contributor
*
Posts: 97


December 29, 2007, 09:46:01 AM

Wow!

I'm way impressed that you compiled this for the XO!  The reason I put VLC on my XO is that I didn't quite know how to go about compiling Mplayer for the XO since the XO doesn't have a compiler.  You might want to make it clear in your post that the word "here's" is the actual LINK to click to watch your demo video.  On my laptop's screen it was hard to tell that it was a hyperlink...I think it is dark green, but it looks too close to the black to tell the difference.

O.K. so I have a whole bunch of questions...

Mapping the buttons so they are useful is REALLY cool!  So as an aside...is there anyway to do the same thing with Opera?  One of my big disappointments with the XO is that you can't really browse in tablet mode because there is no way to select links using the game bad or cursor keys.  In Opera they just function to scroll the screen....

When you figure out how to "Sugarize" it...would you write up a short "how-to"? I would love to do the same thing for VLC and for Skype...
« Last Edit: December 29, 2007, 09:52:34 AM by Atif » Logged

#5 Re: MPlayer working on the XO

decibel
Senior Contributor
**
Posts: 142



December 29, 2007, 12:18:17 PM

I have a new hero! This is exactly what I was hoping for. In my test, I put one of my personal rips (in iPhone format of course) on my iPod Shuffle. For those of you trying the same thing, swap SD from his command line to the name of your device. Here's a link to my proof so-to-speak. Wink



Logged

#6 Re: MPlayer working on the XO

humptybump
Contributor
*
Posts: 69



WWW
December 29, 2007, 12:45:04 PM

Great work ! I almost don't want to install it for fear my productivity will plummet even further :-)

Actually, I am taking a look at the source changes you made and the build process because I want to try the same with another app I use. I also am looking forward to what you uncover WRT "sugar-izing" it into an Activity.
Logged

#7 Re: MPlayer working on the XO

Ray G
Contributor
*
Posts: 57


December 29, 2007, 01:39:56 PM

Thank You so much Roto!
Now with a Divx player and FreeCiv this XO is worth more than the price.
Its a bit cludgy, but funtion over form any day.
Please give us a heads up if you make any progress on launching from
Sugar.
You guys r0x0r!
Logged

#8 Re: MPlayer working on the XO

Roto
Contributor
*
Posts: 44



December 29, 2007, 02:38:35 PM

You might want to make it clear in your post that the word "here's" is the actual LINK to click to watch your demo video.  On my laptop's screen it was hard to tell that it was a hyperlink...I think it is dark green, but it looks too close to the black to tell the difference.

Thanks, I edited my post to make it a little clearer.  The link color is a little hard to see. Smiley

Quote
Mapping the buttons so they are useful is REALLY cool!  So as an aside...is there anyway to do the same thing with Opera?  One of my big disappointments with the XO is that you can't really browse in tablet mode because there is no way to select links using the game bad or cursor keys.  In Opera they just function to scroll the screen....

I was able to map the buttons because I could edit the MPlayer source code.  (Actually, MPlayer supports a config file with button-to-command mappings that it can load at runtime, but I wanted to add them to the defaults to minimize external configuration.)  Unfortunately, Opera is closed-source, and I doubt it allows for any kind of external keyboard mappings that would be useful.  It looks like we just need to wait for the folks at Opera to assign useful functions to the buttons.

Quote
When you figure out how to "Sugarize" it...would you write up a short "how-to"? I would love to do the same thing for VLC and for Skype...

Sure, I can do that.  A starting point is the Opera activity bundle, which simply launches the Opera executable.  That would probably work with a few modifications for launching Skype.  MPlayer (and probably VLC) is going to be a little more complicated because just launching MPlayer with no arguments simply spits out some usage information and quits.  So, I need to figure out how Sugar handles telling an activity to resume a particular file from the Journal, convert that to a pathname, and pass it as an argument to the mplayer binary when it's launched.

Quote
Actually, I am taking a look at the source changes you made and the build process because I want to try the same with another app I use.

The source code changes were actually minimal; the only change I made was to input/input.c, to add the mappings for the game buttons.  For the most part, it's just finding the right compilation options.  It will be different for each program you compile, but in general, you want to compile on a system that's similar (ideally Fedora 7), target for the i686 (or geode if your compiler (gcc 4.3?) actually supports it), and disable processor extensions that the XO doesn't have (SSE and SSE2 are only partially implemented in the Geode, for example.)  Finally, once you have a compiled binary, you can run ldd on it to see what dynamic dependencies it has; it won't run if it links to libraries that aren't installed on the XO.  If there are some, you can try installing them on the XO, disabling the features that use them and recompiling, or statically linking them into the binary.
Logged

#9 Re: MPlayer working on the XO

con
Senior Contributor
**
Posts: 105


December 29, 2007, 04:33:10 PM

How does playing videos impact the battery life on the OLPC XO?  Has anyone tried mplayer with the backlight turned off?
Logged

#10 Re: MPlayer working on the XO

decibel
Senior Contributor
**
Posts: 142



December 29, 2007, 04:46:38 PM

How does playing videos impact the battery life on the OLPC XO?  Has anyone tried mplayer with the backlight turned off?

I haven't tried to time it yet, but sunlight mode works just fine.
Logged

#11 Acsess to internet radio

steve h
New

Posts: 2


December 29, 2007, 05:26:57 PM

How can I download a player that works?
Logged

#12 Re: Acsess to internet radio

decibel
Senior Contributor
**
Posts: 142



December 29, 2007, 05:43:49 PM

How can I download a player that works?

Welcome to the forums! This thread is about the mplayer. If you want to know about radio, try posting in an appropriate thread or forum category.
« Last Edit: December 29, 2007, 06:03:08 PM by decibel » Logged

#13 Re: MPlayer working on the XO

Boone
Commenter

Posts: 18


December 29, 2007, 08:28:49 PM

Quote
Quote
Mapping the buttons so they are useful is REALLY cool!  So as an aside...is there anyway to do the same thing with Opera?  One of my big disappointments with the XO is that you can't really browse in tablet mode because there is no way to select links using the game bad or cursor keys.  In Opera they just function to scroll the screen....

I was able to map the buttons because I could edit the MPlayer source code.  (Actually, MPlayer supports a config file with button-to-command mappings that it can load at runtime, but I wanted to add them to the defaults to minimize external configuration.)  Unfortunately, Opera is closed-source, and I doubt it allows for any kind of external keyboard mappings that would be useful.  It looks like we just need to wait for the folks at Opera to assign useful functions to the buttons.


I finagled a workable navigation setup for Opera by hacking into the way the XO maps the gamepad keys.  Check this out http://olpcnews.com/forum/index.php?topic=889.0 for the details.
Logged

#14 Re: MPlayer working on the XO

thepete
Global Moderator
Master Contributor
****
Posts: 361


Day 1 Donor!!


WWW
December 30, 2007, 02:17:35 AM

Roto, you ROCK.  Thanks for making my middle-of-the-night!  Just an FYI: I got a Quicktime movie to run on my XO.  Very sweet.  Now I can take the SD card from my camera and stick it into the XO and play videos that I just shot.  *AWESOME*.
Logged

Adventuring through the XOniverse!  It's a blast!

http://thetech.thepete.com
Pages: [1] 2 3 4 ... 13
Print
Jump to:  

Welcome, Guest. Please login or register.
Did you miss your activation email?
September 06, 2010, 02:11:59 AM

Login with username, password and session length
Recent Topics
[September 05, 2010, 11:51:10 PM]

[September 05, 2010, 09:25:21 PM]

by Rao
[September 05, 2010, 08:27:23 AM]

by anna
[September 04, 2010, 01:56:30 PM]

[August 30, 2010, 11:26:07 PM]

[August 30, 2010, 11:23:56 PM]

[August 30, 2010, 10:40:34 AM]

[August 28, 2010, 10:00:01 PM]

[August 25, 2010, 03:10:02 PM]

[August 22, 2010, 09:48:07 AM]
Members
Total Members: 4557
Latest: Helenwh
Stats
Total Posts: 31126
Total Topics: 3759
Online Today: 43
Online Ever: 220
(February 05, 2009, 11:29:32 AM)
Users Online
Users: 1
Guests: 33
Total: 34