Monday, 1 March 2021

Extract specific frames of youtube video without downloading video

I need to extract specific frames of an online video to work on an algorithm but I don't want to download the whole video because that would make it highly inefficient.

For starters, I tried working with youtube videos. I can download whole of the video using youtube-dl in this way:

ydl_opts = {'outtmpl': r'OUTPUT_DIRECTORY_HERE',}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download([url])

And then I can capture individual frames.

I need to avoid downloading the whole video. After some research, I have found that ffmpeg might help me do this. I found no way to download just the frames so if this is not possible, the second option is that I can download specific portions of the video. One such example in linux is here but I couldn't find any solution for python.

What is a good way to download just the frames, or portions of videos (in python) without downloading the entire thing?



from Extract specific frames of youtube video without downloading video

No comments:

Post a Comment