world leader in high performance signal processing
Trace: » mplayer

Running MPlayer on Blackfin Linux

This page describe steps to build MPlayer for Blackfin Linux, and use the mplayer to play video files on BF537-STAMP board.

  • Tested media file format: avi, mov(QuickTime)
  • Tested video codec: ffmpeg: mpeg4, h264
  • Tested audio codec: libmad(mp3), faad(aac)

MPlayer has really only been tested on 2007R1 and newer releases with the FDPIC ELF format. If you're having trouble getting it to work on older versions, please just upgrade.

Prepare Kernel

Setup video and audio drivers in kernel, also enable file system containing media files.


MPlayer video output should work with any framebuffer device such as:

For sound output, the ad1981 part on the bf537-ezkit should work.

If you want to play video files off of say a USB thumb drive, then you can use these settings via the usb_ez-extender:


Note: We only enable SL811HS. We don't use ISP1362 here. Here we use GPIO PF5, please make sure setting jumper 15-16 on the USB-addon card.

For peak performance, you should:

  • use CCLK of 525 MHz
  • use SCLK of 131 MHz
  • enable write back mode for data cache


Default kernel configuration enables LQ043 LCD and AD1980 Audio driver.

Build Mplayer

1. Select Mplayer:

 Blackfin app programs  ---> 
        [*] MPlayer and mencode 

2. Build in FDPIC format:

 Blackfin build Options  ---> 
       (FDPIC) Binary format  

Setup the Hardware

For BF537-STAMP:

  1. Connect LCD card to PPI and TIMERS port on BF537-STAMP
  2. Connect AD1981B sound card to SPORT0
  3. Connect USB-add-on card to extension slot
  4. Set SW5 to all off
  5. Set SW6 to 1,2 on, 3,4 off
  6. Connect USB card SL811 Jumper 15,16, corresponding to kernel setting (GPIO PF5)

Play movie

  • Prepare media file, you can use bellow command to convert an media file to proper size.

mencoder ${INPUT_FILE} -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=${WIDTH}:${HEIGHT} -sws 2 -oac copy -o new_${INPUT_FILE}
  • Copy bellow files to usb-disk
    • MPlayer built in FDPIC format: mplayer
    • Media files:
    • mplayer test script:
  • Plug usb-disk to USB-add-on card and mount it
# mount -t vfat /dev/sda1 /mnt
  • Play it:
# ./ test.avi

This scrip install LCD and Sound Card driver module:

# modprobe bf537-lq035 landscape=1
# modprobe snd-ad1981b

then it starts mplayer:

# ./mplayer -vo fbdev -ao oss -ac mad -quiet -fs -framedrop ${MOVIE_NAME} 

Always force libmad (-ac mad)

libMAD is a high-quality fixed point MPEG audio decoder. It supports MPEG-1 and the MPEG-2 extension to lower sampling frequencies, as well as the de facto MPEG 2.5 format. All three audio layers — Layer I, Layer II, and Layer III (i.e. MP3) — are fully implemented.

MPlayer OSD menu

MPlayer has a completely user definiable OSD Menu interface.


1.compile MPlayer by passing the --enable-menu to ./configure

 Add to uclinux-dist/user/blkfin-apps/mplayer/Makefile   

2.make sure you have an OSD font installed

Bitmap Fonts

If you wish or need to employ bitmap fonts, download a set from the mplayer homepage You can choose between various ISO fonts and some sets of fonts contributed by users in various encodings.

Uncompress the file you downloaded to ~/.mplayer or $PREFIX/share/mplayer. Then rename or symlink one of the extracted directories to font, for example:

ln -s ~/.mplayer/arial-24 ~/.mplayer/font

Fonts should have an appropriate font.desc file which maps unicode font positions to the actual code page of the subtitle text. Another solution is to have UTF-8-encoded subtitles and use the -utf8 option or give the subtitles file the same name as your video file with a .utf extension and have it in the same directory as the video file.

3.copy etc/menu.conf to your .mplayer directory

You can find example .conf files in your mplayer source etc directory.

4.copy etc/input.conf to your .mplayer directory, or to the system-wide MPlayer config dir

Controls configuration

MPlayer allows you bind any key/button to any MPlayer command using a simple config file. The syntax consist of a key name followed by a command. The default config file location is $HOME/.mplayer/input.conf but it can be overridden using the -input conf option (relative path are relative to $HOME/.mplayer).

You can get a full list of supported key names by running mplayer -input keylist and a full list of available commands by running mplayer -input cmdlist.

In order to bring up the menu add

c menu up

to your input.conf file

5.check and edit input.conf to enable menu movement keys (it is described there).

6.start MPlayer by the following example:

    ./mplayer -vo fbdev -ao oss -ac mad -quiet -fs -menu ${MOVIE_NAME} 

7.push any menu key you defined

Play Stream from VLC

Here we have VLC running on one BF-537 STAMP board as a streaming server. It captures vedio stream from camera sensor, encodes it and sends to the player.

On another STAMP board MPlayer runs.

  • Start VLC streaming server:
    root:> vlc v4l:/dev/video0:size=320x240:fps=15 --sout '#transcode{vcodec=mp4v}:rtp{dst=,port=1234,sdp=rtsp://}' --no-audio --ttl 1 
  • Play the stream with MPlayer:
    root:> mplayer -fps 15 rtsp://