[Feature]: Reduce per-frame buffer copy cost in GStreamer video writing
#860 opened on Mar 27, 2026
Repository metrics
- Stars
- (675 stars)
- PR merge metrics
- (PR metrics pending)
Description
Investigate whether the current GStreamer write path can avoid or reduce per-frame buffer copying.
Motivation
If each frame allocates and copies data before pushing to GStreamer, that adds overhead in hot video paths. This is especially important for high resolution, high FPS, or embedded scenarios where allocation and memory bandwidth costs are more visible.
Proposed Solution
- Profile the current buffer creation and copy path.
- Explore cheaper alternatives such as reusable buffers, buffer pools, or safer zero-copy-style handoff patterns where possible.
- Keep correctness and ownership semantics explicit.
- Add benchmark coverage or before/after measurements.
Expected Outcome
Video writing becomes more efficient, with lower per-frame overhead and better scalability for demanding workloads.
✅ Acceptance Criteria
- Current copy cost is measured or characterized.
- At least one cheaper path is evaluated or implemented.
- Public behavior remains correct and documented.
- Benchmark or measured evidence is included in the PR.
Additional Context
This issue complements async write support but should remain separate. One focuses on blocking behavior and API design, while this one focuses on memory and copy efficiency in the hot path.
Code Reference
// crates/kornia-io/src/gstreamer/video.rs ~204
// TODO: verify is there is a cheaper way to copy the buffer
🤝 Contribution Intent
- I plan to submit a PR to implement this feature
- I'm requesting this feature but not planning to implement it