LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't get webcam to capture video with guvcview (https://www.linuxquestions.org/questions/linux-newbie-8/cant-get-webcam-to-capture-video-with-guvcview-4175594797/)

Gregg Bell 12-04-2016 07:30 PM

Can't get webcam to capture video with guvcview
 
I bought a Logitech HD Pro Webcam C920. I tried it with Cheese and the stills are great but the video and audio are terrbily out of sync. I tried Guvciew and I get: Could not start a video stream in the device.

Anybody know how I could get this thing capturing video well? Thanks.

frankbell 12-05-2016 08:13 PM

It's probably not a guvc webcam if it works with Cheese, but not with Guvcview.

What distro/version are you using and what is your graphics card? (Your user agent icon says "Ubuntu," but many Ubuntu derivatives will report as Ubuntu in their user agent strings.)

Gregg Bell 12-06-2016 12:00 AM

Quote:

Originally Posted by frankbell (Post 5638443)
It's probably not a guvc webcam if it works with Cheese, but not with Guvcview.

What distro/version are you using and what is your graphics card? (Your user agent icon says "Ubuntu," but many Ubuntu derivatives will report as Ubuntu in their user agent strings.)

Thanks Frank. Xubuntu 16.04LTS. I'm not on that computer but I'll check it tomorrow and report back (as to what the graphics card is).

BW-userx 12-06-2016 07:42 AM

Quote:

Originally Posted by Gregg Bell (Post 5638013)
I bought a Logitech HD Pro Webcam C920. I tried it with Cheese and the stills are great but the video and audio are terrbily out of sync. I tried Guvciew and I get: Could not start a video stream in the device.

Anybody know how I could get this thing capturing video well? Thanks.

this guy got it to work (i guess) I didn't watch the entire how to video. But it looks like he is using Ubuntutututututu, not that that should really matter, or should it? Ubuntututu is funny like Windows funny.

youtubing

Gregg Bell 12-06-2016 11:41 AM

Quote:

Originally Posted by frankbell (Post 5638443)
It's probably not a guvc webcam if it works with Cheese, but not with Guvcview.

What distro/version are you using and what is your graphics card? (Your user agent icon says "Ubuntu," but many Ubuntu derivatives will report as Ubuntu in their user agent strings.)

Here's the graphic card. Thanks.

Code:

gregory@gregory-GA-A55M-DS2:~/Desktop$ lspci | grep VGA
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] BeaverCreek [Radeon HD 6530D]
gregory@gregory-GA-A55M-DS2:~/Desktop$


Gregg Bell 12-06-2016 11:44 AM

Quote:

Originally Posted by BW-userx (Post 5638603)
this guy got it to work (i guess) I didn't watch the entire how to video. But it looks like he is using Ubuntutututututu, not that that should really matter, or should it? Ubuntututu is funny like Windows funny.

youtubing

Thanks BW. I already saw that youtube video and if you'll notice he never shows the video with audio. If you google around you find all kinds of people have trouble syncing the video and audio with Cheese. I guess there's no solution. I guess Linux people never record video from webcams. LOL

Sefyir 12-06-2016 08:57 PM

If you have cheese already open, guvview won't be able to grab the video from the webcam.
Just a thought.

I would suggest trialling OBS (Open Broadcast Studio).
It's a little overkill for just recording a webcam, but I've been using the C920 webcam and it's been flawless 1920p 30fps ever since I got it (no special config done)

You could of course use mplayer or ffmpeg to simply record from the webcam to a file.

Gregg Bell 12-07-2016 11:34 AM

Quote:

Originally Posted by Sefyir (Post 5638950)
If you have cheese already open, guvview won't be able to grab the video from the webcam.
Just a thought.

I would suggest trialling OBS (Open Broadcast Studio).
It's a little overkill for just recording a webcam, but I've been using the C920 webcam and it's been flawless 1920p 30fps ever since I got it (no special config done)

You could of course use mplayer or ffmpeg to simply record from the webcam to a file.

Thanks Sefyir. I just want to record simple videos of me talking. It would help to be able to see myself in the monitor as it records. Would OBS or mplayer or ffmpeg be best for that? Thanks.

P.S. I did not have Cheese and guvcview open at the same time.

Sefyir 12-07-2016 12:25 PM

Quote:

P.S. I did not have Cheese and guvcview open at the same time.
Not sure then about that..

But if it's just a fullscreen of you and you want to be able to see yourself, you could try a desktop recorder like recordmydesktop or kazam and doing something like mplayer -fs -x 1920 -y 1080 tv://

I still suggest OBS though. You can have it record you in full screen and let you do other stuff at the same time. If you want to see yourself, just bring up the OBS window
It should be in repo: obs-studio

Gregg Bell 12-07-2016 08:25 PM

1 Attachment(s)
Quote:

Originally Posted by Sefyir (Post 5639190)
Not sure then about that..

But if it's just a fullscreen of you and you want to be able to see yourself, you could try a desktop recorder like recordmydesktop or kazam and doing something like mplayer -fs -x 1920 -y 1080 tv://

I still suggest OBS though. You can have it record you in full screen and let you do other stuff at the same time. If you want to see yourself, just bring up the OBS window
It should be in repo: obs-studio

Thanks Sefyir. I'd like to try OBS. I'm not up on how to get it though. Think the way they have it on the website https://obsproject.com/download would work? Just run those four commands? (see screenshot)

Sefyir 12-07-2016 10:10 PM

EDIT: Yup, just follow the instructions in that image. If you have ffmpeg installed, you don't need to follow the top part.

You're running some form of Ubuntu?

I think you need to add their ppa first. You have ffmpeg installed yeah?


You should be able to follow this
https://github.com/jp9000/obs-studio...ructions#linux

Code:

Ubuntu installation

    FFmpeg is required. If you do not have the FFmpeg installed (if you're not sure, then you probably don't have it), you can get it with the following commands:

    For Ubuntu 14.04 LTS, FFmpeg is not officially included so you will need a specific PPA:

    sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next
    sudo apt-get update && sudo apt-get install ffmpeg

    For Ubuntu 15.04 and following versions, FFmpeg is officially included:

    sudo apt-get install ffmpeg

    Then you can install OBS with the following commands:

    sudo add-apt-repository ppa:obsproject/obs-studio
    sudo apt-get update && sudo apt-get install obs-studio


BW-userx 12-08-2016 07:36 AM

to screen capture with ffmpeg

Code:

ffmpeg -r 30 -s 1600x900 -f x11grab -i :0.0 -vcodec msmpeg4v2 -qscale 2 screencap001.avi
adjust the size and filename as you please. I do not think that does sound though. you'd have to check to be sure.

Shadow_7 12-08-2016 08:37 AM

Technically there a compressed stream coming off that webcam already. You shouldn't have any sync issues capturing that. It's a common device for beaglebone black, which isn't that beefy specs wise. If you have enough computes you can play it back on screen and screen capture.

Code:

$ mpv --ao=pulse --vo=opengl --video-zoom=0 --framedrop=vo \
      --no-osc --osd-level=1 --demuxer-lavf-format=video4linux2 \
      -fs /dev/video1

$ avconv -f alsa -i default -f x11grab -s 1920x1080 -r:v 5 -draw_mouse 0 \
        -i :0.0+0,0 -r:v 5 -aspect 16:9 -pix_fmt yuv444p -async 1 \
        -codec:a pcm_s16le -codec:v libx264 -pre:v lossless_ultrafast \
        -filter_complex "asyncts=compensate=1:min_delta=0.1:max_comp=500:first_pts=0" \
        -y outout.mkv

$ mpv --ao=pulse --vo=opengl --video-zoom=0 --framedrop=vo \
      --no-osc --osd-level=1 -fs output.mkv

The "async 1" is a legacy option, but is required IME to achieve av sync. The -filter_complex is the new way (in theory) but doesn't seem to do anything without "async 1". The parms past it should be defaults (long hand in case I needed to adjust). The -r:v 5 is the fps, which you have to keep without the computation specs of your device and it's optimizations. Most of mine being dual cores with 2GB ram at about 2GHz each core, so 5fps is the safe zone which allows me to capture and do stuff. And avconv which is the fork of ffmpeg in debian jessie.

Not sure if the old way of $(/dev/video0 > capture.raw) would work for that one, it does have an onboard encoder. You'll likely need to set attributes with v4l2-ctl, uvcdynctrl, and friends. With tools like vlc you need to pass the parameters to vlc if it's not the default (highest capability). guvcview is good for setting preferences, but vlc will ignore them. While mpv will go with the flow / inherit attributes IME. Where IME equals in my experience.

In the case of my c270, playback via longhand:

Code:

uvcdynctrl --device=video1 --set 'LED1 Mode' 0 'LED1 Frequency' 0; \
v4l2-ctl --device=/dev/video1 \
        --set-fmt-video=width=1280,height=960,pixelformat=MJPG --set-parm="5"; \
mpv --ao=pulse --vo=opengl --video-zoom=0 --framedrop=vo \
    --no-osc --osd-level=1 --demuxer-lavf-format=video4linux2 \
    -fs /dev/video1

Which is the highest resolution at the framerate my low spec'd gear can handle. And turning the LED OFF since that reflects if you have it pointed out a window. Sometimes I have to unplug and replug the webcam for that LED option to exist. Even after a cold boot.

If the MJPG format is supported, then vlc can stream the webcam over the network. Although it's a lot of data and 960x720 @ 5fps is the best I could do without capping out the bitrate of a 10/100 network (rpi B).
.

Shadow_7 12-08-2016 08:45 AM

I tend towards the screen capture because the webcam is often a variable frame rate device and sync is an issue. For example if I set capture at 30 fps, the webcam will still drop to 15 fps in low light. Capturing the screen lets you set a fixed frame rate (and keep it). Not a lot of webcams give you much control of basic camera settings like frame rate, aperture, iso, and such.

Gregg Bell 12-08-2016 10:29 PM

Quote:

Originally Posted by Sefyir (Post 5639371)
EDIT: Yup, just follow the instructions in that image. If you have ffmpeg installed, you don't need to follow the top part.

You're running some form of Ubuntu?

I think you need to add their ppa first. You have ffmpeg installed yeah?


You should be able to follow this
https://github.com/jp9000/obs-studio...ructions#linux

Code:

Ubuntu installation

    FFmpeg is required. If you do not have the FFmpeg installed (if you're not sure, then you probably don't have it), you can get it with the following commands:

    For Ubuntu 14.04 LTS, FFmpeg is not officially included so you will need a specific PPA:

    sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next
    sudo apt-get update && sudo apt-get install ffmpeg

    For Ubuntu 15.04 and following versions, FFmpeg is officially included:

    sudo apt-get install ffmpeg

    Then you can install OBS with the following commands:

    sudo add-apt-repository ppa:obsproject/obs-studio
    sudo apt-get update && sudo apt-get install obs-studio



Thanks Sefyir. Yeah, I should've said I have Xubuntu 16.04LTS so I should be okay following the instructions. Appreciate it!


All times are GMT -5. The time now is 05:28 PM.