Skip to content
zetok edited this page Aug 30, 2015 · 1 revision

Video

Rotating/flipping webcam data stream (and other issues)

Currently qTox doesn't support adjusting the video stream obtained from webcams. This may change in the future.

In some laptops, the camera has been assembled upside-down. To have the image correctly displayed it is required to flip the stream vertically.

One way to workaround this is by using a kernel module that creates a virtual video (webcam) device v4l2loopback and ffmpeg to transform the original video with one or more filters.

First, compile and install v4l2loopback. After modprobe v4l2loopback and if everything worked correctly you should now see a /dev/videoX device that didn't exist before. If you have only one video device on your machine, the new one will likely be video1.

Next you can use ffmpeg to process the original stream and redirect it to /dev/video1. To do this, open a new terminal window and run: ffmpeg -f v4l2 -i /dev/video0 -f v4l2 /dev/video1. If you have an activity led on your webcam, it should now be on.

You can now start qTox, go to Settings > Audio/Video and on Video device select Dummy video device .... If all is good you should see video as if you had selected the webcam device.

For the original issue of the image being upside-down, you need to enable the vflip filter by adding -vf "vflip". Go ahead and try running: ffmpeg -f v4l2 -i /dev/video0 -vf "vflip" -f v4l2 /dev/video1 You should now see the preview video image on qTox shown correctly (or upside-down if it wasn't broken before). If you also wanted to flip the image horizontally you would use: ffmpeg -f v4l2 -i /dev/video0 -vf "vflip,hflip" -f v4l2 /dev/video1

For any further manipulation check all the available filters with: ffmpeg -filters. Note that the list also includes audio related filters. In this case only the ones concerning video matter.

Clone this wiki locally