ralfbiedert / openh264-rs

Idiomatic Rust wrappers around OpenH264.
66 stars 32 forks source link

Add encoding impl #2

Closed jelmansouri-legion closed 2 years ago

jelmansouri-legion commented 2 years ago

Still considered WIP. The outputted NALs seem valid.

ralfbiedert commented 2 years ago

This is great, thank you so much.

I need some time later in my IDE to get a feeling for the typed API, but I'll merge this since those that are minor issues (if at all) which we can address afterwards.

ralfbiedert commented 2 years ago

I updated a few things and made a new release (0.1.17):

Changes:

Things I noticed but haven't touched:

jelmansouri-legion commented 2 years ago

I will do a what_goes_around_comes_back_around the other way to validate that the minimal impl works both ways For RGB -> YUV I tried to make it at least allocate once, the idea is to reuse the buffer (if threading is needed, a converter per thread would be necessary, but obviously it's quite costly still). So to give you a bit of context my use case is the following, I wanted a CPU fallback/debugging path to hardware encoding in a realtime 3D streaming application. Overall still wrapping my head around h.264. So really glad that I stumbled into your crate. Thanks!

jelmansouri-legion commented 2 years ago

One thing that I wanted to ask is the YUV color space used, currently I know the Color space I used doesn't match the reverse transformation. Should we align on BT.601 or BT.709?

ralfbiedert commented 2 years ago

Disclaimer, my knowledge of H.264 is limited and I'm on my way to work, but some tips / thoughts I found helpful:

image