Replies: 7 comments 3 replies
-
Would it help if the "broken" output could be abandoned and the application could start a replacement output? |
Beta Was this translation helpful? Give feedback.
-
Hello again @davidplowman , to solve the issue of having to restart the picam module, I suggest we wrap
(in picamera2/outputs/ffmpegoutput.py) in a try-catch block, this prevents the error from causing further issues and the broken pipe can be detected like so in the main loop:
what do you think? This works for me. |
Beta Was this translation helpful? Give feedback.
-
Hi, I think that sounds like a good idea. I wonder if we should do a little more, for example, allowing users to attach a callback to their output object which can get invoked if there's an error. This might even avoid the need for polling - would that be an improvement? |
Beta Was this translation helpful? Give feedback.
-
Hello @davidplowman, would this fix suffice? Is there something else you'd like to add?
init function:
|
Beta Was this translation helpful? Give feedback.
-
Hi, yes I think that looks good. I'd be against adding automatic retries, TBH. You could submit a PR if you wanted, but check the contribution guidelines. Alternatively, as it's a very small change I'd be happy to do it if you could wait a week or so for the update to appear. There's some other work going on at the moment so there should be a Picamera2 update anyway in that kind of timeframe. |
Beta Was this translation helpful? Give feedback.
-
Hello again @davidplowman, I forgot to mention that the ffmpeg processes aren't killed, I think, when the error occurs but new ones are spawned when restarted which leads to memory leaks. I suppose self.ffmpeg.terminate() does the job? |
Beta Was this translation helpful? Give feedback.
-
Probably, try it and see! Obviously you'll have seen in the press why we've been quite so busy of late. There will be updates to all our camera software soon so that they support both older Pis and the new Pi 5. Once we're through that I'll make those changes, if you can test stuff and let me know exactly what the necessary changes are, that would be helpful. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hello folks,
Lately, I've been streaming video using ffmpegOutput with RTSP protocol, but if there happens to be slight network issue, it results in a broken pipe. Now this issue as far as I know, can be resolved by stopping the stream and the camera object, but that messes with the recording that happens in the background, is there any way to handle this error and restart streaming without interfering with the overall camera process? Thank you.
Beta Was this translation helpful? Give feedback.
All reactions