Video Player

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (FreeRunner)
m (spam Undo revision 83997 by Osmal116 (Talk))
 
(41 intermediate revisions by 15 users not shown)
Line 1: Line 1:
 
Not a proper 'app' page, just an overview
 
Not a proper 'app' page, just an overview
 +
 +
{{Prioritybox|
 +
Problems with playing videos on the freerunner? - The kernel is now (July 2010) configured to use kernel-mode switching (kms) for glamo. The glamo video driver has no direct control over glamo anymore and cannot use accelerated video playing until a new driver is written.
 +
}}
  
 
=FreeRunner=
 
=FreeRunner=
It plays mpeg-4 320x240 stretched fullscreen, however other formats will require transcoding.
+
It plays mpeg-4 640x240 with 24fps stretched fullscreen, however other formats will require transcoding.
  
 
==Playback==
 
==Playback==
Line 9: Line 13:
 
=== Using standard Mplayer ===
 
=== Using standard Mplayer ===
 
It can be installed with the following command:
 
It can be installed with the following command:
opkg install mplayer
+
opkg install mplayer
  
 
=== Using the Glamo XV acceleration ===
 
=== Using the Glamo XV acceleration ===
TBD, refer to: http://unadventure.wordpress.com/2008/06/08/accelerating-in-my-pocket/
+
This only applies to GTA02 hardware which uses [[Smedia_Glamo_3362|Glamo graphical chip]].
 +
<br>First of all you'll need special version of Mplayer with glamo support.
 +
<br>You can download it from here: http://downloads.tuxfamily.org/3v1deb/openmoko/mplayer-glamo.tar.bz2
 +
<br>Just copy files inside the archive with:
 +
<pre>
 +
cp mplayer /usr/bin/mplayer
 +
cp input.conf ~/.mplayer/input.conf
 +
</pre>
 +
Install ffmpeg:
 +
<pre>opkg install ffmpeg</pre>
 +
Than create ~/.mplayer/config file like this:
 +
<pre>
 +
vo=xover:glamo,x11
 +
display=:0
 +
afm=ffmpeg,
 +
fs=1
 +
quiet=1
 +
osdlevel=0
 +
noautosub=1
 +
stop-xscreensaver=1
 +
</pre>
 +
 
 +
File shoud be preencoded with something like this:
 +
<pre>mencoder file_to_encode.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
 +
-vf scale=320:240,eq2=1.2:0.5:-0.25,rotate=2 -oac mp3lame -ofps 15 -lameopts br=64:cbr \
 +
-o file_for_openmoko</pre>
 +
 
 +
It can be played with:
 +
<pre>mplayer your_file.avi</pre>
 +
 
 +
Please refer to: http://unadventure.wordpress.com/2008/06/08/accelerating-in-my-pocket/ for more details.
 +
 
 +
* I gave a try to the above how-to and it doesn't work on my FR. Playing the preencoded movie just displays a green screen with garbage on the top. -- [[User:Pini|Pini]] Sun Dec  7 13:08:42 UTC 2008
  
 
=== Controlling MPlayer from the Touchscreen ===
 
=== Controlling MPlayer from the Touchscreen ===
Line 43: Line 79:
  
 
Despite these issues, it proves that the horsepower is there and it can be done.
 
Despite these issues, it proves that the horsepower is there and it can be done.
 
  
 
=== Another derivated method : works like a charm for me ! ===
 
=== Another derivated method : works like a charm for me ! ===
Line 49: Line 84:
 
Like it's said in the "Getting started with FreeRunner" wiki page, you have to install the full qwerty keyboard, see [http://www.ginguppin.de/node/15 these instructions].
 
Like it's said in the "Getting started with FreeRunner" wiki page, you have to install the full qwerty keyboard, see [http://www.ginguppin.de/node/15 these instructions].
 
After that, you can go to Terminal and type :
 
After that, you can go to Terminal and type :
mplayer vid/my_video.avi
+
mplayer vid/my_video.avi
 
Mplayer starts in full screen, if your video is optimized like below 240x320 it's work like a charm and to quit just use the power button.
 
Mplayer starts in full screen, if your video is optimized like below 240x320 it's work like a charm and to quit just use the power button.
  
Line 57: Line 92:
 
===PC===
 
===PC===
 
Download the source (no need to start with the giant full resolution version)
 
Download the source (no need to start with the giant full resolution version)
 +
 
  cd /tmp
 
  cd /tmp
  wget http://mirror.botux.net/pub/peach.blender/psp/big_buck_bunny_480p_AVC_FW33.mp4
+
  wget http://proyectos.pixelamigo.com/open/movies/BigBuckBunny/unofficial_PSP/big_buck_bunny_480p_AVC_FW33.mp4
  
 
Test the video filter settings (-vf crop=...) often omitting the last "rotate=2" (Optional, but recommended for long videos).
 
Test the video filter settings (-vf crop=...) often omitting the last "rotate=2" (Optional, but recommended for long videos).
mplayer big_buck_bunny_480p_AVC_FW33.mp4 vf crop=720:480:-1:-1,scale=320:-2,rotate=2 -zoom
 
  
Transcode it
+
mplayer big_buck_bunny_480p_AVC_FW33.mp4 -vf crop=720:480:-1:-1,scale=320:-2,rotate=2 -zoom
 +
 
 +
Transcode it:
 +
 
 
  mencoder big_buck_bunny_480p_AVC_FW33.mp4 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
 
  mencoder big_buck_bunny_480p_AVC_FW33.mp4 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
  -vf crop=720:480:0:0,scale=320:-2,eq=1.2:0.5:-0.25,rotate=2 -oac mp3lame -lameopts br=64:cbr \
+
  -vf crop=720:480:0:0,scale=320:-2,eq2=1.2:0.5:-0.25,rotate=2 -oac mp3lame -lameopts br=64:cbr \
 
  -o big_buck_bunny_320.avi
 
  -o big_buck_bunny_320.avi
 +
 +
or if it doesn't work (for me the image and the colours aren't ok) replace scale=320:-2 by scale=320:240
  
 
=== FreeRunner===
 
=== FreeRunner===
 
Transfer the resulting 27M file from the PC to the FreeRunner's MicroSD card
 
Transfer the resulting 27M file from the PC to the FreeRunner's MicroSD card
scp user@192.168.0.200:/tmp/big_buck_bunny_320.avi /media/card
+
scp user@192.168.0.200:/tmp/big_buck_bunny_320.avi /media/card
  
 
Play it
 
Play it
/home/root/vidplay /media/card/big_buck_bunny_320.avi
+
/home/root/vidplay /media/card/big_buck_bunny_320.avi
  
 
==Other Info==
 
==Other Info==
  
 
To rotate the screen:
 
To rotate the screen:
xrandr -o 0
+
xrandr -o 0
xrandr -o 1
+
xrandr -o 1
  
 
=Neo1973=
 
=Neo1973=
Line 98: Line 138:
 
==Mode Switching==
 
==Mode Switching==
 
For switching between QVGA and VGA mode do the following with a compatible kernel:
 
For switching between QVGA and VGA mode do the following with a compatible kernel:
 +
 
  chvt 4 && echo qvga-normal > /sys/devices/platform/s3c24xx-spi-gpio.1/spi0.0/state && fbset qvga
 
  chvt 4 && echo qvga-normal > /sys/devices/platform/s3c24xx-spi-gpio.1/spi0.0/state && fbset qvga
 +
 
vice versa:
 
vice versa:
 +
 
  echo normal > /sys/devices/platform/s3c24xx-spi-gpio.1/spi0.0/state && fbset vga && chvt 3
 
  echo normal > /sys/devices/platform/s3c24xx-spi-gpio.1/spi0.0/state && fbset vga && chvt 3
taken from http://lists.openmoko.org/pipermail/neo1973-hardware/2007-October/000267.html
 
  
To avoid console blanking type
+
Taken from http://lists.openmoko.org/pipermail/neo1973-hardware/2007-October/000267.html
 +
 
 +
To avoid console blanking type:
 +
 
 
  echo -e '\033[9;0]' > /dev/ttyX
 
  echo -e '\033[9;0]' > /dev/ttyX
 +
 
where 'X' is your terminal number - for example if you did chvt 4 then /dev/tty4 is your terminal.
 
where 'X' is your terminal number - for example if you did chvt 4 then /dev/tty4 is your terminal.
  
 
To avoid kernel output in vt do
 
To avoid kernel output in vt do
 +
 
  echo 0 > /proc/sys/kernel/printk
 
  echo 0 > /proc/sys/kernel/printk
  
Line 122: Line 169:
  
 
To get best speed on GTA01 (best size-speed-resolution-codec trade-off I could find - doesn't mean it's perfect though) crosscode using:
 
To get best speed on GTA01 (best size-speed-resolution-codec trade-off I could find - doesn't mean it's perfect though) crosscode using:
mencoder <sourcefile> -o <targetfile.avi> -ofps 13 -vf scale -zoom -xy 240 -af channels=1:0:0:1:0 -oac lavc -ovc lavc -lavcopts acodec=mp3:vcodec=h263p:autoaspect=1:vbitrate=300:abitrate=32
+
mencoder <sourcefile> -o <targetfile.avi> -ofps 13 -vf scale -zoom -xy 240 -af channels=1:0:0:1:0 -oac lavc -ovc lavc -lavcopts acodec=mp3:vcodec=h263p:autoaspect=1:vbitrate=300:abitrate=32
  
 
Also working okay:
 
Also working okay:
mencoder <sourcefile> -o <targetfile.avi> -ofps 13 -vf scale -zoom -xy 352 -af channels=1:0:0:1:0 -oac lavc -ovc lavc -lavcopts acodec=mp3:vcodec=h263p:autoaspect=1:vbitrate=200:abitrate=32
+
mencoder <sourcefile> -o <targetfile.avi> -ofps 13 -vf scale -zoom -xy 352 -af channels=1:0:0:1:0 -oac lavc -ovc lavc -lavcopts acodec=mp3:vcodec=h263p:autoaspect=1:vbitrate=200:abitrate=32
  
 
You can playback the file using:
 
You can playback the file using:
mplayer -sws 0 -nodouble -vo sdl -fs -framedrop <tagetfile.avi>
+
mplayer -sws 0 -nodouble -vo sdl -fs -framedrop <tagetfile.avi>
  
 
You may also want to use:
 
You may also want to use:
-autosync 30 -vf scale -zoom -xy 640 -vf rotate=1
+
-autosync 30 -vf scale -zoom -xy 640 -vf rotate=1
 +
 
 +
= htcdream =
 +
== Encoding ==
 +
The htcdream is capable of playing a video like big buck bunny,full screen,with only the CPU(we didn't investigate video/audio decoding offload)
 +
To encode the video use that command:
 +
mencoder ../big_buck_bunny_1080p_h264.mov -oac mp3lame -lameopts cbr:br=64 -ovc lavc -lavcopts vcodec=mpeg1video:vbitrate=300 -vf scale=480:320,rotate=1,format=fmt=yv12 -srate 44100 -o bbb.mkv
 +
The important part are:
 +
* low bit rates,mpeg1video etc... :
 +
That lower the CPU usage....until less than 80% usage
 +
* scale=480:320,rotate=1 :
 +
That rotate big buck bunny at encoding time, that require to rotate the screen to portrait mode
 +
 
 +
Rotating the screen is described [http://www.shr-project.org/trac/wiki/DreamInstall?version=22#xorgtweaks here]
 +
 
 +
== Playing ==
 +
If you have the screen in portrait mode do:
 +
mplayer -vo dga bbb.mkv
 +
Using DGA should be a lot faster. but no benchmarks were made, -vo x11 also works<br/>
 +
If I understand it well,dga bypasses xorg(with the cooperation from xorg) and have direct access to the framebuffer,so there is no xorg overhead <br/>
 +
(it works only in portrait mode)<br/>
 +
else do:
 +
mplayer -vo x11 bbb.mkv
  
 
=Transcoding=
 
=Transcoding=
 
To make your videos/DVDs compatible use mencoder like this:
 
To make your videos/DVDs compatible use mencoder like this:
 +
 
Find out the -vf cropping parameters with
 
Find out the -vf cropping parameters with
 +
 
  mplayer input.avi -vf cropdetect
 
  mplayer input.avi -vf cropdetect
 +
 
let it run a few seconds and insert the given cropping values into this command
 
let it run a few seconds and insert the given cropping values into this command
  mencoder input.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 -vf crop=xx:xx:xx:xx,rotate=2,scale=-2:320 -oac mp3lame -lameopts br=64:cbr -o output2.avi
+
 
 +
  mencoder input.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
 +
-vf crop=xx:xx:xx:xx,rotate=2,scale=-2:320 -oac mp3lame -lameopts br=64:cbr -o output2.avi
 +
 
 +
nota: I have written a GUI called videoconverto to transcode and transfert the result file to the FR. You can find it at http://dl.free.fr/bhZK4uQzw
 +
just copy to your PC, and make it executable. --[[User:Piratebab|Piratebab]] 18:43, 28 June 2009 (UTC)
 +
 
 
To encode a DVD first find out the -vf cropping parameters with
 
To encode a DVD first find out the -vf cropping parameters with
 +
 
  mplayer -dvd-device /path/to/dvd dvd:// -vf cropdetect -sb 50000000
 
  mplayer -dvd-device /path/to/dvd dvd:// -vf cropdetect -sb 50000000
 +
 
let it run a few seconds and insert the given cropping values into this command
 
let it run a few seconds and insert the given cropping values into this command
  mencoder -dvd-device /path/to/dvd dvd:// -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 -vf crop=xx:xx:xx:xx,rotate=2,scale=-2:320 -oac mp3lame -lameopts br=64:cbr -o output.avi
+
 
This will rotate the video/DVD, scale it and encode it to mpeg4 with a bitrate of 300kBit/s. Works like a charm.
+
  mencoder -dvd-device /path/to/dvd dvd:// -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
 +
-vf crop=xx:xx:xx:xx,rotate=2,scale=-2:320 -oac mp3lame -lameopts br=64:cbr -o output.avi
 +
 
 +
This will rotate the video/DVD, scale it and encode it to mpeg4 with a bitrate of 300kBit/s.  
 +
 
 +
Works like a charm.
 +
 
 +
== Some hints on encoding for Neo Freerunner ==
 +
* use a mpeg4 codec like in lavc (mencoder -avc lavc -lavcopts vcodec=mpeg4)
 +
* the video should be pre-rotated (mencoder -vf rotate=1 or 2)
 +
* the resolution should/must be
 +
** divisible by 16 (-vf scale=m*16:n*16)
 +
** x*y= about 150k, some videos even work with 200k (-vf scale=512:384 #=196608)
 +
** x/y should be lower than 640/480
 +
** if the video is scaled up to more than 640/480, maybe because of the aspect (-lavcopts autoaspect), video will get slow (sometime up to 684 may work)
 +
* scaling up seems to be easy for the Glamo
 +
* video bitrates up to 1000kbit (or more) may work, 400kbit seems to be safe (mencoder -lavcopts vbitrate=400)
 +
* 3.6M pixels per second are possible, 640*240*24=3,686,400 (at least, when video is pre-rotated)
  
 
=Frontend=
 
=Frontend=
 
==gnome-mplayer==
 
==gnome-mplayer==
As a nice GUI gnome-mplayer can be recommended.  
+
'''Source Code released: No'''
 +
 
 +
As a nice GUI gnome-mplayer can be recommended.
  
 
On Debian you can install it from repository:
 
On Debian you can install it from repository:
# apt-get install gnome-mplayer
+
# apt-get install gnome-mplayer
 +
 
 +
 
 +
<onlyinclude>
 +
{{ApplicationBox|
 +
Name=[[Video Player|mplayer]]|
 +
Description=The popular command line video player.|
 +
Screenshot=Mplayer.png|
 +
Homepage=http://www.mplayerhq.hu|
 +
 
 +
TestedOn=Om 2008.8 (default repository)|
 +
PackageName=mplayer|
 +
Source Code released=No|
 +
 
 +
}}
 +
</onlyinclude>
 +
 
 +
== DeforaOS Player ==
 +
'''Source Code released: Yes'''
 +
 
 +
It provides another GUI to mplayer.
 +
 
 +
It was released first there:
 +
http://people.defora.org/~khorben/share/Openmoko/deforaos-player_0.1.0_armv4t.ipk
 +
 
 +
<onlyinclude>
 +
{{ApplicationBox|
 +
Name=[[DeforaOS Player|deforaos-player]]|
 +
Description=The DeforaOS media player, a frontend to mplayer|
 +
Screenshot=Player.png|
 +
Homepage=http://www.defora.org/os/project/display/336/Player|
 +
 
 +
TestedOn=Om 2008.8|
 +
PackageName=deforaos-player|
 +
Source Code released=Yes|
 +
 
 +
}}
 +
</onlyinclude>
 +
 
 +
== See also ==
 +
http://wiki.debian.org/DebianOnFreeRunner/Tips#mplayer
  
[[Category:Video]]
+
[[Category:Video Applications]]
 
[[Category:Debian]]
 
[[Category:Debian]]
[[Category:Om 2007.2]]
+
[[Category:Om 2008.8]]

Latest revision as of 10:14, 23 May 2011

Not a proper 'app' page, just an overview

Problems with playing videos on the freerunner? - The kernel is now (July 2010) configured to use kernel-mode switching (kms) for glamo. The glamo video driver has no direct control over glamo anymore and cannot use accelerated video playing until a new driver is written.

Contents

[edit] FreeRunner

It plays mpeg-4 640x240 with 24fps stretched fullscreen, however other formats will require transcoding.

[edit] Playback

The default media player doesn't seem to handle video very well, but mplayer does OK.

[edit] Using standard Mplayer

It can be installed with the following command: opkg install mplayer

[edit] Using the Glamo XV acceleration

This only applies to GTA02 hardware which uses Glamo graphical chip.
First of all you'll need special version of Mplayer with glamo support.
You can download it from here: http://downloads.tuxfamily.org/3v1deb/openmoko/mplayer-glamo.tar.bz2
Just copy files inside the archive with:

cp mplayer /usr/bin/mplayer
cp input.conf ~/.mplayer/input.conf

Install ffmpeg:

opkg install ffmpeg

Than create ~/.mplayer/config file like this:

vo=xover:glamo,x11
display=:0
afm=ffmpeg,
fs=1
quiet=1
osdlevel=0
noautosub=1
stop-xscreensaver=1

File shoud be preencoded with something like this:

mencoder file_to_encode.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
-vf scale=320:240,eq2=1.2:0.5:-0.25,rotate=2 -oac mp3lame -ofps 15 -lameopts br=64:cbr \
-o file_for_openmoko

It can be played with:

mplayer your_file.avi

Please refer to: http://unadventure.wordpress.com/2008/06/08/accelerating-in-my-pocket/ for more details.

  • I gave a try to the above how-to and it doesn't work on my FR. Playing the preencoded movie just displays a green screen with garbage on the top. -- Pini Sun Dec 7 13:08:42 UTC 2008

[edit] Controlling MPlayer from the Touchscreen

Create a file in /home/root/.mplayer/input.conf with this content:

# Freerunner Optimizations
MOUSE_BTN0 vo_fullscreen
MOUSE_BTN0_DBL q

Now, you can toggle the fullscreen by tapping the screen and exit from mplayer by touble-tapping the LCD. Accelerometers or hardware buttons could help more.

[edit] Playback helper script

Create a script named 'vidplay' in your home directory with the following commands:

#!/bin/sh
xrandr -display :0 --output default --mode 240x320
mplayer -vo fbdev "$1" > /dev/null
xrandr -display :0 --output default --mode 480x640
reset

Make the script executable:

chmod 755 /home/root/vidplay

Known issues with this approach:

  • The output isn't in a proper window, so background stuff sometimes flickers through.
  • When done on the local terminal the keyboard is obscured so you can't exit. SSH works quite well.
  • 240x320 mode has some quirks:
    • The gamma/brightness/contrast is weird. Encoding adjustments into the media is a workaround.
    • Vertical banding (as seen in landscape position) is quite noticeable.
  • Using CTRL-C to exit vidplay doesn't reset the screen; use 'q' instead.

Despite these issues, it proves that the horsepower is there and it can be done.

[edit] Another derivated method : works like a charm for me !

No ssh, no xrandr, no script needed, juste mplayer and qwerty keyboard : Like it's said in the "Getting started with FreeRunner" wiki page, you have to install the full qwerty keyboard, see these instructions. After that, you can go to Terminal and type : mplayer vid/my_video.avi Mplayer starts in full screen, if your video is optimized like below 240x320 it's work like a charm and to quit just use the power button.

Only issue : You can't forward/backward/pause...

[edit] Example - Big Buck Bunny

[edit] PC

Download the source (no need to start with the giant full resolution version)

cd /tmp
wget http://proyectos.pixelamigo.com/open/movies/BigBuckBunny/unofficial_PSP/big_buck_bunny_480p_AVC_FW33.mp4

Test the video filter settings (-vf crop=...) often omitting the last "rotate=2" (Optional, but recommended for long videos).

mplayer big_buck_bunny_480p_AVC_FW33.mp4 -vf crop=720:480:-1:-1,scale=320:-2,rotate=2 -zoom

Transcode it:

mencoder big_buck_bunny_480p_AVC_FW33.mp4 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
-vf crop=720:480:0:0,scale=320:-2,eq2=1.2:0.5:-0.25,rotate=2 -oac mp3lame -lameopts br=64:cbr \
-o big_buck_bunny_320.avi

or if it doesn't work (for me the image and the colours aren't ok) replace scale=320:-2 by scale=320:240

[edit] FreeRunner

Transfer the resulting 27M file from the PC to the FreeRunner's MicroSD card scp user@192.168.0.200:/tmp/big_buck_bunny_320.avi /media/card

Play it /home/root/vidplay /media/card/big_buck_bunny_320.avi

[edit] Other Info

To rotate the screen: xrandr -o 0 xrandr -o 1

[edit] Neo1973

Video is problematic on Neo 1973.

On the minus side.

  • The CPU is certainly not fast enough to decode 480*640 video.
  • The display is portrait, which means that an additional rotation step is needed for most landscape video, adding to CPU usage.
  • Downloading an arbitrary video, and playing it without transcoding it, then playing it later will not be possible.

However.

On the positive side.

  • The LCD can be switched to a 240*320 stretch mode, which is much less taxing.
  • Re-encoding video to rotate it, and scale to 320*240, and encoding with a low CPU use codec such as MPEG-1 may well make half-screen doubled videos playable at 25fps.
  • If not, then it almost certainly will be possible at 12fps.

[edit] Mode Switching

For switching between QVGA and VGA mode do the following with a compatible kernel:

chvt 4 && echo qvga-normal > /sys/devices/platform/s3c24xx-spi-gpio.1/spi0.0/state && fbset qvga

vice versa:

echo normal > /sys/devices/platform/s3c24xx-spi-gpio.1/spi0.0/state && fbset vga && chvt 3

Taken from http://lists.openmoko.org/pipermail/neo1973-hardware/2007-October/000267.html

To avoid console blanking type:

echo -e '\033[9;0]' > /dev/ttyX

where 'X' is your terminal number - for example if you did chvt 4 then /dev/tty4 is your terminal.

To avoid kernel output in vt do

echo 0 > /proc/sys/kernel/printk

[edit] User Reports

From a conversation with XorA, in the IRC channel.

400kbps mpeg4 works on a 200Mhz neo (without sound) on prerotated 240*320 ffmpeg codec videos, at 25fps, using stock mplayer.

With sound, this drops to 18fps.

There are optimisations for mplayer that look promising to get 25fps with sound.

[edit] Playback using 480x640 / 640x480

To get best speed on GTA01 (best size-speed-resolution-codec trade-off I could find - doesn't mean it's perfect though) crosscode using: mencoder <sourcefile> -o <targetfile.avi> -ofps 13 -vf scale -zoom -xy 240 -af channels=1:0:0:1:0 -oac lavc -ovc lavc -lavcopts acodec=mp3:vcodec=h263p:autoaspect=1:vbitrate=300:abitrate=32

Also working okay: mencoder <sourcefile> -o <targetfile.avi> -ofps 13 -vf scale -zoom -xy 352 -af channels=1:0:0:1:0 -oac lavc -ovc lavc -lavcopts acodec=mp3:vcodec=h263p:autoaspect=1:vbitrate=200:abitrate=32

You can playback the file using: mplayer -sws 0 -nodouble -vo sdl -fs -framedrop <tagetfile.avi>

You may also want to use: -autosync 30 -vf scale -zoom -xy 640 -vf rotate=1

[edit] htcdream

[edit] Encoding

The htcdream is capable of playing a video like big buck bunny,full screen,with only the CPU(we didn't investigate video/audio decoding offload) To encode the video use that command:

mencoder ../big_buck_bunny_1080p_h264.mov -oac mp3lame -lameopts cbr:br=64 -ovc lavc -lavcopts vcodec=mpeg1video:vbitrate=300 -vf scale=480:320,rotate=1,format=fmt=yv12 -srate 44100 -o bbb.mkv

The important part are:

  • low bit rates,mpeg1video etc... :

That lower the CPU usage....until less than 80% usage

  • scale=480:320,rotate=1 :

That rotate big buck bunny at encoding time, that require to rotate the screen to portrait mode

Rotating the screen is described here

[edit] Playing

If you have the screen in portrait mode do:

mplayer -vo dga bbb.mkv

Using DGA should be a lot faster. but no benchmarks were made, -vo x11 also works
If I understand it well,dga bypasses xorg(with the cooperation from xorg) and have direct access to the framebuffer,so there is no xorg overhead
(it works only in portrait mode)
else do:

mplayer -vo x11 bbb.mkv

[edit] Transcoding

To make your videos/DVDs compatible use mencoder like this:

Find out the -vf cropping parameters with

mplayer input.avi -vf cropdetect

let it run a few seconds and insert the given cropping values into this command

mencoder input.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
-vf crop=xx:xx:xx:xx,rotate=2,scale=-2:320 -oac mp3lame -lameopts br=64:cbr -o output2.avi

nota: I have written a GUI called videoconverto to transcode and transfert the result file to the FR. You can find it at http://dl.free.fr/bhZK4uQzw just copy to your PC, and make it executable. --Piratebab 18:43, 28 June 2009 (UTC)

To encode a DVD first find out the -vf cropping parameters with

mplayer -dvd-device /path/to/dvd dvd:// -vf cropdetect -sb 50000000

let it run a few seconds and insert the given cropping values into this command

mencoder -dvd-device /path/to/dvd dvd:// -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
-vf crop=xx:xx:xx:xx,rotate=2,scale=-2:320 -oac mp3lame -lameopts br=64:cbr -o output.avi

This will rotate the video/DVD, scale it and encode it to mpeg4 with a bitrate of 300kBit/s.

Works like a charm.

[edit] Some hints on encoding for Neo Freerunner

  • use a mpeg4 codec like in lavc (mencoder -avc lavc -lavcopts vcodec=mpeg4)
  • the video should be pre-rotated (mencoder -vf rotate=1 or 2)
  • the resolution should/must be
    • divisible by 16 (-vf scale=m*16:n*16)
    • x*y= about 150k, some videos even work with 200k (-vf scale=512:384 #=196608)
    • x/y should be lower than 640/480
    • if the video is scaled up to more than 640/480, maybe because of the aspect (-lavcopts autoaspect), video will get slow (sometime up to 684 may work)
  • scaling up seems to be easy for the Glamo
  • video bitrates up to 1000kbit (or more) may work, 400kbit seems to be safe (mencoder -lavcopts vbitrate=400)
  • 3.6M pixels per second are possible, 640*240*24=3,686,400 (at least, when video is pre-rotated)

[edit] Frontend

[edit] gnome-mplayer

Source Code released: No

As a nice GUI gnome-mplayer can be recommended.

On Debian you can install it from repository:

  1. apt-get install gnome-mplayer


Mplayer.png mplayer

The popular command line video player.


Homepage: http://www.mplayerhq.hu
Package: mplayer
Tested on: Om 2008.8 (default repository)



[edit] DeforaOS Player

Source Code released: Yes

It provides another GUI to mplayer.

It was released first there: http://people.defora.org/~khorben/share/Openmoko/deforaos-player_0.1.0_armv4t.ipk


Player.png deforaos-player

The DeforaOS media player, a frontend to mplayer


Homepage: http://www.defora.org/os/project/display/336/Player
Package: deforaos-player
Tested on: Om 2008.8



[edit] See also

http://wiki.debian.org/DebianOnFreeRunner/Tips#mplayer

Personal tools

Not a proper 'app' page, just an overview

FreeRunner

It plays mpeg-4 320x240 stretched fullscreen, however other formats will require transcoding.

Playback

The default media player doesn't seem to handle video very well, but mplayer does OK.

Using standard Mplayer

It can be installed with the following command:

opkg install mplayer

Using the Glamo XV acceleration

TBD, refer to: http://unadventure.wordpress.com/2008/06/08/accelerating-in-my-pocket/

Controlling MPlayer from the Touchscreen

Create a file in /home/root/.mplayer/input.conf with this content:

# Freerunner Optimizations
MOUSE_BTN0 vo_fullscreen
MOUSE_BTN0_DBL q

Now, you can toggle the fullscreen by tapping the screen and exit from mplayer by touble-tapping the LCD. Accelerometers or hardware buttons could help more.

Playback helper script

Create a script named 'vidplay' in your home directory with the following commands:

#!/bin/sh
xrandr -display :0 --output default --mode 240x320
mplayer -vo fbdev "$1" > /dev/null
xrandr -display :0 --output default --mode 480x640
reset

Make the script executable:

chmod 755 /home/root/vidplay

Known issues with this approach:

  • The output isn't in a proper window, so background stuff sometimes flickers through.
  • When done on the local terminal the keyboard is obscured so you can't exit. SSH works quite well.
  • 240x320 mode has some quirks:
    • The gamma/brightness/contrast is weird. Encoding adjustments into the media is a workaround.
    • Vertical banding (as seen in landscape position) is quite noticeable.
  • Using CTRL-C to exit vidplay doesn't reset the screen; use 'q' instead.

Despite these issues, it proves that the horsepower is there and it can be done.


Another derivated method : works like a charm for me !

No ssh, no xrandr, no script needed, juste mplayer and qwerty keyboard : Like it's said in the "Getting started with FreeRunner" wiki page, you have to install the full qwerty keyboard, see these instructions. After that, you can go to Terminal and type :

mplayer vid/my_video.avi

Mplayer starts in full screen, if your video is optimized like below 240x320 it's work like a charm and to quit just use the power button.

Only issue : You can't forward/backward/pause...

Example - Big Buck Bunny

PC

Download the source (no need to start with the giant full resolution version)

cd /tmp
wget http://mirror.botux.net/pub/peach.blender/psp/big_buck_bunny_480p_AVC_FW33.mp4

Test the video filter settings (-vf crop=...) often omitting the last "rotate=2" (Optional, but recommended for long videos).

mplayer big_buck_bunny_480p_AVC_FW33.mp4 vf crop=720:480:-1:-1,scale=320:-2,rotate=2 -zoom

Transcode it

mencoder big_buck_bunny_480p_AVC_FW33.mp4 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 \
-vf crop=720:480:0:0,scale=320:-2,eq=1.2:0.5:-0.25,rotate=2 -oac mp3lame -lameopts br=64:cbr \
-o big_buck_bunny_320.avi

FreeRunner

Transfer the resulting 27M file from the PC to the FreeRunner's MicroSD card

scp user@192.168.0.200:/tmp/big_buck_bunny_320.avi /media/card

Play it

/home/root/vidplay /media/card/big_buck_bunny_320.avi

Other Info

To rotate the screen:

xrandr -o 0
xrandr -o 1

Neo1973

Video is problematic on Neo 1973.

On the minus side.

  • The CPU is certainly not fast enough to decode 480*640 video.
  • The display is portrait, which means that an additional rotation step is needed for most landscape video, adding to CPU usage.
  • Downloading an arbitrary video, and playing it without transcoding it, then playing it later will not be possible.

However.

On the positive side.

  • The LCD can be switched to a 240*320 stretch mode, which is much less taxing.
  • Re-encoding video to rotate it, and scale to 320*240, and encoding with a low CPU use codec such as MPEG-1 may well make half-screen doubled videos playable at 25fps.
  • If not, then it almost certainly will be possible at 12fps.

Mode Switching

For switching between QVGA and VGA mode do the following with a compatible kernel:

chvt 4 && echo qvga-normal > /sys/devices/platform/s3c24xx-spi-gpio.1/spi0.0/state && fbset qvga

vice versa:

echo normal > /sys/devices/platform/s3c24xx-spi-gpio.1/spi0.0/state && fbset vga && chvt 3

taken from http://lists.openmoko.org/pipermail/neo1973-hardware/2007-October/000267.html

To avoid console blanking type

echo -e '\033[9;0]' > /dev/ttyX

where 'X' is your terminal number - for example if you did chvt 4 then /dev/tty4 is your terminal.

To avoid kernel output in vt do

echo 0 > /proc/sys/kernel/printk

User Reports

From a conversation with XorA, in the IRC channel.

400kbps mpeg4 works on a 200Mhz neo (without sound) on prerotated 240*320 ffmpeg codec videos, at 25fps, using stock mplayer.

With sound, this drops to 18fps.

There are optimisations for mplayer that look promising to get 25fps with sound.

Playback using 480x640 / 640x480

To get best speed on GTA01 (best size-speed-resolution-codec trade-off I could find - doesn't mean it's perfect though) crosscode using:

mencoder <sourcefile> -o <targetfile.avi> -ofps 13 -vf scale -zoom -xy 240 -af channels=1:0:0:1:0 -oac lavc -ovc lavc -lavcopts acodec=mp3:vcodec=h263p:autoaspect=1:vbitrate=300:abitrate=32

Also working okay:

mencoder <sourcefile> -o <targetfile.avi> -ofps 13 -vf scale -zoom -xy 352 -af channels=1:0:0:1:0 -oac lavc -ovc lavc -lavcopts acodec=mp3:vcodec=h263p:autoaspect=1:vbitrate=200:abitrate=32

You can playback the file using:

mplayer -sws 0 -nodouble -vo sdl -fs -framedrop <tagetfile.avi>

You may also want to use:

-autosync 30 -vf scale -zoom -xy 640 -vf rotate=1

Transcoding

To make your videos/DVDs compatible use mencoder like this: Find out the -vf cropping parameters with

mplayer input.avi -vf cropdetect

let it run a few seconds and insert the given cropping values into this command

mencoder input.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 -vf crop=xx:xx:xx:xx,rotate=2,scale=-2:320 -oac mp3lame -lameopts br=64:cbr -o output2.avi

To encode a DVD first find out the -vf cropping parameters with

mplayer -dvd-device /path/to/dvd dvd:// -vf cropdetect -sb 50000000

let it run a few seconds and insert the given cropping values into this command

mencoder -dvd-device /path/to/dvd dvd:// -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=300 -vf crop=xx:xx:xx:xx,rotate=2,scale=-2:320 -oac mp3lame -lameopts br=64:cbr -o output.avi

This will rotate the video/DVD, scale it and encode it to mpeg4 with a bitrate of 300kBit/s. Works like a charm.

Frontend

gnome-mplayer

As a nice GUI gnome-mplayer can be recommended.

On Debian you can install it from repository:

# apt-get install gnome-mplayer