How to create an embedded video player

Posted on 2010-08-20
Last Modified: 2013-12-13

Hello, I've got an at91sam9261 up and running, and it is working (more or less) with an LCD (640x480), and I can draw pixels and pictures to it just fine.  (Currently we are not using an OS, just writing C code off a main loop.)

But we're thinking about what it would take to play video.  Say I started with a small file of AVI, MPG, WMV format, what do I need to do to play this on the LCD.  

I assume we have all the hardware we need -- control of an LCD and a fairly powerful processor.  But what do I need in terms of software?  Words like "codec" come to mind... are these commercially available, can we write one, are there open source C libraries?  I assume this is a fairly solved problem.

Anyway, any insight from someone who's at least thought through playing videos on embedded would be very helpful.  Thanks.

Question by:riceman0
  • 2
LVL 12

Expert Comment

ID: 33498602
The simplest solution is to have an embedded linux distribution available on the board with an open source media player.
Atmel Sistem On Chip are well supported in linux - both with glibc and uclibc libraries.
Writing a media player even to provide support only for one kind of file is a very difficult task, and probably would require some feature that an operating system would support (a scheduler?).
So I suggest you to take an embedded linux distribution and start experiment with it.
If your board manufacturer have a linux distribution ready, start with it.
Otherwise, try build your own - it's not an easy task, but it's easier than writing a player.
I currently use buildroot ( but there are many other and it's a very small footprint.

Hope that helps.

Author Comment

ID: 33515702

Thanks, it would be logical to bring in an OS at this point.  But say I didn't want to do that, seems like I shouldn't have to take on an entire OS in order to decode data of a well-known format.  Is there is no magic C library, I am supposing the function:

void play_avi_data(char * from_avi_data, char * to_display_buffer, unsigned int width, unsigned int height)

or maybe

void draw_avi_frame(char * from_avi_data, char * to_display_buffer, unsigned int width, unsigned int height, unsigned long frame_number)

which you call at the desired frame rate.  This seems like it is complex but eminently doable, and whoever has written this function would sell it.

What is it that makes it not this simple?

LVL 12

Accepted Solution

HappyCactus earned 500 total points
ID: 33518947
AVI is only a container format. It can contain various kind of media for video (mpeg 1, 2, 4...) and audio (mpeg 1layer3, pcm).
You can for sure take an already done codec and port it to your platform, adapting the algorithm to your interface.
But in these last years, many open source project have already done this on various open (and closed) source OS. There are GPL projects, but also LGPL (or maybe BSD) licensed libraries are available: all are tied to an OS.
So, in my humble opinion, it's easier and safer porting a linux OS to a very common platform such as ARM is, than rebuilding the wheel to support a very specific format such as AVI with mpeg4 video and mp3 audio...

In both cases, I would see for MPlayer ( and vlc, in one case to install it on your linux os, in the other to take inspirations from sources...
But they are huge projects... see also the documentation for developers.


Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 91
Adding Namespace to the second node of the xml 16 73
Please explain: Aspect Oriented Programming 2 95
Memory going from 12gb to 64gb or 96gb. worth it? 15 177
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question