dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Wiki > Main > PluginMpegplayer (compare)

Difference: PluginMpegplayer (r170 vs. r169)

MPEG Player


Screenshot of MPEGplayer on iriver H300, iPod Photo and Sandisk Sansa e200

MPEGplayer is an MPEG video player viewer plugin. It is currently capable of playing back MPEG-1 and MPEG-2 video streams with MPEG audio multiplexed into .mpg files (MPEG Program Stream) and raw MPEG-1 and MPEG-2 video streams. To play a video file, you simply select it in the Rockbox file browser. If your file does not have the .mpg, .mpeg, .mpv or .m2v extension, you will need to use the "Open With..." context menu option and choose "mpegplayer".

NOTE: MPEGplayer does all video and audio decoding using your device's main CPU. It does not use any special video decoding hardware such as the Broadcom Video Processor found in the iPod Video. MPEGplayer therefore performs very badly on such devices in comparison with the manufacturer's original firmware.


Like all plugins documented on this website, MPEGplayer is included in the standard Rockbox installation and does not need to be downloaded separately. NOTE: Viewer plugins like MPEGplayer do not appear in the Browse Plugins menu - they are launched by selecting a file to be viewed in the normal file browser.

Supported Targets

MPEGPlayer works on all current targets apart from the Archos devices (use PluginVideo instead) and the iriver iFP. However, performance and usability varies greatly - see the following section for performance details.


The following table shows the speed that MPEGplayer can decode the "Elephants Dream" sample video on various targets. Tests are performed by enabling the Show FPS option and disabling the Limit FPS and Skip Frames options in MPEGplayer, playing the video, and then waiting for the FPS to stabilise. Please round the FPS to the nearest whole number.

PlayerLCD Size1:1 Video4:3 Video16:9 VideoTested on SVN
Gigabeat S 320x240   94fps 129fps r30967
Gigabeat F/X 320x240   48fps 66fps r15189
iAudio X5 160x128   32fps 44fps r15194
iPod Color/Photo 220x176   18fps 24fps 25fps 34fps r31555
iPod Nano 1G 176x132   39fps 53fps r28932
iPod Nano 2G 176x132   54fps 72fps r28934
iPod Video 320x240   14fps 19fps r15832
iriver H10 5/6GB 128x128        
iriver H10 20GB 160x128   39fps 53fps r16671
iriver H120 160x128   34fps 46fps r16485
iriver H300 220x176   18fps 25fps r15168
Sansa c200 132x80        
Sansa e200 220x176   27fps 37fps r16023
Sansa e200v2/Fuzev1 220x176   36fps 47 fps r22773
Sansa Fuzev2 220x176 41fps 33fps 43fps r?

Current Limitations

Audio decoding and .mpg file parsing were added to MPEGplayer on 1 January 2007. A/V Sync and rebuffering were added in March 2007. Seeking and WVS were added January 2008.

This is still a work-in-progress and is missing or could have the following major features:

* Full-time remote WVS on targets with LCD remotes - the status can always be displayed on the remote and the WVS on the main display kept hidden (optionally and if the remote is actually plugged).

* Seeking in raw video streams is not supported since they contain no time information and obtaining that would require a full file scan when opening the file. However, seeking is supported for MPEG Program Streams that have no audio stream.

Anyone is welcome to download the source and implement these features. Keep true to program structure and threading practice in order to keep it maintainable, well-factored and reliable regarless of target's threading implementation.

Known Bugs

* None known at this time (Though some minor quirks exist that are being worked out but are nothing that cause real problems - MichaelSevakis).

Menu Options

Start Menu

This menu is (optionally) presented before the file starts playing (see Resume Settings)

Play from beginning

Resume information is discarded and the video plays from the start.

Resume at: [hh:]mm:ss

Resume video playback at stored resume time [hh:]mm:ss (start of the video if no resume time is found).

Set start time

A preview screen is presented consisting of a thumbnail preview and a progress bar where the user can select a start time by 'seeking' through the video. Seeking is done in one-second or one-minute intervals. The video playback is started by pressing the select button.


Opens submenu - see below.

Quit MPEGplayer

Exit the plugin.

Settings Menu

This menu can be accessed from the Start menu orduring video playback, by pressing the "Menu" key during playback. (see "Key Mappings during playback")

Display Options

Opens submenu - see below.

Audio Options

Opens submenu - see below.

Resume Options

  • Resume automatically - Always resume immediately with no prompting
  • Play from beginning - Always play file from the beginning.
  • Start menu if not completed - Show the start menu if playback was interrupted before finishing (e.g. resume)
  • Start menu - Always show the start menu

Clear all resumes: x

Discard all x resume points.

Quit MPEGplayer

Exit the plugin.

Display Options Menu

Dithering (default: off)

Prevent banding effects in gradients by blending of colours. (only available on Sansa e200, Sansa c200, Gigabeat F/X and iRiver H10 20GB at this point).

Show FPS (default: off)

This option displays information about video and audio rendering (once a second - if your video is full-screen this means it will get overwritten by the video and appear to flash once per second)

  1. The average number of frames decoded per second (See Note)
  2. The total number of frames skipped since playback was last started (see the Skip Frames option)
  3. The current frame's temporal reference
  1. The percentage of the PCM buffer currently used
  2. The number of PCM buffer underruns that have occured since playback was last started
  3. The number of audio frames dropped since playback was last started

Note: The FPS measurement may be lower with all syncronizations enabled than what a raw benchmark of the average framerate would show because skipping may be required to maintain a/v sync in the short term over an especially decoding-intensive burst.

Limit FPS (default: on)

With this option disabled, MPEGplayer will display the video as fast as it can. Useful for benchmarking.

Skip frames (default: on)

This option causes MPEGplayer to attempt to maintain realtime playback by skipping the display of frames either by not decoding them -- the preferred strategy and best served by encoding with B-frames -- or by not drawing them after having decoded them if decoding finished excessively late. Disabling this option can cause loss of A/V sync.

Backlight brightness (default: Use setting)

If your particular player has the ability to set the backlight brightness through the backlight settings, you may select a different value to use during video playback and when interacting with the on-screen display. In the menus the global backlight brightness will apply. "Use setting" specifies that no change from the global preference will be made.

Audio Options Menu

Each item uses the same settings used for normal audio playback if "Use sound setting" is chosen. All default to "Force off". This allows certain effects to be temporarily unused by mpegplayer since having too many effects enabled may cause choppy video playback or perhaps even dropped audio frames if the processor cannot handle both video and extensive audio processing at the same time.

Tone Controls (default: force off)

Use the bass and treble control settings set for normal audio playback or force them off.

Channel Modes (default: force off)

Use the channel configuration (Mono, Custom, Mono Left, Mono Right, Karaoke) set for normal audio playback or force processing off which is equivalent to Stereo mode.

Crossfeed (default: force off)

Use the Crossfeed settings that are enabled during normal audio playback or force crossfeed off.

Equalizer (default: force off)

Use the Equalizer settings that are enabled during normal audio playback or force the equalizer off.

Dithering (default: force off)

Use audio dithering if enabled for normal audio playback or force audio dithering off.

Sample Videos

Elephants Dream

The following files are encoded using mpeg2enc at "-q 6" quantization level. Audio is LAME-encoded MP3 (44.1KHz, Stereo, 170kbps VBR). The source video is the "world's first open movie" - Elephants Dream. It is available under an open license.

PlayersLCD Size1:1 Video4:3 Video16:9 Video
iriver H300, iPod Color/Photo & Sansa e200/Fuze 220x176 n/a 224x176-469kbps224x128-354kbps
iPod Nano 176x132 n/a 176x128-310kbps176x96-229kbps
iPod Video & Gigabeat 320x240 n/a 320x240-830kbps320x176-596kbps
iAudio X5 and iriver H10 20GB 160x128 n/a 160x128-287kbps160x96-212kbps
iriver H10 5/6GB 128x128 128x128-247kbps128x96-192kbps n/a

How To Encode Files

Note: when converting flv files some transcoders fail to determine the source bitrate correctly for some files, which will result in the video playing at the wrong speed. This is not an issue of PluginMpegplayer but the transcoder. You might need to force the input framerate while converting. See FS#7919 for details about this issue.

Choosing a Resolution

MPEG-1 and MPEG-2 video is encoded using blocks of 16x16 pixels but the display dimensions can be anything which is a multiple of 2x2 pixels. The following table shows the LCD sizes of the various Rockbox players supported by MPEGplayer, their LCD size, and the suggested resolution for approximate full-screen 4:3 and 16:9 video files.

PlayersLCD Size4:3 Video16:9 Video
iPod Video & Gigabeat 320x240 320x240 320x180
iriver H300, iPod Color/Photo & Sansa e200/Fuze 220x176 220x166 220x124
iPod Nano 176x132 176x128 176x100
iAudio X5 / M5 and iriver H10 20GB / H120 160x128 160x120 160x90
iPod Mini 1G / 2G 138x110 138x104 138x78
iriver H10 5/6GB 128x128 128x96 128x72
Sansa c200 132x80 106x80 132x74

Note: Some of these don't work with TMPGEnc which requires the resolution to be a multiple of 8x8.

Note: Rockbox automatically rotates videos on the Gigabeat to landscape 320x240 and on the Sansa e200 to 220x176.


Using WinFF (Windows / Linux)

1) Download and install WinFF 0.41 here:

2) WinFF comes with built in presets for many targets, but not all. Currently the X5, H300, H10 (both), Gigabeat F/X, e200, and iPod Nano, Photo/Color and Video are covered. For other models, for the time being you will need to input the encoding parameters manually. (Generally, this simply means selecting a preset that closely matches your player model and then manually tweaking the video dimensions.)

3) Run WinFF, pick your desired player from the list, type in any overrides in the boxes at the bottom of the window (first time users - click the Options button to show them), add files to the list at the top, and start encoding! Note for Windows Vista users: WinFF may need to be run as an administrator (right click and choose to run it as administrator, or change the properties so that it always does) for it to properly be able to run ffmpeg.

Warning: If you're using the Linux version, and the encoder window flashes and disappears nearly instantly, resulting in 0-size files, it is most likely caused by your build of ffmpeg not having MP3 support. Check the documentation for your Linux distribution and see about compiling or downloading an appropriate replacement. (This shouldn't be an issue when encoding for Rockbox.)

Using ffmpeg (Windows / Linux / Mac OS X)

1) Install ffmpeg: on Windows, take the latest version from here. On Debian-based systems, "apt-get install ffmpeg" will most likely do the job. Mac OS X users can install ffmpeg via Fink.

2) Read the documentation here.

3) Run ffmpeg:

ffmpeg -i [inputfilename] -s [displayresolution] -vcodec mpeg2video -b [video bitrate] -ab [audio bitrate] -ac [audio channels] -ar 44100 -acodec [audio codec] [outputfilename]

Short explanation of the parameters:

ParameterInfoGood for iPod Photo/Color
-i filename of the source video you choose smile
-s display resolution, f.e. 1024x768 220x166
-vcodec video codec, must be "mpeg2video" mpeg2video
-b video bitrate 200k
-ab audio bitrate 192k
-ac audio channels 2
-ar audio samplerate, must be 44100Hz 44100
-acodec audio codec, f.e. mp3 mp3 or libmp3lame

The iPod photo/color settings have been tested with some shorter music videos (3-5min) and seemed to work quite well. Framerate stays at about 20fps, minimal frame skipping on fast camera movement visible. The video will be mpeg2-encoded with 192kbps mp3 sound at 44.1KHz and 2 Channels (Stereo). The video bitrate is 200kbps, increasing it will make MPEGplayer skip (too) many frames. The resolution of 220x176 will fill the iPod's whole display, except black borders caused by a different aspect ratio in the source video file.

If you choose to you can specify a fixed frame rate by including the following setting in the command line: -r framerate (where framerate is the desired number of frames per second). If you want to specify a frame rate other than 23.97 fps, 25.0 fps or 29.97 fps then you need to also set -strict 2.

Here is an interactive shell script (Unix/Linux) using ffmpeg to transcode videos. You may need to change the ffmpeg command in the script to use "mp3" instead of "libmp3lame", depending on your system.

Basic usage: infile.mpg outfile.mpg
Advanced usage: -o "options to pass to ffmpeg" infile.mpg outfile.mpg

For "options to pass to ffmpeg", you can try "-acodec copy" if you want the audio stream to be copied as-is and not to be transcoded (this works only if the source audio stream is in the right format, sample rate, etc.).You can also specify multiple file names to transcode as long as the source and target file names come in pairs.

Using VLC (Linux / Mac OS X / Windows)

Graphical Interface (Linux / Windows)

Go into Media menu, Convert/Save, and add the input file to the File Selection. Click Convert/Save to open the Profiles selector.

Create a new profile and choose:

Encapsulation = MPEG-PS

Video codec = MPEG-2 (set width and height for your player)

Audio codec = MP3, Sample Rate = 44100

Save the profile for future use.

Click Start

Command Line

Open a command line prompt and go to the VLC installation directory (default is C:\Program Files\VideoLAN\VLC\ ). Run the following command line:

vlc <input> :sout=#transcode{vcodec=mp2v,vb=600,width=<the width>,height=<the height>,

Note: You'll need to add quotes around #transcode{....}:std{...} on Linux or OS X.

Note: For versions before 0.8.6 you will need to change ":sout" to "--sout" and "dst" to "url".

vb stands for "video bitrate in kbits/sec". 600 kbits/sec should be good enough for most targets ... you might want to try a lower value for small screens.

ab stands for "audio bitrate in kbits/sec" and samplerate is the audio samplerate in Hz. Currently (2nd January 2007), MPEGplayer only supports 44.1KHz audio.

Important: mpeg2 allows only some very specific framerates. If encoding fails, it's likely that your source framerate doesn't comply. To change the frame rate, add fps=25 or fps=29.97 in transcode{...}. (This applies to the following .bat file too)

A convenient way for Windows users to achieve the same result is to use VLC-transcode.bat. Simply save this file somewhere and drag&drop a video onto it and it will be transcoded using the above settings. You will probably want to edit the file to change width and height (default is 320x240).

Using Mplayer/Mencoder (Linux / Mac OS X / Windows)

MEncoder uses the following command line format:

mencoder <input> <options> -o <output file>

Video options:

-ovc lavc  [output video module]
-lavcopts vcodec=mpeg2video [output video codec]
...vmax_b_frames=16:vb_strategy=2 [the player needs as many b-frames as possible, to ease decoding and frame skipping]
(note: specify the video bitrate with: mpeg2video:vbitrate=<bitrate>)
-vf scale,harddup [scale the video, remove duplicate frames]
-ofps <fps> [output frames per second, depending on the target, adjust as needed]
-zoom [when scaling, zoom rather than crop]

Audio options:

-oac lavc [output audio module]
-lavcopts acodec=mp3:abitrate=192 [output audio codec and bitrate, mp1/mp2/mp3 can be used]
(note: if your video already has a compatible audio track simply use '-oac copy' to copy it to the output file without transcoding)
-af resample=44100:0:0 [resample to 44.1 kHz, otherwise it won't play at proper speed]

In a terminal do :

mencoder <input> -of mpeg -oac lavc -lavcopts acodec=mp2:abitrate=96:vmax_b_frames=16:vb_strategy=2 -af resample=44100:0:0 -ovc lavc -lavcopts 
vcodec=mpeg2video:vbitrate=<bitrate> -vf scale=<width>:<height>,harddup -ofps 25 -o <filename>.mpg

Other useful options : -ss start position in the input ( -ss 1:20:00 ) -endpos lenght of the output ( -endpos 1:00 )

You can use mpeg1video for the vcodec= instead of mpeg2video

The man page of mencoder :

Here is an example BAT file for encoding files in Windows with Drag and Drop. The new .mpg file will be made in the same folder as the .bat file (you can even leave the bat on your PMP). Change the settings to your liking(the path to mencoder), I am using these settings on a Gigabeat F.

  • encode.bat: Example BAT file for encoding files with mencoder

Using MediaCoder (Windows)

MediaCoder offers a point&click alternative to encoding single files, folders or DVD/CD.

1) Download the latest version from their website and install, also download this .zip and unzip it to C:\Program Files\MediaCoder\extensions 2) Restart MediaCoder, add any files you want to encode (the GUI is very straight forward and their site is helpful if you have any problems) and click the "Extension" button at the top.

3) A pop-up window will give show you list of different devices, click "Rockbox Jukebox" under "Digital Media Player" This will open the Rockbox extension.

4) Here you can select your player and aspect ratio from the drop-down list. (some are grouped together, having the same screen dimensions)

5) Select your preferences and click "Play" to start/stop a preview, Click "Start" to begin the encoding. ("Preview" is to preview the encoded file after the encoding has begun)

6) For more advanced options, return to the main MediaCoder window and adjust the additional settings before starting. (you can also use the "Start" button in the main window)

Using Ultimate Video Converter (Windows)

Ultimate Video Converter is a simple application that supports nearly every Rockbox enabled player. To use it you must have .NET 3.5 or above.

1) Click the button in the input file options section to choose your file

2) Under "Mode" click the drop down box and choose "Device Mode"

3) Choose "Rockbox" at "Type/Maker"

4) Choose your player under "Device"

5) Click "Convert" and sit back while your file converts! Your file will be in your documents folder.

[To be completed: using mpeg2enc, ...]

Future Development (notes for developers)


CategoryPlugin: MPEG video player [H100DONE, H300DONE, H10DONE, iPod 1G2GDONE, iPod 4GDONE, iPod ColorDONE, iPod MiniDONE, iPod NanoDONE, iPod VideoDONE, iAudio M5DONE, iAudio X5DONE, GigabeatDONE, Sansa e200DONE, Sansa c200DONE, MR-100DONE, Sansa FuzeDONE]

r172 - 02 Nov 2012 - 00:04:10 - DavidHall

Revision r170 - 04 Jan 2012 - 06:28 - RusselKubes
Revision r169 - 17 Nov 2011 - 06:42 - MichaelSevakis
Copyright by the contributing authors.