Solved

How to create an embedded video player

Posted on 2010-08-20
3
540 Views
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.

0
Comment
Question by:riceman0
  • 2
3 Comments
 
LVL 12

Expert Comment

by:HappyCactus
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.
0
 

Author Comment

by:riceman0
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?

0
 
LVL 12

Accepted Solution

by:
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 (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.

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
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.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now