Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

VideoThru Lab

From eLinux.org
Revision as of 14:50, 2 January 2012 by Yoder (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


This is a lab exercise that is being offered at ICASSP 2011 in Prague. In this lab you will inspect, compile and run code that uses Video 4 Linux 2 (v4l2) to input live video from a web cam and displays it on the Display SubSystem (DSS).

Compiling the code

Here are the steps to take:

  • Open a terminal window. Application:Accessories:Terminal
  • In the terminal:
# cd VideoThru
# ls

The VideoThru directory contains labs I've used to teach video on the Beagle.

  1. osd_setup shows how to write to a frame buffer.
  2. video_record shows how to capture video and store it in a file.
  3. video_playback takes raw video from a file and play it.
  4. video_loopthru has the students combine the first two labs to do real-time video io.

We only have time for one lab, so do the last one.

# cd lab07d_video_loopthru/app
# ls

main.c gets everything going, but video_thread.c is where the action is. It calls the routines that open the video input and sets up the frame buffer. Take a look at it.

# gedit *.c showOSD

Running

You need to run showODS before running the video apps. This makes the video frame buffer visible and sets the transparency. Take a look at it before running it. You can reset the screen by running resetOSD.

Be sure to have a web cam plugged in.

# ./showOSD
# ./videoThru_DEBUG.Beagle
# ./resetOSD

It will run until you hit ctrl-C. Once you are sure it is working, try building everything from scratch.

# make clean
# make

By default make creates a 'DEBUG' version of the app.

Experiment with the code

Now that you have something working, play around a bit. git is installed so you can preserve the present contents of the files with:

# git init
# git add Makefile *.c *.h showOSD resetOSD
# git commit -m "Initial commit"

If needed you can use git to retrieve the original version of the files.

Here are some things to try:

  • There is some code commented out that draws to the frame buffer. Uncomment out the code and try running it. Try changing the color or shape.
  • Modify showOSD to change the location of the video on the screen. Change the transparency. Change the size and aspect ratio.
  • Here's an extra challenge, using the overlay managers, get the video to appear in two locations on the screen.

Call the instructors over when you have something interesting.