asticode / go-astiav

Golang ffmpeg and libav C bindings
MIT License
393 stars 45 forks source link

Support encoding frames with user-provided pixel data #2

Closed mihelich closed 5 months ago

mihelich commented 2 years ago

Thanks for this package! I'm encoding video with input from an external camera driver, and I need to populate frame buffers (managed by FFmpeg in the C heap) in code. I have a rough version of this working but needed to add capabilities:

  1. Binding for av_frame_make_writable.
  2. Way to access f.c.data pointers without copying.

For development and working around inevitable gaps, I also find it useful to have getters for the underlying C structs (as unsafe.Pointer, which I can cast to *C.struct_AVFrame in my own code).

Are you open to external contributions? I'm happy to send PRs as I come across stuff I need.

asticode commented 2 years ago

I would love external contributions through PRs ! However I may not accept and merge all proposed changes since I may feel they don't fit in this lib properly. The best would be to submit small dedicated PRs for changes you're proposing and we'll go from there 👍

asticode commented 5 months ago

I believe this is now possible with either Packet.FromData() and a proper decoder, or with a demuxer with custom io.

I'll close this issue for now, but feel free to reopen it if necessary 👍