Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make screenshots? #893

Closed
iLeonidze opened this issue Aug 30, 2016 · 5 comments
Closed

How to make screenshots? #893

iLeonidze opened this issue Aug 30, 2016 · 5 comments

Comments

@iLeonidze
Copy link

@iLeonidze iLeonidze commented Aug 30, 2016

I want my app automatically capture over 10-20 random screenshots from the mp4 video in the torrent, without downloading it, but I can't find this feauture in the API.

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Aug 30, 2016

Without downloading it? It's impossible. You can select the 10-20 random parts to screenshots selecting 10-20 random pieces, but those will definitely be downloaded.

This feature is not part of a torrent client function, must be built on top of it. Would be great that if you find it or build it, that you shared it with us :)

@iLeonidze

This comment has been minimized.

Copy link
Author

@iLeonidze iLeonidze commented Aug 31, 2016

@DiegoRBaquero I incorrectly explained my idea - yes, I have to download this pieces, but I don't want to download full videofile. For example, in WebTorrent, when we start downaloding some video, we can see preview in main menu. So by this way I want to get "screenshots".

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Sep 15, 2016

@iLeonidze You can see the code for how we do this in WebTorrent Desktop here: https://github.com/feross/webtorrent-desktop/blob/64f49e4d4fa742d18809e54be3edd93d65055c39/src/renderer/lib/torrent-poster.js

We take advantage of the fact that we're running in a browser context (since it's an Electron app) to implement it simply. Basically, we add the video file to a <video> tag, then we seek to the part we want to screenshot and pull out the pixel data using a canvas. You can see that part here: https://github.com/feross/webtorrent-desktop/blob/64f49e4d4fa742d18809e54be3edd93d65055c39/src/renderer/lib/capture-video-frame.js

I plan to pull these out into their own npm packages so you can use them more easily.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Sep 16, 2016

Here's one of them: capture-frame https://github.com/feross/capture-frame

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.