I've recently changed from Windows to Ubuntu and I'm trying to get my DSLR camera (Canon Rebel T3) to function as a webcam so I can make those cool videos about old racing games and its cars (remember the Renault Espace with an F1 engine from Gran Turismo 2?).

I've followed the steps from this link and watched this video a couple of times, but when I try to insert this command:

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

It gives me this error:

ioctl(VIDIOC_G_FMT): Invalid argument
Could not write header for outputfile #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --

Or the terminal gets stuck.

The gphoto2 detects my camera and gives all the information about the camera, but when I try to take a picture, it doesn't save anywhere.

When I go to VLC, my camera isn't in the capture devices, so something might be wrong I guess.

Also, when I try to edit the /etc/modules to register the modprobe, I'm unable to edit anything. I imagine there is something wrong, but since I'm an early Ubuntu user, maybe it's the lack of knowledge.

Attached to this post is my system configuration (maybe that's what's causing the issue).

Kind regards,

  • Try other pixel formats. yuv420p is not the only one and your cam may not support it. Commented Dec 5, 2022 at 18:38
  • Also try ffplay /dev/video0 to see if it can be played. If it can, launch it again in verbose log mode to see what pixel format it is using Commented Dec 5, 2022 at 18:40


You must log in to answer this question.

Browse other questions tagged .