2

I have been trying to setup my DSLR to be a webcam with the following command: gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -threads 0 -f v4l2 /dev/video0 this however results in the following error:

hutber@hutber:~/v4l2loopback-master$ gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -threads 0 -f v4l2 /dev/video4
ffmpeg version N-49161-g50e194e6e1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 30.100 / 56. 30.100
  libavcodec     58. 53.101 / 58. 53.101
  libavformat    58. 28.101 / 58. 28.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 55.100 /  7. 55.100
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Capturing preview frames as movie to 'stdout'. Press Ctrl-C to abort.
[mjpeg @ 0x6d04900] Format mjpeg detected only with low score of 25, misdetection possible!
Input #0, mjpeg, from 'pipe:':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 640x426, 25 tbr, 1200k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> rawvideo (native))
[video4linux2,v4l2 @ 0x6d07d00] Unable to open V4L2 device '/dev/video4'
Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory
Error initializing output stream 0:0 -- 
Conversion failed!

However this errors to create the dummy device, that at the same time is not accessible

hutber@hutber:~/v4l2loopback-master$ v4l2-ctl --list-devices
Dummy video device (0x0000) (platform:v4l2loopback-000):
    /dev/video2

Failed to open /dev/video0: No such file or directory

I would like the /dev/video0 to be available to use as a webcam and believe the issue lies somewhere in the v412.

[Edit]

After restarting the machine I now see:

hutber@hutber:~$ v4l2-ctl --list-devices
Failed to open /dev/video0: No such file or directory

It says there is a Dummy Video Device, but I cannot see any devices when trying to use the dummy video.

enter image description here

  • 1
    Run sudo modprobe v4l2loopback as shown in Is there any way ffmpeg send video to /dev/video0 on Ubuntu? and then show output from v4l2-ctl --list-devices. – llogan Apr 26 at 19:03
  • Thanks Llogan, I see you're helping on both quesitons. Thank you. I have updated with a screenshot. – Jamie Hutber Apr 26 at 20:28
  • If I reset my machine, then the Dummy video device will no longer be there, but I will still experience the same errors when trying to pipe through to ffmpeg – Jamie Hutber Apr 26 at 20:34
  • Now try gphoto2 --stdout --capture-movie | ffmpeg -i - -c:v rawvideo -f v4l2 /dev/video0 – llogan Apr 26 at 20:46
  • 1
    Does this answer your question? Use webcam from laptop on desktop pc – Raffa Apr 26 at 21:08
0

Unable to open V4L2 device '/dev/video0'

or

Failed to open /dev/video0: No such file or directory

Two potential problems:

  • Wrong video number. The number can change depending on the number of existing webcams. Check output of ls /dev/video* or v4l2-ctl --list-devices.
  • v4l2loopback module is not enabled or installed. If you already installed v4l2loopback run sudo modprobe v4l2loopback. Then check output of ls /dev/video* or v4l2-ctl --list-devices. If you did not yet install it see Is there any way ffmpeg send video to /dev/video0 on Ubuntu?.

Unknown V4L2 pixel format equivalent for yuvj422p

The V4L2 output device only supported a limited number of pixel formats. Add the format filter to your command to give it a compatible pixel format:

gphoto2 --stdout --capture-movie | ffmpeg -i - -vf format=yuv420p -f v4l2 /dev/video0
| improve this answer | |

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.