Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

gstreamer Initializes Camera Very Slowly

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
schmidtbag
Posts: 249
Joined: 2010-04-14 20:51
Location: MA
Has thanked: 1 time
Contact:

gstreamer Initializes Camera Very Slowly

#1 Post by schmidtbag »

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.

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: gstreamer Initializes Camera Very Slowly

#2 Post by phenest »

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?
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

schmidtbag
Posts: 249
Joined: 2010-04-14 20:51
Location: MA
Has thanked: 1 time
Contact:

Re: gstreamer Initializes Camera Very Slowly

#3 Post by schmidtbag »

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.

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: gstreamer Initializes Camera Very Slowly

#4 Post by phenest »

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

Are there any logs or error messages?
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

schmidtbag
Posts: 249
Joined: 2010-04-14 20:51
Location: MA
Has thanked: 1 time
Contact:

Re: gstreamer Initializes Camera Very Slowly

#5 Post by schmidtbag »

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.

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: gstreamer Initializes Camera Very Slowly

#6 Post by phenest »

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?
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

schmidtbag
Posts: 249
Joined: 2010-04-14 20:51
Location: MA
Has thanked: 1 time
Contact:

Re: gstreamer Initializes Camera Very Slowly

#7 Post by schmidtbag »

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.

Post Reply