You are not logged in.
I have a little AV to USB capture card called a MacroSilicon MS210x according to lsusb. When plugged in, it generates a /dev/video0, /dev/video1, and /dev/media0 device and within OBS Studio it can be captured as "Camera 1". This leaves a black screen, even when a VCR or something similar is plugged in. When I try to access it in VLC by navigating to Media -> Open Capture Device and opening /dev/video0, VLC buffers for a moment and then gives this error:
v4l2 error: cannot set format: Input/output error
v4l2 error: not a radio tuner device
v4l2 error: cannot set format: Input/output error
Interestingly, OBS shows the same errors when I checked its log.
People on Ubuntu had no problems and also an Artix user reported that they had the AV cord in Line In but my cords are plugged into the line out ports which are just the composite video and mono audio (the yellow and white), yet I get this input/output error. I've tried playing a tape in the VCR to see if it would show anything after a video starts playing but unfortunately not.
The dmesg output:
[ 2943.095846] usb 1-8: Product: AV TO USB2.0
[ 2943.095849] usb 1-8: Manufacturer: MACROSILICON
[ 2943.095851] usb 1-8: SerialNumber: 20150130
[ 2943.102906] usb 1-8: Found UVC 1.00 device AV TO USB2.0 (534d:0021)
[ 2943.107836] usb 1-8: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[ 2948.392268] usb 1-8: 2:2: failed to get current value for ch 0 (-110)
[ 2948.411902] usb 1-8: Warning! Unlikely big volume range (=8191), cval->res is probably wrong.
[ 2948.\411905] usb 1-8: [2] FU [Mic Capture Volume] ch = 1, val = 0/8191/1
I'm using a custom kernel which is 6.5.2. It uses the same config as the one from Devuan but I just enabled the rtl8xxxu untested drivers option since my wifi adapter needs this in order to work.
Any help would be appreciated.
Offline
I have that same USB dongle and successfully captured a stack of videos, but a year or so ago. So it was a different computer; probably beowulf but possibly ascii even.
You cabling sounds right; yellow is composite video, while red and white is audio (R/L). Use "Line Out" of course.
From memory I used uvccapture or possibly ffmpeg directly. I have a vague memory that only one of its two /dev/videoN worked. Package v4l-utils is also useful, eg list devices with v4l2 --list-devices.
EDIT: See also
https://gordonlesti.com/2017/12/
Online
See:
V4L-Capture (Mirror of the v4l Utilities Written by Andrew Sayers)
Encode-Stream (BASH Script to encode VHS / Camera / Cassette Streams)
My copy on desktop machine of encode_stream script is dated Dec 21 2021, and I have not used it recently, but I know of zero reason why it should not work today.
Offline
I have that same USB dongle and successfully captured a stack of videos, but a year or so ago. So it was a different computer; probably beowulf but possibly ascii even.
And there was no I/O error?
From memory I used uvccapture or possibly ffmpeg directly. I have a vague memory that only one of its two /dev/videoN worked. Package v4l-utils is also useful, eg list devices with v4l2 --list-devices.
I got v4l2-utils to list the devices as well but I haven't gotten the uvccapture package. I tried ffmpeg directly but got the same input/output error.
EDIT: See also
https://gordonlesti.com/digitize-a-vhs- … p-on-linux
This leads to a 404.
My copy on desktop machine of encode_stream script is dated Dec 21 2021, and I have not used it recently, but I know of zero reason why it should not work today.
Thanks. I tried your script but some of the options like AUDIO_DEVICE and REGION did not work, and I got an input/output error when given just the device and output file.
EDIT: Also tried uvccapture, but it doesn't work either. I looked at the man page and it only creates jpeg's.
EDIT #2: For those curious, trying to play /dev/video1 gives "Inappropriate ioctl for device". I cannot seem to select /dev/video1 in a program like OBS.
Last edited by hunter0one (2023-09-12 13:44:57)
Offline
seems the URL should have been https://gordonlesti.com/2017/12/ .. I was fooled by the javascript when expanding that article... anyhow, the first tak-out is the qv4l2 tool.
Online
Thanks, I just tried that qv4l2 tool and followed the article but I get a black screen even with the VCR turned on.
After the first try with YUYV as the capture format, it switches to Motion-JPEG and won't let me pick anything but that. MJPG doesn't show anything either though.
If anything, my device doesn't appear as usbtv but instead "Camera 1".
Last edited by hunter0one (2023-09-12 13:55:06)
Offline
I guess you've confirmed file access mode for /dev/videoN .. you need rw I think.
Online
hunter@ryzen-rig:~$ ls -l /dev/video*
crw-rw----+ 1 root video 81, 0 Sep 12 08:34 /dev/video0
crw-rw----+ 1 root video 81, 1 Sep 12 08:34 /dev/video1
Offline
alexkemp wrote:encode_stream
Thanks. I tried your script but some of the options like AUDIO_DEVICE and REGION did not work, and I got an input/output error when given just the device and output file.
Did you bother to use the help option (-h)?
usage: $0 OUTPUT_NAME [AUDIO_DEVICE] [VIDEO_DEVICE] [REGION] [PIX_FMT]
Encodes input from a VHS / Camera / Cassette stream to a mp4 video.
OUTPUT_NAME filename of mp4 video (DEFAULT; no need for mp4 suffix )
or, filename of m4a sound file (needs m4a suffix )
or, filename of mp3 sound file (needs mp3 suffix )
VIDEO_DEVICE eg 'dev/video0' (try "v4l2-ctl --all" )
AUDIO_DEVICE eg 'hw:2,0' (try "arecord -l" or "arecord -L" or "cat /proc/asound/cards" )
REGION eg 'PAL'
PIX_FMT eg 'yuv420p' (v4l2 default is yuyv422, but that prevents display on some devices)
Note:
Only use "q" to quit from the running process in the terminal
Offline
Yes, that's what I used to see those options.
Offline
I was hoping to find options that you used, results of tests, error messages, ...
Only OUTPUT_NAME is required.
Defaults for other options are:
VIDEO_DEVICE = '/dev/video0'
AUDIO_DEVICE = 'hw:2,0'
REGION = 'PAL'
PIX_FMT = 'yuv420p'
If those defaults do not match your system, and particularly video or audio hardware, then do not be surprised if it throws an error.
But ok I can tell that you are not bothered, so let's forget it.
Offline
I already told you that the error was the same input/output message that I get from ffmpeg by itself. I also said options like AUDIO_DEVICE did not work. Here's an example of what I had originally tried:
hunter@ryzen-rig:~$ encode_stream OUTPUT_NAME=test VIDEO_DEVICE=/dev/video0 AUDIO_DEVICE=hw:2,0 REGION=NTSC
-vsync is deprecated. Use -fps_mode
Passing a number to -vsync is deprecated, use a string argument as described in the manual.
[video4linux2,v4l2 @ 0x56175e071200] Cannot open video device AUDIO_DEVICE=hw:2,0: No such file or directory
AUDIO_DEVICE=hw:2,0: No such file or directory
When I try to do it with just the OUTPUT_NAME and REGION since all the defaults are correct except for the region:
hunter@ryzen-rig:~$ encode_stream OUTPUT_NAME=test REGION=NTSC
-vsync is deprecated. Use -fps_mode
Passing a number to -vsync is deprecated, use a string argument as described in the manual.
/dev/video0: Input/output error
An input/output error seems to be the biggest one I get across the board. What would cause it?
Last edited by hunter0one (2023-09-12 20:21:38)
Offline
It is telling you there are errors on both the VIDEO_DEVICE=/dev/video0 + AUDIO_DEVICE=hw:2,0. It seems that the hardware that you are specifying (which happen to also be the defaults embedded in the script) are wrong. No point in going any further until those are checked. Either the precise devices are wrong or your user is wrong.
What are the results of v4l2-ctl --all + arecord -l or arecord -L or cat /proc/asound/cards?
I see that you were using the qv4l2 tool (QT v4l2 test utility). Very sensible - I used that as well (mostly to check REGION). However, if you cannot get the screen to appear in that utility then the bash-file will never work. The idea is to try different setup options until a picture appears. You can then supply the different options appropriately. Whatever options allow the V4L screen to show your VHS/Camera/whatever are the precise options to use with the bash-script.
Pay attention to your user. Your ls -l results show that you will have permission errors unless you go root. Or try the advice in the Wiki link: sudo chmod a+r /dev/video0. I'm pretty sure that that is why you are getting the 'input/output error'.
I'll also try to fix that -vsync error in the script.
Last edited by alexkemp (2023-09-12 22:49:27)
Offline
I've made the ffmpeg-recommended fix (search for "vsync is deprecated") to the bash-file & uploaded it. No checks, but the change is most modest & should work.
Offline
What are the results of v4l2-ctl --all + arecord -l or arecord -L or cat /proc/asound/cards?
This is v4l2-ctl --all:
Driver Info:
Driver name : uvcvideo
Card type : AV TO USB2.0
Bus info : usb-0000:01:00.0-6
Driver version : 6.5.2
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : AV TO USB2.0
Serial : 20150130
Bus info : usb-0000:01:00.0-6
Media version : 6.5.2
Hardware revision: 0x00000121 (289)
Driver version : 6.5.2
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : AV TO USB2.0
Function : V4L2 I/O
Flags : default
Pad 0x01000007 : 0: Sink
Link 0x0200000d: from remote pad 0x100000a of entity 'Processing 2' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
Width/Height : 640/480
Pixel Format : 'MJPG' (Motion-JPEG)
Field : None
Bytes per Line : 0
Size Image : 614400
Colorspace : sRGB
Transfer Function : Rec. 709
YCbCr/HSV Encoding: ITU-R 601
Quantization : Default (maps to Full Range)
Flags :
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 640, Height 480
Default : Left 0, Top 0, Width 640, Height 480
Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 640, Height 480, Flags:
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 640, Height 480, Flags:
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 0
And arecord -l:
**** List of CAPTURE Hardware Devices ****
card 1: Generic [HD-Audio Generic], device 0: ALC887-VD Analog [ALC887-VD Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 2: ALC887-VD Alt Analog [ALC887-VD Alt Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: MS210x [MS210x], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
Pay attention to your user. Your ls -l results show that you will have permission errors unless you go root.
I tried to run ffmpeg with sudo but get the same exact /dev/video0: Input/output error. When I try /dev/video1 it results in not a video capture device
Or try the advice in the Wiki link: sudo chmod a+r /dev/video0. I'm pretty sure that that is why you are getting the 'input/output error'.
After issuing chmod a+r to video0 & video1 they both still give the same respective errors.
I used your revised script but it still gives the same output for both video0 and video1, albeit with the deprecated warning gone.
Last edited by hunter0one (2023-09-12 23:49:58)
Offline
You seem to have the correct hardware devices. In your position I would change to the root user & try again. If you cannot get the picture to appear in the V4L2 screen then it is bad.
Try all the various options with the V4L2 utility. It took me a while to find the correct mix before I got the video to appear. However, if you cannot get it to appear then throw the hardware in the bin & try something else.
Good luck.
PS
From the v4l2-ctl --all output, the fps in the script should be switched from 25 to 30. However, do not touch anything until you get V4L2 to work. Only if it will work there will the script work (using the same setup options).
13 Sep update: made clear re: fps I was referring to the script, not V4L2.
Last edited by alexkemp (2023-09-13 08:34:33)
Offline
For some reason the capture image format and image size can't be changed in QV4L2, when I select another option for the first time it changes to the default and won't let the option be picked again. For the format it is MJPG and the image size is 640x480 like v4l2-ctl shows. I've went on and tried as many options as I could as both root and regular user but still get a black screen. This is unfortunate.
Last edited by hunter0one (2023-09-13 00:54:38)
Offline
Other things at system level would be to ensure you have rw access to the usb dev-node.. (/dev/bus/usb/00?/0??) and make sure the dongle is on a USB 2 port.
Online
For some reason the capture image format and image size can't be changed in QV4L2
That is academic. ffmpeg is near miraculous; it will change a video from any format to any other format. My script has the wrong fps AND pixel dimensions for your supply (the script is using "-s 720x576 -r 25" which was correct for my VHS signal, but not yours) but ffmpeg would happily make that change.
The issue for you is hardware & region (as best as I can tell).
v4l2-ctl --all is giving a full, error-free readout of the input video device.
arecord -l is accurately recording the audio hardware as 'hw:2,0' ("card: 2, subdevice: 0")
Only region remains (for me, the picture only appeared in the V4L2 screen when I changed the region from the default NTSC to PAL; ymmv).
If you cannot find a combo that works then the answer may be that zero signal is arriving at the input. Do you have a broken wire?
Offline
hunter@ryzen-rig:~$ ls -l /dev/video* crw-rw----+ 1 root video 81, 0 Sep 12 08:34 /dev/video0 crw-rw----+ 1 root video 81, 1 Sep 12 08:34 /dev/video1
Check your ID is in the video group. id should tell you. Post output from it if not sure.
Offline
Check your ID is in the video group. id should tell you. Post output from it if not sure.
uid=1000(hunter) gid=1000(hunter) groups=1000(hunter),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),105(netdev),113(lpadmin),121(scanner)
It does appear that I am.
Do you have a broken wire?
I have tried every combination that qv4l2 would let me to no avail. The wires don't appear broken. This adapter never really got used before so its almost like brand new, because about a year ago is when I first received it and gave it a try and it wouldn't even appear as a device in Linux. I never got around to checking out why but most likely I was missing the module. Now that I have the time to try it again, it appears in dmesg and generates video devices but unfortunately it seems to be a paperweight.
Offline
It seems that there's only a few bits of capture hardware that are capable of doing the job. Sorry that yours is not one of them.
Offline
@hunter0one, did you verify read-write access to the USB device node concerned?
Obviously you have read access but you do need write access right as well. Use e.g. lsusb to figure out which "bus id" it has, en then chech that /dev/bus/usb/xxx/yyy.
Online
@hunter0one, did you verify read-write access to the USB device node concerned?
Yes, I'm sorry I didn't mention I tried that after the first time you asked:
crw-rw-r-- 1 root root 189, 14 Sep 12 19:40 /dev/bus/usb/001/015
I still don't understand how to tell what the sequence of "bits" means what in *nix (besides r is read and w is write) but it seems read-write access is allowed.
To be on the safe side I ran chmod +rw /dev/bus/usb/001/015 and it results in the same sequence:
crw-rw-r-- 1 root root 189, 14 Sep 12 19:40 /dev/bus/usb/001/015
Offline
For devices you get c==character (bytes) or b==block (hdd, etc).
That is a root.root user.group & you will need to use sudo if you wish it to be changed.
Offline