Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to capture still frames from a Youtube video? [closed]

I have a website based in PHP and I'm looking for a way to take a Youtube URL and capture still frames based on a specified interval (for example, capturing still frames every 5 seconds of a 1 minute youtube video)? How could I go about doing this?

I'm looking for general direction (understanding that the solutions may be complex).

Requirements: The solution needs to run on web server (independent of desktop applications)

like image 345
Ryan Avatar asked Aug 21 '11 02:08

Ryan


People also ask

Can I get a still frame from a YouTube video?

Click the arrow next to export video at the top right corner of the Studio and select export as image. Use the slider that appears below the video to select the exact frame you want to download. You can also use the left and right arrows on your keyboard for more precision.


2 Answers

This solution should work just fine, although it may not be very stable because AFAIK youtube keeps changing things up and the video location is changed from time to time.

But the author keeps coming up with fixes, so it's good. This requires a Python interpreter though (should be available on any linux anyways these days).

  1. Get youtube-dl. Just download it and chmod +x youtube-dl https://github.com/rg3/youtube-dl

  2. Create a function which takes youtube url and feeds it to youtube-dl.

  3. The resulting video can now be modified with ffmpeg to take snapshots.

Skills required: starting subprocesses from PHP

like image 189
Uku Loskit Avatar answered Oct 29 '22 16:10

Uku Loskit


The easiest way to do this is to use the operating system's API to take print-screen captures. If you are using windows then I recommend doing it through through AutoHotKey. AutoHotKey provides a very easy scripting language that is higher-level and more intuitive than the Windows API. If you are able to use this software you can probably piece together what you need from one or two sources. For example, here is a thread (with code) for taking a screenshot and saving as a .jpg.

like image 33
frank Avatar answered Oct 29 '22 15:10

frank