Install a webcam in Slacko 5.3
Install a webcam in Slacko 5.3
This post details my (successful) attempt at adding a usb webcam to my Toshiba TE2100 laptop running Slacko 5.3
Step 1
Choose a webcam that is “uvc compliant
Step 1
Choose a webcam that is “uvc compliant
- Attachments
-
- slacko_webcam.JPG
- (45.66 KiB) Downloaded 12946 times
Last edited by greengeek on Tue 19 Feb 2013, 08:28, edited 2 times in total.
Re: Install a webcam in Slacko 5.3
Better to use "lsusb"greengeek wrote: If you want to know the device ID for your webcam, plug it into your usb and then open up a terminal and type dmesg. You should see the messages refer to a number something like the format of eb1a:2571. Each different device has a different number depending on manufacturer and model.
EyeToy - Works
Works a treat with an old PS 2 eyetoy (nimtel type - i.e black)
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Did someone get this to work an a later Slacko?
After installing guvcview-1.5.0-s.pet and guvcview_slack_DEP-1.5.0.pet all I get is an error message
Distro:Slacko5.6
HW:Netbook HP Mini 210, 1GB
Camera: ELECOM UCAM-DLK 130TBK
After installing guvcview-1.5.0-s.pet and guvcview_slack_DEP-1.5.0.pet all I get is an error message
Code: Select all
# guvcview
guvcview 1.5.0
Fatal:g_thread NOT supported
HW:Netbook HP Mini 210, 1GB
Camera: ELECOM UCAM-DLK 130TBK
On Slacko 5.6 I use the guvcview pet available from OscarTalks repo here:
http://smokey01.com/OscarTalks/
Hopefully that will get you going - or is there some specific feature in the earlier guvcview pet that you need?
http://smokey01.com/OscarTalks/
Hopefully that will get you going - or is there some specific feature in the earlier guvcview pet that you need?
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Thanks. Unfortunately still no luck. Most of the messages may be mere warnings but the final "segmentation fault" looks deadly.
Code: Select all
# guvcview
guvcview 1.7.3
file guvcview_video.mkv has extension type 1
file guvcview_image.jpg has extension type 0
file guvcview_image.jpg has extension type 0
Video file suffix detected: 0
Image file suffix detected: 0
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
video device: /dev/video0
vid:064e
pid:f100
driver:uvcvideo
device doesn't seem to support uvc H264 (0)
Init. HP Webcam-50 (location: usb-0000:00:1d.7-4)
{ pixelformat = 'YUYV', description = 'YUV 4:2:2 (YUYV)' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
{ pixelformat = 'RGB3', description = 'RGB3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
{ pixelformat = 'BGR3', description = 'BGR3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
{ pixelformat = 'YU12', description = 'YU12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
{ pixelformat = 'YV12', description = 'YV12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
checking muxed H264 format support
device doesn't seem to support uvc H264 (0)
checking format: MJPG
Format unavailable: MJPG
Init v4L2 failed !!
Init video returned -2
trying minimum setup ...
format: YUYV
resolution: 640 x 480
framerate: 1/24
video device: /dev/video0
vid:064e
pid:f100
driver:uvcvideo
device doesn't seem to support uvc H264 (0)
Init. HP Webcam-50 (location: usb-0000:00:1d.7-4)
{ pixelformat = 'YUYV', description = 'YUV 4:2:2 (YUYV)' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
{ pixelformat = 'RGB3', description = 'RGB3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
{ pixelformat = 'BGR3', description = 'BGR3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
{ pixelformat = 'YU12', description = 'YU12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
{ pixelformat = 'YV12', description = 'YV12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/24,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/24,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/24,
checking muxed H264 format support
device doesn't seem to support uvc H264 (0)
checking format: YUYV
fps is set to 1/24
drawing controls
Segmentation fault
#
Hmmm. It may not be the fault of Slacko 5.6
Do you have the option of testing with a different camera and/or different PC?
I don't understand why it is wanting a server socket or why jack is needed - I do not have jack in my system and have not experienced these problems. Maybe I just got lucky with my hardware combination.
EDIT : Well as it turns out I do get error messages. I just did not pay attention to them. No segmentation fault though:
Do you have the option of testing with a different camera and/or different PC?
I don't understand why it is wanting a server socket or why jack is needed - I do not have jack in my system and have not experienced these problems. Maybe I just got lucky with my hardware combination.
EDIT : Well as it turns out I do get error messages. I just did not pay attention to them. No segmentation fault though:
Code: Select all
uvcview
guvcview 1.7.3
file guvcview_video.mkv has extension type 1
file guvcview_image.jpg has extension type 0
Could not open /root/.config/guvcview/video0 for read,
will try to create it
write /root/.config/guvcview/video0 OK
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
video device: /dev/video0
vid:04f2
pid:b008
driver:uvcvideo
device doesn't seem to support uvc H264 (0)
Init. Chicony USB 2.0 Camera (location: usb-0000:00:1a.7-4)
{ pixelformat = 'YUYV', description = 'YUV 4:2:2 (YUYV)' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
{ pixelformat = 'RGB3', description = 'RGB3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
{ pixelformat = 'BGR3', description = 'BGR3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
{ pixelformat = 'YU12', description = 'YU12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
{ pixelformat = 'YV12', description = 'YV12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
checking muxed H264 format support
device doesn't seem to support uvc H264 (0)
checking format: MJPG
Format unavailable: MJPG
Init v4L2 failed !!
Init video returned -2
trying minimum setup ...
format: YUYV
resolution: 640 x 480
framerate: 1/30
video device: /dev/video0
vid:04f2
pid:b008
driver:uvcvideo
device doesn't seem to support uvc H264 (0)
Init. Chicony USB 2.0 Camera (location: usb-0000:00:1a.7-4)
{ pixelformat = 'YUYV', description = 'YUV 4:2:2 (YUYV)' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
{ pixelformat = 'RGB3', description = 'RGB3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
{ pixelformat = 'BGR3', description = 'BGR3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
{ pixelformat = 'YU12', description = 'YU12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
{ pixelformat = 'YV12', description = 'YV12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/20, 1/15, 1/10, 1/5,
{ discrete: width = 1280, height = 800 }
Time interval between frame: 2/15, 1/5,
{ discrete: width = 1280, height = 1024 }
Time interval between frame: 2/15, 1/5,
checking muxed H264 format support
device doesn't seem to support uvc H264 (0)
checking format: YUYV
fps is set to 1/30
drawing controls
fps is set to 1/30
GUVCVIEW Signals:
SIGUSR1: Video stop/start capture
SIGUSR2: Image capture
SIGINT (ctrl+c): Exit
examples:
kill -s SIGUSR1 'pid'
killall -s USR2 guvcview
Checking video mode 640x480@32bpp : OK
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
Code: Select all
root# guvcview
guvcview 1.7.1
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
My initial testing of 1.7.3 was done in a Slacko 5.6 derivative but that is not really a fair test so I also tried guvcview in a pristine boot of Slacko 5.6 and the result was the same.
I wonder if there could be any issue with locale? (I assume your locale is Japan...)
I have seen a number of posts lately highlighting strange issues that occur due to selection of locale so just thought I would mention it as a potential contributor.
I wonder if there could be any issue with locale? (I assume your locale is Japan...)
I have seen a number of posts lately highlighting strange issues that occur due to selection of locale so just thought I would mention it as a potential contributor.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Which pet?B.K. Johnson wrote:works in my tahr-6.0.2~6.0.5
Unlikely. I always start with a pristine Puppy and keep the locale as is, so it's "us"?greengeek wrote:I wonder if there could be any issue with locale?
I also tried with a different Netbook (Lenovo IdeaPad S10-2). Same "segmentation fault" failure.
The camera works in Tahrpup with the VLC media player, but VLC is a bit heavy and may not be suitable for the task. What I need is a simple surveillance camera. Shooting 1 frame/sec or even less would be enough.
What result do you get from the following?:
EDIT : - also some interesting suggestions here:
https://askubuntu.com/questions/102755/ ... web-camera
EDIT2 : - I just tried running: and at the same time I ran TAS and selected multiple frames at 1 second intervals - selection "region" only and grabbing the mplayer window. Hacky, but functional.
EDIT3 : - This post may be useful. Works for me: https://ubuntuforums.org/showthread.php ... st12451243
Code: Select all
mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 30
https://askubuntu.com/questions/102755/ ... web-camera
EDIT2 : - I just tried running:
Code: Select all
mplayer tv:// -tv driver=v4l2:device=/dev/video0
EDIT3 : - This post may be useful. Works for me: https://ubuntuforums.org/showthread.php ... st12451243
Last edited by greengeek on Fri 07 Jul 2017, 19:18, edited 1 time in total.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
The built-in camera responds. The same when I try the examples in your linked pages.greengeek wrote:What result do you get from the following?:Code: Select all
mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 30
I need a way to tweak ffmpeg into using the attached external camera.
lsusb command tells me
Code: Select all
# lsusb
Bus 001 Device 007: ID 056e:700f Elecom Co., Ltd
Bus 001 Device 003: ID 064e:f100 Suyin Corp.
Bus 001 Device 004: ID 0bda:0159 Realtek Semiconductor Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 0518:0001 EzKEY Corp. USB to PS2 Adaptor v1.09
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 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Not sure. Does it help to use device=/dev/video1 instead of device=/dev/video0? Does anything happen?
EDIT : Do you get valid outputs from either of the following syntax(es)?
EDIT2 : This may be worth a try:
EDIT : Do you get valid outputs from either of the following syntax(es)?
Code: Select all
ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 output.mkv
Code: Select all
ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video1 output.mkv
Code: Select all
ffmpeg -f video4linux2 -i /dev/video0 -vframes 1 test.jpg
Code: Select all
ffmpeg -f video4linux2 -i /dev/video1 -vframes 1 test.jpg
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Yesgreengeek wrote:Not sure. Does it help to use device=/dev/video1 instead of device=/dev/video0?
Works at least on one of my machines. I haven't figured out how to get the correct /dev/video# for a given device, but these are minor issues. Now I have to fine-tune the ffmpeg code and wrap it into a script.
Thanks for your help. Nevertheless the mysterious guvcview issue remains...
Most of the answers I have seen seem to require v4l2-ctl utility but I don't have it in my system or know how big/intrusive/puppycompatible it is.MochiMoppel wrote: I haven't figured out how to get the correct /dev/video# for a given device, but these are minor issues.
Two examples:
https://superuser.com/questions/1053314 ... -via-lsusb
and:
https://askubuntu.com/questions/348838/ ... mmand-line
Looks like there are potentially some clues here:https://stackoverflow.com/questions/429 ... 24#4290924
Maybe even a good answer here:
https://superuser.com/questions/902027/ ... usb-output
Specifically:
for the adventurous:Checking /sys/class/video4linux/video$N/name and /sys/class/video4linux/video$N/device/driver/* will give give you data, that you will let you find the lsusb line.
https://askubuntu.com/questions/715333/ ... -dev-video
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
So do I, but this utility is not necessary.greengeek wrote:Most of the answers I have seen seem to require v4l2-ctl utility but I don't have it in my system
This lists the attached cameras :
Code: Select all
# cat /sys/class/video4linux/*/name
ELECOM UCAM-DLK130T
HP Webcam-50
This should do. Takes a single shot with my webcam:
Code: Select all
#!/bin/bash
CAMERA=ELECOM
VIDEOx=$(grep -rH "$CAMERA" /sys/class/video4linux/*/name | cut -d/ -f5)
ffmpeg -f video4linux2 -s 640x480 -i /dev/$VIDEOx -vframes 1 /tmp/$(date +%T)_$CAMERA.jpg
Last edited by MochiMoppel on Mon 10 Jul 2017, 08:54, edited 1 time in total.
I was not able to get this to work for my Chicony webcam. It returned an error that /dev/Chicony was not found (it's not there of course - it should have been looking for /dev/video0 or video1 instead.MochiMoppel wrote:This should do. Takes a single shot with my webcam:Code: Select all
#!/bin/bash CAMERA=ELECOM VIDEOx=$(grep -r "$CAMERA" /sys/class/video4linux/*/name | cut -d/ -f5) ffmpeg -f video4linux2 -s 640x480 -i /dev/$VIDEOx -vframes 1 /tmp/$(date +%T)_$CAMERA.jpg
I tried using the line:
Code: Select all
grep -r "Chicony" /sys/class/video4linux/*/name | cut -d/ -f5
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Excellent, many thanks.
Code: Select all
# grep -rH "Chicony" /sys/class/video4linux/*/name | cut -d/ -f5
video0
#
That works nicely - with the exception that the first frame from my camera is very dark. This is apparently because the camera has to run several frames to adjust it's autoexposure, so I tried changing the frames parameter to 10 with the intention of seeing how many frames it takes to lighten up to a satisfactory state. However I got only one frame (too dark again) and the following messages in terminal:
Any thoughts how multiple frames could be gathered? I would like to throw out all of the dark frames and just grab the first clear one - which is probably about frame 8 judging by my previous multiframe tests using the following:
Code: Select all
# ./camshot
ffmpeg version 2.0 Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 16 2013 10:17:34 with gcc 4.7.1 (GCC)
configuration: --prefix=/usr --cpu=i686 --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-pthreads --enable-small --enable-postproc --enable-libvorbis --enable-gpl --enable-shared --enable-nonfree --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-debug --enable-bzlib --enable-zlib --enable-libspeex --enable-version3 --enable-runtime-cpudetect --enable-x11grab --enable-libdc1394 --enable-libschroedinger --enable-libtheora --enable-libxvid --enable-swscale --enable-libvpx
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 2156.844362, bitrate: 147456 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Output #0, image2, to '/tmp/20:50:48_Chicony.jpg':
Metadata:
encoder : Lavf55.12.100
Stream #0:0: Video: mjpeg, yuvj422p, 640x480, q=2-31, 200 kb/s, 90k tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> mjpeg)
Press [q] to stop, [?] for help
[image2 @ 0x8081260] Could not get frame filename number 2 from pattern '/tmp/20:50:48_Chicony.jpg' (either set updatefirst or use a pattern like %03d within the filename pattern)
av_interleaved_write_frame(): Invalid argument
#
Code: Select all
mplayer tv:// -tv driver=v4l2:device=/dev/video0:width=1600:height=1200:outfmt=rgb24 -frames 12 -vo jpeg