abdallahmehiz / mpvKt

A media player for android, based on mpv-android and built with Jetpack Compose.
Apache License 2.0
618 stars 22 forks source link

Screenshot/Frame Capture option #41

Open NikunjKhangwal opened 2 months ago

NikunjKhangwal commented 2 months ago

Can you add a button on video playback screen to quickly take a screenshot of current frame of video?

77-77SP commented 2 months ago

Wouldn't pausing the video and taking a screenshot natively suffice?

NikunjKhangwal commented 2 months ago

Wouldn't pausing the video and taking a screenshot natively suffice?

Not really. Not just you have to pause the video and it's slower to do but also if the video isn't stretched to screen the black borders on side and a lot of unnecessary elements get captured as well which you have to manually crop later.

remlap commented 2 months ago

Second this request possibly as an onscreen gesture.

abdallahmehiz commented 2 months ago

what gesture would you suggest?

NikunjKhangwal commented 2 months ago

I would personally prefer a button because gesture will be slower but in case that's not possible I'll say tapping with two fingers anywhere on the screen would do the job. Since all one finger gestures are occupied and tapping with two thumbs no matter how you're holding the phone should be fairly easy.

abdallahmehiz commented 2 months ago

I would personally prefer a button because gesture will be slower but in case that's not possible I'll say tapping with two fingers anywhere on the screen would do the job. Since all one finger gestures are occupied and tapping with two thumbs no matter how you're holding the phone should be fairly easy.

I also thing a button would probably be better cause with it i can offer a choice of taking a screenshot with or without subtitles.

NikunjKhangwal commented 2 months ago

I also thing a button would probably be better cause with it i can offer a choice of taking a screenshot with or without subtitles.

Good thought. Mpv on pc also allows both.

remlap commented 2 months ago

I think gesture in an area of the screen like mpv for android has. I like to take a series of screenshots quickly.

abdallahmehiz commented 2 months ago

Good thought. Mpv on pc also allows both.

Any suggestions on where to place it?

Brajesh3 commented 2 months ago

Screenshot_20240907-190714_mpvKt On small screen mobile device i like it here. I can't tell for tabs If get clicked it should take one screenshot/capture single frame And long pressed it should take bunch of screenshot/capture multiple frame with 300ms or 400ms difference

Just a suggestion (not a request) Thank you!

NikunjKhangwal commented 2 months ago

On small screen mobile device i like it here. I can't tell for tabs If get clicked it should take one screenshot/capture single frame And long pressed it should take bunch of screenshot/capture multiple frame with 300ms or 400ms difference

I agree with this one.

77-77SP commented 2 months ago

I would also like to suggest a setting to hide the screenshot button for users who do not need it.

P0bo commented 2 months ago

On small screen mobile device i like it here. I can't tell for tabs

Screenshot_2024-09-08-16-42-25-47_b93262821ba13b7694bb5d76b5032d4b

For tablets i think this is where i dont mind it , but this is just my preference and i think it makes sense since when someone is holding a big tablet they hold it from bottom two corners and placing a button near to middle (vertically or horizontally) is hard to reach .

abdallahmehiz commented 2 months ago

I guess this is the spot then.

Screenshot_20240908-124736

P0bo commented 2 months ago

Screenshot Icon maybe this icon will suit better , also what is the long press action ? maybe a menu to select the default mode to capture the screenshot (include subtitle ot exclude subtitle)

also two buttons so that you can capture screenshot in any of the two mode withought needing to change the defaut mode everytime , so u can capture in that mode if needed .

and another two button to start screenshoting every frame , and stop screenshotting every frame , so user can screenshot a range of time (press the start button the video plays and the screen shots are being saved to a directory then press the stop button to stop the video and screenshot process and u can continue watching ur video). if the Rate of clicking the screenshot can be specified (5 screenshot / sec or 10 screemshot persec [maxing out at video fps/sec]) that would be also cool .

this is just my suggestion be the judge.

abdallahmehiz commented 2 months ago

Lol this is exactly what i am doing. Screenshot_20240908-130520

abdallahmehiz commented 2 months ago

also two buttons so that you can capture screenshot in any of the two mode withought needing to change the defaut mode everytime , so u can capture in that mode if needed .

2 buttons is excessive in my opinion, i am just going to make it so selecting one of those makes it default until changed.

and another two button to start screenshoting every frame , and stop screenshotting every frame , so user can screenshot a range of time (press the start button the video plays and the screen shots are being saved to a directory then press the stop button to stop the video and screenshot process and u can continue watching ur video). if the Rate of clicking the screenshot can be specified (5 screenshot / sec or 10 screemshot persec [maxing out at video fps/sec]) that would be also cool .

Isn't this a bit excessive? I can add an option to the list to enable/disable the 'each-frame' mode instead of an extra button.

Buxuna commented 2 months ago

Screenshot Icon maybe this icon will suit better , also what is the long press action ? maybe a menu to select the default mode to capture the screenshot (include subtitle ot exclude subtitle)

also two buttons so that you can capture screenshot in any of the two mode withought needing to change the defaut mode everytime , so u can capture in that mode if needed .

and another two button to start screenshoting every frame , and stop screenshotting every frame , so user can screenshot a range of time (press the start button the video plays and the screen shots are being saved to a directory then press the stop button to stop the video and screenshot process and u can continue watching ur video). if the Rate of clicking the screenshot can be specified (5 screenshot / sec or 10 screemshot persec [maxing out at video fps/sec]) that would be also cool .

this is just my suggestion be the judge.

I think when log pressed a panel like done with subtitle delay panel would be more organised then add all these options in the panels .

so the single click will capture the screenshot immediately and log press will show the various options

abdallahmehiz commented 2 months ago

I guess a sheet like this should be good? Screenshot_20240908-135526

P0bo commented 2 months ago

Untitled (Copy) maybe also a record clip option ? or it can be a new feature request

abdallahmehiz commented 2 months ago

I kind of wanted to use 'each-frame' flag instead from here: https://mpv.io/manual/master/#command-interface-screenshot-%3Cflags%3E :thinking: Where is this UI from?

P0bo commented 2 months ago

🤔 Where is this UI from?

Just made it in figma

P0bo commented 2 months ago

I kind of wanted to use 'each-frame' flag instead from here: mpv.io/manual/master#command-interface-screenshot-

I mean technically the max rate will be each-frame

Buxuna commented 2 months ago

Untitled (Copy) maybe also a record clip option ? or it can be a new feature request

i think this will be more useful than blindly capturing every frame and filling the gallery .

also why the fuck i find no players with record clip function.

abdallahmehiz commented 2 months ago

also why the fuck i find no players with record clip function.

Probably because recording video is expensive.

cauxar commented 2 months ago

so why the fuck i find no players with record clip function.

Me too i just dont want black borders when i screen record stuf , the native screen recorder records video in screen resolution rather than the video resolution which makes the record size larger by 3-4 fold , i have to encode again myself using a video editor gain to sent in discord etc , which is so much time consuming and not worth really.

Buxuna commented 2 months ago

In my device the size is one problem but there is sound problem too , my device is a bit older and it doesnt allow just recording sound . when i record with sound it also records with mic sound which captures every little background noise 🥲 . I have tried multiple playstore apps and opensource apps but none work , it always records mic sound .

NikunjKhangwal commented 2 months ago

In my device the size is one problem but there is sound problem too , my device is a bit older and it doesnt allow just recording sound . when i record with sound it also records with mic sound which captures every little background noise 🥲 . I have tried multiple playstore apps and opensource apps but none work , it always records mic sound .

Isn't it possible to not allow mic permission to an app? Does no recording app work without mic permission?

abdallahmehiz commented 2 months ago

I've managed to implement the feature but It's lacking in feedback... Any suggestions on how to notify the user of screenshots being taken?

P0bo commented 2 months ago

There maybe better ways to do it , one of the options are to show a Toast message (Screenshot Captured with subtitle) or if a bit more advanced then post notification with share to and open button .

abdallahmehiz commented 2 months ago

Both of those would become annoying with higher rates though (and I'd need to request notifications permission on android 13+)

P0bo commented 2 months ago

yeh thats basically what im experiencing with aniyomi player , i add m3u playlists of anime sometimes and when a serer is turned of it just bombards a series of toasts saying loading failed for every episode in that m3u file from that server .

so maybe a rate limit ? 1 toat nax in 2 sec or 5 sec and if multiple is taken then it will show n screenshots taken not a brainer solution tho

abdallahmehiz commented 2 months ago

Hmmmm... Why not use the Player Updates thing that appears at the top (the one that tells the use which aspect ratio he's using)?

Buxuna commented 2 months ago

I've managed to implement the feature but It's lacking in feedback... Any suggestions on how to notify the user of screenshots being taken?

wow so fast , can we see it in action ?

abdallahmehiz commented 2 months ago

After testing it for a bit. mpv barely takes 3 screenshots per second (without each-frame)...

P0bo commented 2 months ago

A roundabout way of doing it will be using each-frame but saving only the frames based of the rate . i still think its worth it than filling ur gallery with excess screenshots (exept it already is filled 🫠)

abdallahmehiz commented 2 months ago

Thing is... I can't control the rate of each-frame. The thing literally saves every frame that's rendered

P0bo commented 2 months ago

i mean

  1. user sets rate (for example 5 /s)
  2. press start
  3. press stop after 2 sec
  4. mpv saves 48 (24fps) images into tmp folder
  5. now calculate nearest integer from fps/rate (here its 24/5 ~= 5 )
  6. since the screen shots are in order only move every 5th screenshot to the actual screenshot folder and remove the tmp folder
  7. u get ~10~ 9 screenshot instead of 48

weill its not exact its always ±1 unless the fps is divisible by rate without leaving remainder

edit 5.5. save the first frame

abdallahmehiz commented 2 months ago

I mean... for such a niche feature... Lua scripts should provide you a better experience here.

abdallahmehiz commented 2 months ago

I guess I'll just add a button to take single screenshot with the option to disable/enable subtitles and change the file format. this should be enough for most people.

P0bo commented 2 months ago

fair enough , most ppl just do 3 finger swipe anyways .

undeadmecha0 commented 2 months ago

Can you add the screenshot for now? And the rest later

abdallahmehiz commented 2 months ago

I've added it in the screenshot branch, it does take screenshots but you can't find them in the gallery because of the lack of MediaScan functionality. I'll need to edit mpv's jni code to do that.

undeadmecha0 commented 2 months ago

I just tried it and using this flags in mpv conf --screenshot-format=png --screenshot-high-bit-depth=yes --screenshot-png-compression=0 --screenshot-template=[&f] [&p]

it says "took a screenshot" but nothing happened But it works without flags tho I just want an hd screenshot uncompressed

abdallahmehiz commented 2 months ago

Check your /sdcard/Pictures directory. It should be there

abdallahmehiz commented 2 months ago

If you reboot your phone, it will appear in galleries after some time while Android media scans it

undeadmecha0 commented 2 months ago

with those flags mentioned prior screenshot only works on SW and HW/HW+ doesn't