elixir-webrtc / xav

Elixir wrapper over FFmpeg for reading and decoding audio and video data
Apache License 2.0
40 stars 4 forks source link

Add `to_image/1` with `Image` lib #15

Closed kevinschweikert closed 1 month ago

kevinschweikert commented 1 month ago

Just for convenience in Livebook and other places to render the frame with kino for example

mickel8 commented 1 month ago

I am not sure about this one :thinking:

  1. You use function from a Vix package so it would be more accurate to require it instead of the Image?
  2. We can do:
    tensor = Xav.Frame.to_nx(frame)
    Kino.Image.new(tensor)
  3. I added nx to make it easier to convert Xav.Frame to something that is compatible with elixir-nx but in general, I don't think it's a good direction. We can end up having a lot of optional dependencies, making the dev compilation time longer. Vix also depends on native code :/
kevinschweikert commented 1 month ago

That all makes sense. I just wanted to make it easier to play around with xav in Livebook to check the frame visually without the intermediate Tensor calculation and because image is the de-facto standard with the render protocol for livebook. But i totally understand, if you don't want to add optional libraries for compilation times and native dependecies. Let me know if you'd like the change to the vix dependency or if you don't want these addition and close this PR. Both fine with me, cause this PR just a proposal/idea. Thank you for your feedback!

mickel8 commented 1 month ago

Yeah, maybe let's close the PR for now and reopen if there are more requests for this feature :) Anyway, thanks for your engagement!!!