How to create an embedded video player

Posted on 2010-08-20
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 (buildroot.uclibc.org) 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 2000 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 (www.mplayerhq.hu) 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Starting up a Project

743 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