How to create an embedded video player

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.

Who is Participating?

Improve company productivity with a Business Account.Sign Up

HappyCactusConnect With a Mentor Commented:
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.

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.
riceman0Author Commented:

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?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.