Development: Video4Linux APIs

From LinuxTVWiki
Jump to navigation Jump to search

Video For Linux (often written as "Video4Linux", or abbreviated as "V4L", or sometimes "v4l") is an application programming interface (API). Essentially, the V4L API is a kernel interface for analog video capture and output drivers, and is applicable to most video streams not related to DVB devices or graphics cards -- though it also entails a few oddities such as analog radio and RDS services. Examples of devices which fall within the scope of V4L are, amongst others, webcams, MPEG encoders/decoders, digital video streamers, analog TV tuners and video capture devices.

The V4L API is currently in its second version (commonly referred to as "V4L2").

Video4Linux - The original version of the API

Prior to the development of an API, drivers for such devices described above formerly made use of ad-hoc interfaces.

Appearing late in the 2.1.x development cycle of the Linux kernel, Alan Cox introduced, based upon the interface used by the bttv driver, what would come to serve as the original version of the Video4Linux API (and which nowadays is sometimes referred to as "V4L1" for purposes of distinction within discussions).

The name "Video4Linux" was chosen in part for its parody of the name that Microsoft used for its somewhat analogous multimedia framework; Video for Windows (shortened as "VfW", and possibly sometimes as "V4W") . There is, however, no technical relation between the two.

Support for the v4l API was dropped from the 2.5.x branch with the 2.6.15 kernel release, but remains in the 2.4.x branch.

Video4Linux2 - the second version of the Video4Linux API

In 1999, Bill Dirks started the development of V4L2 with the intentions of fixing a number of design bugs and shortcomings that were present in the original V4L API. One particular incentive for development V4L2 was for the possibility of adding support for a wider range of devices. The API was revised again in 2002, prior to its inclusion into the Linux 2.5.x/2.6 kernel.

One of the aspects under this version of the API is that V4L2 drivers include a compatibility mode for V4L1 based applications -- though practically speaking, support for this can be incomplete and it is therefore recommended that devices with V4L2 support be used in V4L2 mode.

Today, V4L2 continues to serve the Linux community. Further work on this version of the API ensues -- focusing on the addition of improvements and enhancements, while at the same time maintaining compatibility with existing drivers and applications. In addition, efforts began in 2006/2007 towards developing FreeBSD drivers with a V4L2 interface.

If you have questions or ideas regarding the API, please write to the Video4Linux mailing list. One may also wish to read through some suggestions for enhancing v4l2, as well as the proposal of a V4L2 Userspace Library.

In addition, Jon Corbet started, in October 2006, publishing a series of articles to document V4L2 internals, including video_ioctl2, at lwn:

Video4Linux3 - perhaps a future version of the API

There has been no formal pursuit of a next generation release for the Video4Linux API, so "V4L3" as it may be is strictly a theoretical label for any such development that may occur. Discussion of such is best suited for the wide audience entertained by the V4L maillist. There is, however, a few thoughts on the matter that have already been placed with in the wiki; see: