alfalfa
alfalfa copied to clipboard
Always Get Camera error
When I Try to launch sender I got something like this. salsify-sender --device /dev/video0 127.0.0.1 10002 1337 terminate called after throwing an instance of 'std::runtime_error' what(): couldn't configure the camera with the given format zsh: abort salsify-sender --device /dev/video0 127.0.0.1 10002 1337
I Tried 3 web cameras, no one worked.
Hi @pahan40,
Try using --pixfmt NV12
or --pixfmt YUYV
or --pixfmt YU12
. Those are the only three pixel formats that are implemented (check out src/input/camera.hh
).
Best, Sadjad
Already tried - no effect
Can you try running v4l2-ctl --device /dev/video0 --list-formats
to see what formats your camera supports? (It's in v4l2-utils
package in Ubuntu).
--Sadjad
Here it is
[19:58:40] [pavel]<pavel>% v4l2-ctl --device /dev/video0 --list-formats
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUYV 4:2:2
Index : 1
Type : Video Capture
Pixel Format: 'MJPG' (compressed)
Name : Motion-JPEG
That's weird, it should work with --pixfmt YUYV
, but for some reason it doesn't. Try running v4l2-ctl --list-framesizes=YUYV
to make sure your camera supports 1280x720
(it most likely does, but doesn't hurt to check.)
I suggest you try getting real-webcam
program (in src/salsify/
) to run. The command line arguments are similar to salsify-sender
.
Based on the information you posted here, this should work for you:
real-webcam --device /dev/video0 --pixfmt YUYV
If none of the above worked, I might have a hack that works for you.
- Make sure you have
ffmpeg
installed. - Try running
ffplay -i /dev/video0 -f v4l2 -s 1280x720 -input_format mjpeg
to make sureffmpeg
can actually read from your camera. - Install
v4l2loopback-dkms
package. It allows you to create a fake webcam. - Run
modprobe v4l2loopback
to start the fake camera module. Now, you'll see that a/dev/videoX
device is added (probably/dev/video1
, if you only have one camera). - Use ffmpeg to forward your webcam to that fake webcam, in a format that Salsify expects:
ffmpeg -f v4l2 -input_format mjpeg -r 30 -s 1280x720 -i /dev/video0 -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video1
- Confirm that
real-webcam
program works:real-webcam --device /dev/video1 --pixfmt YU12
- Now you can use
salsify-sender
.
Please let us know how it goes!
--Sadjad
Yes. Seems that command works fine real-webcam --device /dev/video1 --pixfmt YU12 and also salsify-sender now works fine, but the picture from camera always freeze for a few seconds and seems it works very slow...
got the same error
ioctl: VIDIOC_ENUM_FMT Index : 0 Type : Video Capture Pixel Format: 'MJPG' (compressed) Name : Motion-JPEG
Index : 1 Type : Video Capture Pixel Format: 'YUYV' Name : YUYV 4:2:2
Have you tried running salsify-sender
with --pixfmt YUYV
flag?
I met same problem in my scenario, after checking my camera format by "v4l2-ctl -d /dev/video0 --all" : Format Video Capture: Width/Height : 640/480 Pixel Format : 'YUYV'
Then I change code in "salsify-sender.cc" to adjuct width and height from hard code "1280 720" to "640 480" , it works fine then. But the received video don't have colors but only gray video displayed.
I met same problem in my scenario, after checking my camera format by "v4l2-ctl -d /dev/video0 --all" : Format Video Capture: Width/Height : 640/480 Pixel Format : 'YUYV' Then I change code in "salsify-sender.cc" to adjuct width and height from hard code "1280 720" to "640 480" , it works fine then. But the received video don't have colors but only gray video displayed.
I'm same with you.the received video don't have colors but only gray video displayed, I wonder if you have solved the problem?