Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera capture timed out #80

Open
quantum8 opened this issue Aug 13, 2018 · 17 comments · May be fixed by #103
Open

Camera capture timed out #80

quantum8 opened this issue Aug 13, 2018 · 17 comments · May be fixed by #103

Comments

@quantum8
Copy link

quantum8 commented Aug 13, 2018

I'm trying to enable orientation on the pipeline using a pi 3 on raspbian stretch.

My stream seems to work when using:
gst-launch-1.0 -v rpicamsrc name=src preview=0 exposure-mode=night fullscreen=0 bitrate=1000000 annotation-mode=time+date annotation-text-size=20 ! video/x-h264,width=960,height=540,framerate=8/1 ! queue max-size-bytes=0 max-size-buffers=0 ! h264parse ! rtph264pay config-interval=1 pt=96 ! queue ! udpsink host=127.0.0.1 port=5004 sync=false

But inserting the rotation parameter I get an error:
gst-launch-1.0 -v rpicamsrc name=src preview=0 exposure-mode=night fullscreen=0 bitrate=1000000 rotation=180 annotation-mode=time+date annotation-text-size=20 ! video/x-h264,width=960,height=540,framerate=8/1 ! queue max-size-bytes=0 max-size-buffers=0 ! h264parse ! rtph264pay config-interval=1 pt=96 ! queue ! udpsink host=127.0.0.1 port=5004 sync=false

Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... /GstPipeline:pipeline0/GstRpiCamSrc:src.GstPad:src: caps = video/x-h264, width=(int)960, height=(int)540, framerate=(fraction)12/1, stream-format=(string)byte-stream, alignment=(string)nal, profile=(string)constrained-baseline /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-h264, width=(int)960, height=(int)540, framerate=(fraction)12/1, stream-format=(string)byte-stream, alignment=(string)nal, profile=(string)constrained-baseline /GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-h264, width=(int)960, height=(int)540, framerate=(fraction)12/1, stream-format=(string)byte-stream, alignment=(string)nal, profile=(string)constrained-baseline /GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, width=(int)960, height=(int)540, framerate=(fraction)12/1, stream-format=(string)byte-stream, alignment=(string)nal, profile=(string)constrained-baseline /GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-h264, width=(int)960, height=(int)540, framerate=(fraction)12/1, stream-format=(string)byte-stream, alignment=(string)nal, profile=(string)constrained-baseline /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-h264, width=(int)960, height=(int)540, framerate=(fraction)12/1, stream-format=(string)byte-stream, alignment=(string)nal, profile=(string)constrained-baseline Setting pipeline to PLAYING ... New clock: GstSystemClock ERROR: from element /GstPipeline:pipeline0/GstRpiCamSrc:src: Camera capture timed out. Additional debug info: gstrpicamsrc.c(1445): gst_rpi_cam_src_create (): /GstPipeline:pipeline0/GstRpiCamSrc:src: Waiting for a buffer from the camera took too long. Execution ended after 0:00:00.573751795 Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ...

Is there something that I need to add or change here?

@aeozyalcin
Copy link

aeozyalcin commented Jan 17, 2019

I am running into exactly the same issue as you, but I am running Raspbian Jessie... Were you able to solve the issue?

Trying to add vflip/hflip or rotation of any kind breaks the pipeline, saying Camera took too long...

@aeozyalcin
Copy link

Ok I was able to solve the problem by following: #77 (comment)

There is another issue on here for a similar problem, and increasing timeout to 1500 worked for me. Good luck!

@Abu-Abdullah
Copy link

Abu-Abdullah commented May 21, 2019

I'm facing the same issue with normal pipeline:

gst-launch-1.0 -v rpicamsrc ! video/x-h264,width=640,height=480,framerate=8/1,profile=high ! h264parse ! splitmuxsink location=/home/pi/snapshots_tmp/test.mp4 max-size-time=30000000000 max-size-bytes=2000000

this is on Pi0
@thaytan
changing the timeout to 1500 solved the issue. i believe this should be the default number not 500

@jeremyfritzen
Copy link

Hi!
I have the same issue but I don't know how to change the timeout to 1500. Could you explain please? Thanks!

@thaytan
Copy link
Owner

thaytan commented Nov 14, 2019

You need to edit this line:
https://github.com/thaytan/gst-rpicamsrc/blob/master/src/RaspiCapture.c#L941
and change the timeout from 500ms to 1500ms

@thaytan
Copy link
Owner

thaytan commented Nov 18, 2019

This camera timeout needs a more comprehensive fix when I get time. I'm not sure if it's possible to make a solution that auto-adjusts the timeout, but I could make it a property with a sufficiently large default, and let people that need it smaller make it smaller.

@WisdomPill
Copy link

Any update on this?

I am facing the same issue with opencv, this is my pipeline

rpicamsrc preview=false ! video/x-raw,format=BGR,width=640,height=480 ! queue name=sink leaky=2 ! appsink max-buffers=5 drop=true sync=false
[ WARN:0] global /home/pi/opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module rpicamsrc0 reported: Camera capture timed out.
[ WARN:0] global /home/pi/opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/pi/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

@WisdomPill
Copy link

Rasing the timeout to 1500 fixed the issue

@thaytan
Copy link
Owner

thaytan commented Jul 13, 2020

I would like to make it a property, with a higher default

@WisdomPill
Copy link

WisdomPill commented Jul 22, 2020

I correct myself, 1500 ms of timeout just delays the issue.
With raspberry 3b+ happens more often (every 5 minutes) with the standard 500 while with the increased value happens more sporadically.
While with the raspberry 4 it does not happen even with the standard value of 500.

I will try implementing what you have suggested here #77 (comment)

If I see that it works I could issue a pull request with the fix

@thaytan
Copy link
Owner

thaytan commented Jul 22, 2020

what are your lighting conditions like? 1.5seconds before a frame arrives is a very long time!

@WisdomPill
Copy link

WisdomPill commented Jul 23, 2020

They are pretty good, although the application runs 24/7 outdoors so it is possible to have a pitch dark environment.
It does not block only when there is no light, also when there is.

It might be because of resource consumption, the rest of the application is cpu heavy

@thaytan
Copy link
Owner

thaytan commented Jul 24, 2020

That's pretty interesting - I do wonder what's going on when the timeout happens. 1.5 seconds is a really long time to get stuck and not get even a single packet out!

@WisdomPill
Copy link

It is more than two weeks that it is working flawlessly, I added the change and I am proposing a PR, should I do that in the new version of gstreamer as well?

@WisdomPill WisdomPill linked a pull request Aug 9, 2020 that will close this issue
@thaytan
Copy link
Owner

thaytan commented Aug 10, 2020

Simply removing the timeout isn't a fix - it's what was there before the timeout was added in the first place.

@WisdomPill
Copy link

Why it was added? Are there some other tests that I can do?

@thaytan
Copy link
Owner

thaytan commented Aug 10, 2020

I think the original request was for a CSI HDMI-input adapter board and they wanted to detect an error if the HDMI signal went away. The other use case the timeout captures is if the firmware locks up - without a timeout it's possible to get stuck forever trying to dequeue.

I think the best option is to connect the timeout to a property on the element so it can be adjusted as needed, and give it a suitably large default.

I still would like to know why you'd ever get 1.5 seconds gap between frames though. That's far too much - way more than a frame duration at any sensible framerate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants