hudec117 / Mpv.NET-lib-

.NET embeddable video/media player based on mpv for WinForms and WPF
MIT License
138 stars 36 forks source link

How to set aspect ratio, snapshot, get video info ? #39

Closed pubpy2015 closed 3 years ago

pubpy2015 commented 3 years ago

Hi,

can you add some function as set aspect ratio mode (16:9, fit to screen,...), snapshot current video frame and get some information from video as: Resolution, Frame Rate, BitRate ?

songoku141 commented 3 years ago

I found function to set aspect ratio: player.API.SetPropertyString("video-aspect", panel1.Width + ":" + panel1.Height);

snapshot to file: player.API.Command("screenshot-to-file", "C:\1.jpg");

I trying to get snapshot and save it in buffer by this command: player.API.Command("screenshot"); but I dont know where is data return. Please help me.

sctrueew commented 3 years ago

@songoku141 Hi,

How can I set the jpeg quality parameter? I used this command player.API.Command("screenshot-to-file", "C:\1.jpg", "screenshot-jpeg-quality", "70"); but I got the invalid parameter error.

Thanks

songoku141 commented 3 years ago

You can try like this: player.API.SetPropertyLong("screenshot-jpeg-quality", 70); player.API.Command("screenshot-to-file", "C:\1.jpg");

pubpy2015 commented 3 years ago

Thanks,

seem don't have command for screenshot to memory: https://mpv.io/manual/master/#screenshot close here.

sctrueew commented 3 years ago

You can try like this: player.API.SetPropertyLong("screenshot-jpeg-quality", 70); player.API.Command("screenshot-to-file", "C:\1.jpg");

@songoku141 Hi,

Thanks for the reply, But when I use this command I get an error:

 player.API.SetPropertyLong("screenshot-webp-quality", 75);
 player.API.Command("screenshot-to-file", $@"d:\{rnd}.webp");

property not found

sctrueew commented 3 years ago

Thanks,

seem don't have command for screenshot to memory: https://mpv.io/manual/master/#screenshot close here.

Hi,

Did you try this command?

"screenshot-raw" player.API.Command("screenshot-raw");

But I don't know, How to get the output in memory.

chei90 commented 3 years ago

Did you found out something more? I'm interested in screenshot to raw too.