LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Video device assignment seems incorrect (https://www.linuxquestions.org/questions/slackware-14/video-device-assignment-seems-incorrect-4175443912/)

waddles 01-03-2013 12:47 AM

Video device assignment seems incorrect
 
I might be having some kind of a cross up in my 13.37 OS.
Here is what dmesg|egrep video gets:
Code:

[    0.274434] pci 0000:01:00.0: Boot video device
[    3.688237] Linux video capture interface: v2.00
[    4.992913] usb 4-1: V4L2 device registered as video0
[    5.950327] bttv0: registered device video1

Since my webcam (0c45:60fc) is V4L2 I presume that this means my webcam should be on /dev/video0.
When I run my mplayer command, I get numerous errors if I make /dev/video0 the assignment.
I currently am not using bttv so out of ignorance I made the assignment /dev/video1. The same command almost works. It takes a picture (at least an image file is produced), counts frames and decrements 1 less. However, there is NO monitor image and no image produced in the image file save a green background within a black frame. This assignment produces NO errors. This leads me to think that there could be a cross-up someplace.
I am wondering if there could be a crossed or partially crossed up assignment within the OS. I recall from 12.1 that the assigning of devices on bootup was problematic and at times it would be video0 and at others video1.
Is there someplace in /proc where I can see how it has video0/1 assigned to various products? Any help appreciated.
I am using the sn9c102 (sn9c105 included) driver but use of gspca_sonixj has same problem as I recall. Use of other cameras is not an option as it has been used with several scientific tools.

allend 01-03-2013 06:06 PM

Quote:

Is there someplace in /proc where I can see how it has video0/1 assigned to various products?
On my system
Code:

bash-4.2$ lsusb
...
Bus 001 Device 002: ID 0c45:62c0 Microdia Sonix USB 2.0 Camera
...
bash-4.2$ ls -l /sys/dev/char/ | grep video
lrwxrwxrwx 1 root root 0 Jan  4 10:49 81:0 -> ../../devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/video4linux/video0/


waddles 01-03-2013 11:00 PM

Video device assignment seems incorrect
 
Thanks, that mimics what is said by lsusb so that helps.
My quandary is still the difference I get between the lsusb and dmesg in the first post. I thought, possibly wrongly, that the 4-1 was "bus 4 device 1" was not agreeing with the lsusb output. And the fact that it tries to work under video1 and quits before getting anywhere under video0 as dmesg says is the device assignment.

allend 01-04-2013 06:31 PM

For me, this command streams the camera output to the screen.
Code:

mplayer -tv device=/dev/video0 tv://
You could try installing guvcview from http://slackbuilds.org/ as it allows you to experiment with various camera settings. This may be required with your device.

waddles 01-05-2013 01:45 AM

Video device assignment seems incorrect
 
I appreciate suggesting alternative software but my needs are to use mplayer. I tried UR command and get:
Code:

TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: SN9C1xx PC Camera
 Capabilities:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = Camera;
 Current input: 0
 Current format: unknown (0x31384142)
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: Cannot get fps
v4l2: ioctl set mute failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
=================================================
Cannot find codec matching selected -vo and video format 0x31384142.
=================================================
v4l2: select timeout
v4l2: ioctl set mute failed: Invalid argument
v4l2: 0 frames successfully processed, 1 frames dropped.


allend 01-05-2013 07:59 AM

Quote:

Current format: unknown (0x31384142)
With my system I see
Quote:

Current format: YUYV
I suspect a driver problem. In post #1
Quote:

I am using the sn9c102 (sn9c105 included) driver but use of gspca_sonixj has same problem as I recall.
However I did find this concerning your device ID
http://lists.debian.org/debian-kerne.../msg00121.html

waddles 01-05-2013 04:55 PM

Video device assignment seems incorrect
 
Re: YUYV I had a recollection that I had had used that before but do not recall the outcome. Will test a bit later.
I had seen the reference already which is why I have tested it tho this camera has worked before with sn9c102 under 12.1.
With 12.1 I had had a problem where the camera and bttv would be assigned different videoX at different times which drove me crazy. I had resolved it in a script which checked /proc/asound/card but that output is different now and that particular condition does not seem to exist now. Hence why I was looking for info in /proc thinking something was possibly getting crossed up between lsusb and what was actually assigned. That was amplified when my script works with NO errors using the video no. assigned to bttv just that my camera is either not sensing the image or the image is somehow not getting thru as I get the on screen frame for video just a green background and no image and the assigned number for the camera was getting all errors.

allend 01-05-2013 05:20 PM

Shall await the results of your testing trying the two different drivers.

waddles 01-07-2013 11:46 PM

Video device assignment seems incorrect
 
Sorry to be so tardy but ran into boot time "unable to enumerate" error caused by printer being in the ON state which lead to a long search. As it was USB related I had to run it to ground first.
Here is the state of the machine's testing:
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 0c45:60fc Microdia PC Camera with Mic (SN9C105)

lsmod |grep sn9c
sn9c102 141903 0
videodev 57461 7 tuner,tvaudio,tda7432,msp3400,bttv,v4l2_common,sn9c102

dmesg| egrep video
[ 3.926718] Linux video capture interface: v2.00
[ 4.522586] usb 4-1: V4L2 device registered as video0
[ 5.966645] bttv0: registered device video1

Here is SN9C102 test (some lines trimmed for brevity):
FOR VIDEO1:
Code:

mplayer -tv device=/dev/video1 tv://
MPlayer 20101218-4.5.1 (C) 2000-2010 MPlayer Team
Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
Selected device: BT878 video (Hauppauge (bt878))
 Tuner cap:
 Tuner rxs: MONO
 Capabilities:  video capture  video overlay  VBI capture device  tuner  read/write  streaming
 supported norms: 0 = NTSC; 1 = NTSC-M; 2 = NTSC-M-JP; 3 = NTSC-M-KR; 4 = PAL; 5 = PAL-BG; 6 = PAL-H; 7 = PAL-I; 8 = PAL-DK; 9 = PAL-M; 10 = PAL-N; 11 = PAL-Nc; 12 = PAL-60; 13 = SECAM; 14 = SECAM-B; 15 = SECAM-G; 16 = SECAM-H; 17 = SECAM-DK; 18 = SECAM-L; 19 = SECAM-Lc;
 inputs: 0 = Television; 1 = Composite1; 2 = S-Video; 3 = Composite3;
 Current input: 0
 Current format: BGR24
v4l2: current audio mode is : MONO===============================================
Opening video decoder: [raw] RAW Uncompressed Video
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 640x480 => 640x480 Planar YV12
Selected video codec: [rawyv12] vfm: raw (RAW YV12)
===================================================
Audio: no sound
Starting playback...
V:  0.0  62/ 62 ??% ??% ??,?% 0 0  <---"s" Key pressed
sending VFCTRL_SCREENSHOT!
failed (forgot -vf screenshot?)
V:  0.0  82/ 82 ??% ??% ??,?% 0 0
v4l2: 84 frames successfully processed, -83 frames dropped.
Exiting... (Quit)

FOR VIDEO0:
Code:

mplayer -tv device=/dev/video0 tv://
MPlayer 20101218-4.5.1 (C) 2000-2010 MPlayer Team
Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: SN9C1xx PC Camera
 Capabilities:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = Camera;
 Current input: 0
 Current format: unknown (0x31384142)
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: Cannot get fps
v4l2: ioctl set mute failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
==================================================
Cannot find codec matching selected -vo and video format 0x31384142.
==================================================
v4l2: select timeout
v4l2: ioctl set mute failed: Invalid argument
v4l2: 0 frames successfully processed, 1 frames dropped.
Exiting... (End of file)

Here is test for gspca_sonix:
modprobe -r sn9c102
modprobe gspca_sonixj
lsmod | egrep gspca
gspca_sonixj 22227 0
gspca_main 21348 1 gspca_sonixj
videodev 57461 7 gspca_main,tuner,tvaudio,tda7432,msp3400,bttv,v4l2_common
That was all that was changed

dmesg | egrep video
[ 3.926718] Linux video capture interface: v2.00
[ 4.522586] usb 4-1: V4L2 device registered as video0
[ 5.966645] bttv0: registered device video1
[ 2039.986198] usb 4-1: V4L2 device video0 deregistered *NOTE

FOR VIDEO1:
Code:

mplayer -tv device=/dev/video1 tv://
MPlayer 20101218-4.5.1 (C) 2000-2010 MPlayer Team

Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
Selected device: BT878 video (Hauppauge (bt878))
 Tuner cap:
 Tuner rxs: MONO
 Capabilities:  video capture  video overlay  VBI capture device  tuner  read/write  streaming
 supported norms: 0 = NTSC; 1 = NTSC-M; 2 = NTSC-M-JP; 3 = NTSC-M-KR; 4 = PAL; 5 = PAL-BG; 6 = PAL-H; 7 = PAL-I; 8 = PAL-DK; 9 = PAL-M; 10 = PAL-N; 11 = PAL-Nc; 12 = PAL-60; 13 = SECAM; 14 = SECAM-B; 15 = SECAM-G; 16 = SECAM-H; 17 = SECAM-DK; 18 = SECAM-L; 19 = SECAM-Lc;
 inputs: 0 = Television; 1 = Composite1; 2 = S-Video; 3 = Composite3;
 Current input: 0
 Current format: YVU420v4l2: current audio mode is : MONO
===================================================
Opening video decoder: [raw] RAW Uncompressed Video
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 640x480 => 640x480 Planar YV12
Selected video codec: [rawyv12] vfm: raw (RAW YV12)
===================================================
Audio: no sound
Starting playback...
V:  0.0  44/ 44 ??% ??% ??,?% 0 0
sending VFCTRL_SCREENSHOT!
failed (forgot -vf screenshot?)
V:  0.0  66/ 66 ??% ??% ??,?% 0 0
v4l2: 68 frames successfully processed, -67 frames dropped.
Exiting... (Quit)

FOR VIDEO0:
Code:

mplayer -tv device=/dev/video0 tv://
MPlayer 20101218-4.5.1 (C) 2000-2010 MPlayer Team
Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: unable to open '/dev/video0': No such file or directory
v4l2: ioctl set mute failed: Bad file descriptor
v4l2: 0 frames successfully processed, 0 frames dropped.
Exiting... (End of file)

Looks to me like it is using video1 (which it shouldn't) but cannot create an image as I get the "green" window inset which used to contain what the camera saw.
gspca_sonixj while available does not seem to work for video0 as it looks like that got deregistered (see *NOTE) when I pulled it in.

allend 01-08-2013 07:29 AM

Have you tried using
Code:

LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer -tv device=/dev/video0 tv://
From http://wigglit.ath.cx/slackware_botl....log.01Apr2010
Quote:

[23:30] <pthreat> hey guys, I'm having some issues with my webcam Bus 001 Device 009: ID 0c45:60fc Microdia PC Camera with Mic (SN9C105) anyone care to lend me a hand?
[23:31] <pthreat> videodev 30424 8 sn9c102,gspca_main,tuner,tda7432,msp3400,v4l2_common my modules
[[23:54] <pthreat> MLanden: LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer tv:// -tv \ driver=v4l2:width=640:height=480:fps=25:device=/dev/video1 -vo xv
[23:54] <pthreat> should be something like that
[23:58] <pthreat> MLanden: hey, It's working :)
This provides some background https://groups.google.com/forum/?fro...ia/aOoFlwE3Vfk

waddles 01-08-2013 11:09 PM

Video device assignment seems incorrect
 
The command: LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer -tv device=/dev/video0 tv://
(I think) is just assuring that a v4l to v4l2 conversion is available. The camera has run with just v4l2_common before so doubt the preload helps however when run with video0 now it gets same display as when run with video1 + a multicolored band across the top of the display about 10 pixels thick. So some improvement tho don't have an explanation of why video1 was trying to work and now video0 is trying to work with the preload. Need to look further into LD_PRELOAD's functionality.
Here are some of the errors video0 + preload gave:
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: Cannot get fps
v4l2: ioctl set mute failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
tried command with video1 and got no errors plus it took a snapshot and created the .png file.
Wish I weren't so stubborn or I'd just buy another camera.

allend 01-09-2013 08:21 AM

[QUOTE][v4l2: Cannot get fps/QUOTE]
I do not see this error although I see the four previous errors. Have you tried using the additional parameters in the quote in post #10?

waddles 01-09-2013 01:25 PM

U said U are getting some of the same errors. Is URs working?
Or are the errors non-impacting?
Scanned thru wiggleit and the googles stuff but must have missed what U refer to. Which params and which reference. I have tried so many combinations of parameters unsuccessfully that is why I am here. I did note that MLadden had the reverse of my videos, i.e. he had video0 for tv and video1 for camera which is the reverse of mine. That is the part that has my mind spinning because it seems to try to work with the video assigned to the tv but blows up when it uses the video assigned to the USB camera.
Here is my latest/greatest
vidv=video1
TV="-tv driver=v4l2:device=/dev/${vidv}:width=640:height=480:norm=NTSC:chanlist=us-cable:noaudio:outfmt=i420"
OUT="-fps 25 -cache 128"
PIC="-hue 0 -brightness 0 -contrast 0 -saturation 0 -aspect 4:3"LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer tv:// $TV $OUT $PIC -vf screenshot -vo xv,x11,
This was its environment:
lsmod | egrep v4l
v4l2_common 5259 5 tuner,tvaudio,tda7432,msp3400,bttv
videodev 57461 7 sn9c102,tuner,tvaudio,tda7432,msp3400,bttv,v4l2_common
v4l1_compat 13666 1 videodev
i2c_core 16421 14 tuner_simple,tuner,tvaudio,tda7432,msp3400,nouveau,drm_kms_helper,bttv,drm,v4l2_common,i2c_algo_bit, tveeprom,videodev,i2c_viapro
Is my understanding correct that the .../libv4l/v4l2convert.so is basically allowing v4l2 to run a v4l device? Or is it just degrading v4l2 to v4l?

allend 01-10-2013 04:29 PM

Quote:

Is URs working?
Or are the errors non-impacting?
Yes - As implied by post #4
Quote:

but must have missed what U refer to
LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer tv:// -tv \ driver=v4l2:width=640:height=480:fps=25:device=/dev/video1 -vo xv
Quote:

Is my understanding correct that the .../libv4l/v4l2convert.so is basically allowing v4l2 to run a v4l device? Or is it just degrading v4l2 to v4l?
From the link in post #10
Quote:

Most video applications do not support the image encoding SN9C20x-based
webcams offer. Such applications need to have the image stream converted
for them. This can be done using "libv4l", which is pre-loaded between the
application and the video resource and translates the image stream into a
usable format.
I have also seen posts about this device needing a 32-bit library. Are you running 64-bit?

waddles 01-11-2013 10:16 PM

Regarding working or non-impacting errors query:
Was trying to determine if URs was working did U have errors or not so that I could expect same.

The command string: LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer tv:// -tv \ driver=v4l2:width=640:height=480:fps=25:device=/dev/video1 -vo xv
kind of works on this system. Using video1 it tries to employ the bttv which is NOT correct. Green screen in black frame with multicolored 1/4" band of pixels at the top
With video0 it is similar but adds a 3/4" band below of scattered I-bars on a green background which oscillates on/off. Just that suggests this is on the right track, just missing stuff or added too much.

I disregarded info on sn9c105 as the info I gathered said that that was included within sn9c102 at least for the 06fc camera.

I was not able to find a definition in the 2 refs U gave regarding the function of v4l2convert. That one where U found the command line was hard to follow when I looked for it. But for now I don't thing it matters.

Am using 32-bit desktop.

This is getting a bit long and I should now tear into this command via substitutions and see if I can make it work. Its good to know it is working 4 U.
I will open another if I can find no solution. I will come back if I have a solution for my configuration and post it.


All times are GMT -5. The time now is 10:20 PM.