| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Chapter summary:
vidl1is the old VXL library for managing video data. It has been replaced byvidl. This library used to be calledvidl, and the new library used to be calledvidl2.vidl1supports the following general functions:
- Reading Video Files
- Saving Video Files
- Indexing through Video Files
vidl1has the central notion of a movie, which is turn is a sequence of clips. A clip is simply a sequence of frames. A frame can return avil_image_viewcorresponding to the frame, using the coder/decoder codec for a given video format.Large videos can be read a frame at a time from the codec so it is not necessary to load an entire video into memory in order to access individual frames.
Currently vidl1 supports the following codecs:
- List of images
- AVI
- MPEG (not mature and read only)
There are plans to extend to DVD with a read-only capability
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The main interface class in vidl1 is vidl1_movie it contains a
list of clips. The class is meant to reflect a movie structure which is
typically segmented into short independent frame sequences, i.e. clips. The
movie structure hides the clip segments from the user by providing an iterator
that plays through the whole movie. However, most research experiments involve
single clip sequences. Currently a movie file is loaded as a single clip.
The standard interface for getting frames from the movie is through an iterator as illustrated in the following example:
#include <vidl1/vidl1_io.h>
#include <vidl1/vidl1_frame.h>
#include <vidl1/vidl1_movie.h>
//load the movie
vidl1_movie_sptr my_movie = vidl1_io::load_movie("video.avi");
//loop through the frames
vidl1_movie::frame_iterator fit(my_movie);
for (fit = my_movie->first(); fit != my_movie->last(); ++fit)
{
vil_image_view<vxl_byte> image = fit->get_view();
// do something with the image
...
}
|
Most users will operate in this way in accessing the frames of a movie. The
frame_iterator allows the user to set forward and backward through the
movie or to access a specific frame.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Access to video file formats is provided through a standardized interface called the codec, which stands for coder/decoder. The key tasks of the codec are to load, save and probe a video file. The probe detects if the format of a given file corresponds to any of the available codecs.
The codecs are automatically registered at compile time. There is no need to explicitly register codecs as there was in the past. All codecs that are compiled will be registered.
It is difficult to find portable codecs that are open source code for the popular video formats. We are working on an MPEG codec (the current implementation doesn't read the header information) that will work on both unix and windows. Two AVI codecs are also available. One uses native windows dlls for handling AVI files and compiles in windows. The other uses the open source avifile library and compiles in linux. Unfortunately, the avifile library also uses the windows dlls and therefore is only available on x86 machines.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As we have already seen the vidl1 library supports reading and writing
video files. These functions are handled by the class vidl1_io.
The key methods are illustrated by the following example:
#include <vidl1/vidl1_io.h>
#include <vidl1/vidl1_movie.h>
...
vidl1_movie_sptr avi_movie = vidl1_io::load_movie("movie.avi");
if (!avi_movie) {
vgui_error_dialog("Failed to load movie");
return;
}
...
//later we save the avi movie as a set of images in the indicated directory
if (!vidl1_io::save(avi_movie, "image_directory" , "ImageList"))
{
vgui_error_dialog("Failed to save movie");
return;
}
...
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The vidl1 interface is simple and hides most of the difficult aspects of
dealing with video files. Getting MPEG to work at least in read mode across
platforms is an important next step.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Rumpelstiltskin on November, 22 2009 using texi2html 1.78.