i can't use my digital camera ( Canon ixus 160) as webcam is there an application for that ? or just in the settings

Other solution.

List of gphoto2 supported cameras: http://gphoto.org/proj/libgphoto2/support.php

You need install gphoto, v4l2loopback-utils and ffmpeg.

Then

sudo modprobe v4l2loopback

and

gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video1

Now you have webcamera from your digatal camera.

  • I get this error (cut at top): Input #0, mjpeg, from 'pipe:': Duration: N/A, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1056x704, 25 tbr, 1200k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> rawvideo (native)) [swscaler @ 0x559c14f77de0] deprecated pixel format used, make sure you did set range correctly [v4l2 @ 0x559c14f42fc0] ioctl(VIDIOC_G_FMT): Invalid argument Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- Conversion failed! ➜ ~ – noreabu Nov 4 '17 at 11:01

This can be done but requires a number of steps. First, you must install gphoto and v4l2loopback-utils.

sudo apt-get install gphoto2 v4l2loopback-utils

Plug in your camera via USB. Then run gphoto2 --abilities to see if your camera is capable of doing this. Here's the output when connecting a Canon EOS 1200D

enter image description here

Then run sudo modprobe v4l2loopback to activate the kernel module needed to create a video device from your camera.

I've seen older tutorials on this task that use gst-launch-0.10 to achieve the next step of this task (e.g. this one). I am using Ubuntu 17.04 which uses gst-launch-1.0. Below is the updated command to create a video device from your digital camera:

gphoto2 --stdout --capture-movie | gst-launch-1.0 fdsrc ! decodebin3 name=dec ! queue ! videoconvert ! v4l2sink device=/dev/video1

This will create a video device in /dev/video1, which you can now use in programs like VLC.

If you see any errors about the device being in use you need to kill the gvfs-gphoto2-volume-monitor process by running killall gvfs-gphoto2-volume-monitor.

  • 1
    I get this: ➜ ~ gphoto2 --stdout --capture-movie | gst-launch-1.0 fdsrc ! decodebin3 name=dec ! queue ! videoconvert ! v4l2sink device=/dev/video1 Setting pipeline to PAUSED ... Nehme Vorschaubilder als Film in 'stdout' auf. Drücke Ctrl-C zum abbrechen. ERROR: Pipeline doesn't want to pause. ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: »/dev/video1« ist kein Wiedergabegerät. Additional debug info: v4l2_calls.c(642): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Capabilities: 0x5200001 Setting pipeline to NULL ... Freeing pipeline ... – noreabu Nov 4 '17 at 10:57
  • @noreabu sounds like a bug that you should report – hellocatfood Nov 4 '17 at 19:32

I wanted to do that once to set up a basic webcam to see what my animals did all day while away at work, lol. You might have to set up streaming with vlc.

https://help.ubuntu.com/community/Webcam

  • Your answer/the link doesn't actually address the specific problems. – hellocatfood Dec 4 '17 at 16:16

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.