GSOC Proposal: Webcams in Phonon

Trever Fischer tdfischer at
Mon Mar 29 18:46:26 BST 2010

Hash: SHA1

Hi, I'm Trever Fischer (tdfischer on IRC, when my ISP permits). I'd like
to work
on getting webcam support into Phonon. I've read the description from the
videolan wiki
and its really what I've been planning on doing for a while
but school got in the way. Doing GSOC in summer, I won't have 21 credit hours
and running a good sized student organization pounding down on me :)

Between classes, I've been working on adding v4l2 support to xine with the
v4l2 plugin I wrote, and which is now in their mercurial repository. That
me a working backend for my one good webcam, which doesn't support v4l1.

My proposal for adding video devices to phonon follows. Any comments or
criticisms are welcome!

- --
Phonon Video Devices - Trever Fischer

Phonon is a KDE API for handling multimedia, which is designed to hide all
annoying details involved such as codecs, outputting to devices, routing
of multimedia to different devices, and recording media.

Currently, Phonon lacks a working API for video capture. It currently
only 2 lines of code (not counting GUI setup) to play any kind of video file:

     Phonon::VideoPlayer *player =
         new Phonon::VideoPlayer(Phonon::VideoCategory, parentWidget);
(taken from

It should be just as easy to play a webcam's input. Idealy, the code would be
similar to:

    Phonon::VideoPlayer *player =
        new Phonon::VideoPlayer(Phonon::VideoCategory, parentWidget);
    QList<Solid::Device> webcams =
    Solid::Video webcam = webcams[0].as<Solid::Video>()

As you can see, the Solid hardware libary would be involved in the
and description of devices. We should be able to take a video device from
and pass it immediately off to Phonon, which then handles opening the
device and
creating a stream.

The tasks for this project would be:

1. Design a video capture API for Phonon which:
1.a Allows for low-level tweaking of the device such as specifying video
formats, audio formats, buffer sizes, color correction, etc. Pretty much
    everything allowed for under Video4Linux2, the Windows API, and the
Mac API.
1.b Allows the simple 2 lines of phonon code above.
1.c Follows the strict qt-only design currently used.
2. Implement video capture support into the VLC and/or xine backends.
3. Build a simple video viewer application for testing, which can then
turn into
a useful webcam capture application, similar to Photobooth for Mac OSX.

1. Design a video capture API

There currently is an experimental audio and video capture API in the
Phonon git
epository under phonon/experimental which hasn't had any significant commits
since November 20th, 2009, not counting the commits I myself made in December
2009 to phonon/experimental/videocapture/ which fixed a regression of losing
v4l2 support for my webcam. Regardless of age, this experimental API can
as an excellent starting point for the first task.

2. Implement video capture support into the VLC and/or xine backends.

A working API is useless if there isn't a working backend.

Support for the new video capture API would need to be added first to the
existing VLC backend, and to the other backends if time permits.

3. Build a simple video viewer application for testing

A good API needs real-world use to find bugs, inconsistencies, and design
problems. As part of this proposal, a simple application would need to be
created that uses the capture API to take snapshots and record video.
Later on,
this application can be extended to provide a use similar to Photobooth
for the
OSX operating system. In Photobooth, the user starts the application which
displays a window showing the video stream from the primary webcam. From
they can take snapshots and record video, while at the same time applying
various entertaining image processing effects. Effects and a friendly
are beyond the scope of this project, as we only need a quick demo

Further work:
Once the project is complete, further work could be done to improve the
capture application to provide the experience described above. The video
capture support would also need to be implemented in the other phonon

I would expect to use at least a third of the time on designing and
the API which will be used far into the future. The other two thirds would
likely be spent on implementing the required backend support into the VLC
backend. If I am successful in producing a good design, writing a simple
application would take a few hours at most.

I am currently finishing my 3rd year of my undergraduate masters in Computer
Science at the University of Akron in Akron, Ohio, USA. I first started using
KDE on my Fedora Core 3 system around the time 3.3 was recently released.
then I have become my campus' Fedora Ambassador, created the microblog plasma
data engine, the Bubblemon plasma widget, device-automounter for
mounting removable storage, and various patches and commits to other parts of

In general I can be found in #kde, #kde-devel, #fedora, or #kde-cafe on
as tdfischer, whenever my ISP decides today is the day I don't get a 30

- --
Trever Fischer (tdfischer)
Fedora Ambassador, KDE Hacker
GPG: C40F2998 hkp://

Version: GnuPG v1.4.9 (FreeBSD)


More information about the kde-multimedia mailing list