gstreamer Initializes Camera Very Slowly

Everything about X, Gnome, KDE, ... and everything running on it

gstreamer Initializes Camera Very Slowly

Postby schmidtbag » 2017-06-13 02:17

I have a Logitech C615, and I'm trying to create something that records from it using gstreamer (ffmpeg isn't an option due to hardware limitations). The command I'm using works fine, except it takes around 15 seconds until the camera lights up and it starts recording. This happens during the point where it says "New clock: GstSystemClock". Any ideas how to fix this? Heres the command I'm using:

gst-launch-1.0 v4l2src device=/dev/video0 ! image/jpeg,framerate=30/1,width=640,height=480 ! videorate ! avimux ! filesink location=output.avi

Adjusting the command to use autovideosink instead of filesink results in the same delay.

Note I tried it on two different PCs and the problem persists. I know the command isn't the problem because it works just fine with a different camera. The cameras can't be the problem because they'll start up immediately using other applications.
schmidtbag
 
Posts: 235
Joined: 2010-04-14 20:51
Location: MA

Re: gstreamer Initializes Camera Very Slowly

Postby phenest » 2017-06-13 19:03

schmidtbag wrote:ffmpeg isn't an option due to hardware limitations

Have you tried ffmpeg to see if the camera initialises as expected? Just as a comparison.

Also, does the camera actually work ok with other apps? Cheese uses gstreamer too. Does that initialise ok?
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: gstreamer Initializes Camera Very Slowly

Postby schmidtbag » 2017-06-14 01:12

I have tried ffmpeg and it records immediately with no hesitation. The downside, however, is ffmpeg has really high CPU usage. The ARM platform I intend to use the cameras on can't handle ffmpeg and doesn't support GPU acceleration for it. Meanwhile, gstreamer runs very smooth, has GPU acceleration, and doesn't put much stress on the CPU. I'd also like to point out VLC can open the webcam immediately, too. VLC seems to be less CPU intensive than ffmpeg, but it also seems to give you a lot less control than gstreamer.

In case you're wondering, this issue I'm having behaves the exact same way on both this ARM system and a 3.9GHz Ryzen 1500X.


I like your idea regarding Cheese. If I run it without the camera plugged in, it starts up immediately, though obviously gives me an error about the camera missing. Meanwhile if I run it with the camera plugged in, it actually takes longer for it to start than if I just tell gstreamer to record. I also tried av-caster and that behaves a little different. That still hesitates to open the camera, but it's a little bit faster about it than my command line function.
schmidtbag
 
Posts: 235
Joined: 2010-04-14 20:51
Location: MA

Re: gstreamer Initializes Camera Very Slowly

Postby phenest » 2017-06-14 07:09

Sounds like a bug you may have to report to upstream.

Are there any logs or error messages?
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: gstreamer Initializes Camera Very Slowly

Postby schmidtbag » 2017-06-14 13:48

Even when I run gstreamer with the -v flag, it doesn't say anything during the wait period. I know it isn't frozen because it is actually recording, and will respond to ctrl+c at any time. Once the actual video happens, it will say something but nothing out of the ordinary - just the stuff you normally see regarding the specifications of the video stream.
schmidtbag
 
Posts: 235
Joined: 2010-04-14 20:51
Location: MA

Re: gstreamer Initializes Camera Very Slowly

Postby phenest » 2017-06-14 16:35

schmidtbag wrote:it takes around 15 seconds until the camera lights up and it starts recording.

schmidtbag wrote:I know it isn't frozen because it is actually recording, and will respond to ctrl+c at any time.

One of these statements is contradicting the other. If it's recording during the 15 second delay, is it just the webcam light that isn't lit?
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: gstreamer Initializes Camera Very Slowly

Postby schmidtbag » 2017-06-14 16:50

Sorry, I was being a bit ambiguous. Maybe this'll help clear things up:
When I run the command, it creates the output.avi file by the time it says "New clock: GstSystemClock". Despite it only showing the first frame that was captured by the camera, it is still "recording", because the avi file is getting larger. If I play back the file, there is still roughly 15 seconds of dead air. During this entire time, the status LED on the camera is still off. During this time, I am also able to ctrl+c, and gstreamer will immediately and safely close out the recording the way it is supposed to. This suggests gstreamer isn't frozen.

So despite gstreamer not capturing and recording any new frames, it is still "recording" to the file.
schmidtbag
 
Posts: 235
Joined: 2010-04-14 20:51
Location: MA


Return to Desktop & Multimedia

Who is online

Users browsing this forum: kopper, rick71 and 8 guests

fashionable