HOWTO: - Flip Webcam Video - Cheese, Skype, etc.

Share your own howto's etc. Not for support questions!

HOWTO: - Flip Webcam Video - Cheese, Skype, etc.

Postby lkraemer » 2011-08-06 10:43

There is a good posting by Arminho on the Ubuntu website about the proper way to Flip the Video for your Computers Webcam so
it is oriented properly for Cheese & Skype.

http://ubuntuforums.org/showthread.php?t=838210&highlight=flip+webcam

http://ubuntuforums.org/showthread.php?t=838210&highlight=flip+webcam&page=24
Posting #234 on Page 24


Arminho states.....................................
It took me a while to fix this problem with my new ASUS K50AF running Lucid (32 Bit Version).
Finally the following approach worked - I hope this description will save you some time:

1. Check if the wrapper helps your application
Code: Select all
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so <your application>

(e.g.)
Code: Select all
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype

If yes, continue as suggested in postcount=259 (create the wrapper & use it to call the application).
http://ubuntuforums.org/showthread.php? ... am&page=26

Code: Select all
#!/bin/bash
#
#Use the wrapper to flip the video.
#
#http://ubuntuforums.org/showthread.php?t=838210&highlight=LIBV4LCONTROL_FLAGS&page=26
#Posting 259
#
#VLC with NO User controls command.
#/usr/bin/cvlc -vvv v4l2:///dev/video1:input=5:width=720:height=576 :norm=ntsc :fps=25 :input-slave=alsa://plughw:1,0 --audio-desync=-.40 --demux rawvideo 2>vlc.err
#
#
#VLC with user controls command.
#/usr/bin/vlc -vvv v4l2:///dev/video1:input=5:width=720:height=576 :norm=ntsc :fps=25 :input-slave=alsa://plughw:1,0 --audio-desync=-.40 --demux rawvideo 2>vlc.err
#
#/usr/bin/cvlc -vvv v4l2:///dev/video1:input=5:width=720:height=576 :norm=ntsc :fps=25 :input-slave=alsa://plughw:1,0 --audio-desync=-.40 --demux rawvideo 2>vlc.err
#
#
#The following is for Slackware 14 (32 Bit)  -- (64 Bit may vary in lib locations)
export LIBV4LCONTROL_FLAGS=3
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so vlc
#


If no, continue as follows:

2. Download current libv4l Sources (I used Version 0.8.0)
2.a Download from http://freshmeat.net/projects/libv4l
2.b Unpack to your Home-Dir (e.g. ~/v4l-utils-0.8.0/)

3. Identify your Webcam & Board
3.a.
Code: Select all
lsusb

to get the device ID (Format (hex) <XXXX>:<YYYY>)
BUS ddd Device ddd: ID XXXX:YYYY Your Webcam
3.b. Create a file containing the Board Vendor Name (e.g. vendor.txt)
Code: Select all
cat /sys/devices/virtual/dmi/id/board_vendor > vendor.txt

3.c. Create a file containing the Board Name (e.g. name.txt)
Code: Select all
cat /sys/devices/virtual/dmi/id/board_name > name.txt

4. Update the Upside Down list of libv4l
4.a Open the control-File from the Source Folder in an ASCII editor (e.g.)
Code: Select all
gedit ~/v4l-utils-0.8.0/lib/libv4lconvert/control/libv4lcontrol.c

4.b. The file contains the list of "Upside down devices" at the start. Add the entry for your Configuration:
Code: Select all
{ 0x<XXXX>, 0x<YYYY>, 0, <VENDOR>, <NAME>,
      V4LCONTROL_HFLIPPED | V4LCONTROL_VFLIPPED },

Where: <XXXX> and <YYYY> is the ID of your webcam from lsusb
<VENDOR> is the content of vendor.txt (wioth all white spaces !!)
<NAME> is the content of vendor.txt (with all white spaces !!)

# 5. Compile and Install libv4l
5.a. enter the lib-source directory (e.g.)
Code: Select all
cd ~/v4l-utils-0.8.0/lib

5.b.
Code: Select all
sudo make clean

5.c.
Code: Select all
sudo make PREFIX=/usr

5.d.
Code: Select all
sudo make install PREFIX=/usr

6. Test the result
6.a. Start your application. If the image is correct now, the application uses libv4l. If not continue
6.b. Try the Wrapper:
Code: Select all
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so <your application>

(e.g.)
Code: Select all
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype

If the image is still upside-down be careful to doublecheck Vendor, Name and ID (everything is case sensitive AND whitespaces are important).
6.c. Alternatively (I did not try this option) you may use the control panel (System->Settings->Video4Linux or Applications->Media->Video4Linux Device Properties).
In some versions this panel includes a "Horizontal Flip"-checkbox.

It fixed my problem in Debian 6.0, on my Asus K52F Laptop.


Larry
Last edited by lkraemer on 2012-11-13 16:58, edited 5 times in total.
lkraemer
 
Posts: 171
Joined: 2011-02-09 05:02

Re: HOWTO: - Flip Webcam Video - Cheese, Skype, etc.

Postby Praxis » 2011-10-10 06:21

I added a stanza for my Fujitsu laptop:

{ 0x04f2, 0xb213, 0, "FUJITSU", "FJNBB16",
V4LCONTROL_HFLIPPED | V4LCONTROL_VFLIPPED },

make clean seemed to work but I got an error with the next command:
Code: Select all
root@meb: /home/user/bin/v4l-utils-0.8.5/lib # make PREFIX=/usr
make -C libv4lconvert all                                                                                                       
make[1]: Entering directory `/home/ed/bin/v4l-utils-0.8.5/lib/libv4lconvert'
cc -Wp,-MMD,"libv4lconvert.d",-MQ,"libv4lconvert.o",-MP -c -I../include -fvisibility=hidden -fPIC -DLIBDIR=\"/usr/lib\" -DLIBSUBDIR=\"libv4l\" -I../../include -I../../lib/include -D_GNU_SOURCE -DV4L_UTILS_VERSION='"0.8.5"' -g -O1 -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -o libv4lconvert.o libv4lconvert.c                                                           
In file included from libv4lconvert.c:26:0:
libv4lconvert-priv.h:25:21: fatal error: jpeglib.h: No such file or directory
compilation terminated.
make[1]: *** [libv4lconvert.o] Error 1
make[1]: Leaving directory `/home/user/bin/v4l-utils-0.8.5/lib/libv4lconvert'
make: *** [all] Error 2

Seems like the command didn't find something it was looking for, maybe I should use an older version of v4l-utils?
User avatar
Praxis
 
Posts: 73
Joined: 2006-12-19 00:00

Re: HOWTO: - Flip Webcam Video - Cheese, Skype, etc.

Postby lkraemer » 2011-10-18 23:48

Praxis,
You might want to Copy & Paste the command in 5C.

Code: Select all
sudo make PREFIX=/usr

as your command appears to be different. I think adding sudo will fix your problem.

lk
lkraemer
 
Posts: 171
Joined: 2011-02-09 05:02


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable