18.04 ffmpeg: Play mp4 on fake webcam, "Conversion Failed!"
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/video2The 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.
11 Answer
I ran into the exact same issue a while ago.
In short, you need to update the driver from the latest sources at and recompile the module.
Don't forget to remove the stock v4l2loopback_dkms driver!
For more information on the topic, look for instance at: