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

New libav integration using PyAv through the PyavOutput class #1154

Merged
merged 4 commits into from
Nov 6, 2024

Conversation

davidplowman
Copy link
Collaborator

This is a bit experimental, but integrates Picamera2 more closely with libav, without the need to pipe stuff out to a separate FFmpeg process.

There are quite a few benefits. We can pass precise timestamps and can avoid all the irritating timestamp warnings caused by FFmpeg resampling the wallclock. I've had to add audio processing via an encoder thread in the base Encoder class, but this even enables us to do things like time-shifted recordings with audio, straight to mp4 files.

It's very versatile which means I'm sure we'll find some niggles down the line was we use it, but it already feels quite useful.

The PyavOutput gives us direct access to libav without having to
route everything to a separate FFmpeg process. This lets us pass
precise timestamps.

Rewrite CircularOutput to create CircularOutput2. The new one
accepts an "output" object and is not derived from FileOutput.
Thus it can be used in conjunction with the PyavOutput.

Signed-off-by: David Plowman <[email protected]>
Plus a few other miscellaneous fixes, and also a new streaming
example.

Signed-off-by: David Plowman <[email protected]>
This also provides a route to using the PyavOutput.

Signed-off-by: David Plowman <[email protected]>
Make the PyavOutput work with existing non-libav encoders that don't
pass a "packet" - so instead we have to make one up.

Signed-off-by: David Plowman <[email protected]>
@davidplowman davidplowman merged commit c2f8ab5 into raspberrypi:next Nov 6, 2024
4 checks passed
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 this pull request may close these issues.

1 participant