1

Trying to create a new fake webcam device (/dev/video2) and play a video on it so I can use it as a virtual webcam.

Steps I took:

sudo apt-get install v4l2loopback-dkms
sudo modprobe v4l2loopback
sudo depmod -a

ffmpeg -i vid1.mp4 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video2

The error from the ffmpeg command:

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!

No idea what to do.

1
  • 1. Show the complete output from your ffmpeg command. 2. Add -re input option. 3. Try removing the v4l2loopback-dkms package and compile v4l2loopback. – llogan Apr 9 '20 at 21:48
1

I ran into the exact same issue a while ago.

In short, you need to update the driver from the latest sources at https://github.com/umlaeute/v4l2loopback and recompile the module.

Don't forget to remove the stock v4l2loopback_dkms driver!

For more information on the topic, look for instance at: https://github.com/umlaeute/v4l2loopback/issues/247

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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