mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.34k stars 2.91k forks source link

[Question] Ways to retrieve MPV decoded frame #6370

Closed Rares14324 closed 5 years ago

Rares14324 commented 5 years ago

mpv version and platform Version v0.29.1 Windows

This is more of a question asking for advice about how to get the decoded frame from MPV. I know about the the renderer API but currently there is only OpenGL there. I'm mostly interested in getting the decoded frame, do some more work on that frame the handle the displaying myself. I use mpv as a library (libmpv). I read the documentation about "embedding" it and analyzed the examples from qt (both when using a default window and let mpv create the context and everything and the one using the renderer api). The problem is that the transfer from OpenGL FBO to CPU where I do my processing is taking too much for 4K videos in order to have a real-time execution time. I guess my questions would be: Is there a different way to retrieve the decoded frame from libmpv other than rendering it to a OpenGL FBO ? If yes could you point me to some hints on how to do it ?

Thank-you.

haasn commented 5 years ago

I mean, essentially what you want to end up doing is writing your own vo. I'm not sure if libmpv is really designed to handle that use case at the moment. You'd probably have to fork mpv itself or something, unless somebody wants to come up with a design for this (like a libmpv-cb VO or something).

(If you're looking for an alternative, I believe libvlc allows you to write your own vout module)

EzeKees commented 5 years ago

I am also interested in this function. I currently use mpv via libmpv and would love to have this function, for example mpv_get_current_bitmap. I know there are screenshots, but it would be nice if it is implemented natively.

ghost commented 5 years ago

In theory, one could add a libmpv render backend that returns raw frames. You could also use the screenshot-raw command, which at least doesn't go over disc (but far from an ideal approach). Closing issue because of age, I don't even know if anyone will read what I write here.

BBC6BAE9 commented 8 months ago

need this function too.