Skip to main content

Python video summarization.

Project description

Pythonic Video summarization

Sick of nlp text summarization? Presenting: video summarization!

We take advantage of youtube’s comment timestamp video references to generate a summarized + shorter video from any youtube video.

A glance:

>>> import vsummarize

>>> data = vsummarize.summarize('', output='shorter.mp4')

After this command, the physical summarized .mp4 is now in the output path you provided. We return some meta data incase you need it.

Timestamps from youtube comments are included and are important b/c our algorithm generates summaries via the comments and their timestamps.

>>> print data.hot_clips
[('0:12', '0:16'), ..., ('12:31', '13:01')]

>>> print data.timestamps
['0:12', '0:12', '0:14', ..., '12:31']

>>> print data.duration # in seconds

A demo:

I tested this software on a 1 hour long Obama speech.

Original video (59 minutes):

Summarized video (3:30 minutes):

A lot of the time, (even in my product, you just want a list of hot video clips instead of physically summarizing a video into a new .mp4 because of the resource consumption.

To do this, simply ignore the output video file parameter.

>>> data = vsummarize.summarize('')

>>> print data.hot_clips
[('0:12', '0:16'), ..., ('12:31', '13:01')]

The physical, summarized .mp4 has NOT been generated. We just retrieved a set of meta data of what would have happened if we did summarize it.

To actually generate a summary, we use ffmpeg + moviepy along with the above .hot_clips video sequences to stitch together the video.


  • .mp4 video summarization
  • youtube comments timestamp extraction
  • youtube video hot timestamp extraction
  • youtube video hot sub-clip extraction

Get it now

Because I use both OSX and Ubuntu, I have clear instructions on setting up this project in both platforms. However, I can’t guarantee anything for the other platforms besides give installation advice.

We use moviepy, the python video manipulation library, which in turn depends on the ffmpeg library.

Be sure you have pip.

The installation instructions are as follows:


$ brew install ffmpeg


$ curl -O
$ tar -zxvf ffmpeg.static.64bit.2014-02-28.tar.gz
$ sudo mv ffmpeg ffprobe /usr/local/bin/.
$ rm ffmpeg.static.64bit.2014-02-28.tar.gz

And lastly, don’t forget to install vSummarize itself!

$ pip install vsummarize

This app uses the google gdata api. I have a file named which contains my personal api keys. I’ve removed that file from this repo for obvious reasons but i’ve included a file called which has two api key values for you to cleanly fill out. Also, please rename that file to after you are finished!


Because this is such a resource intensive task & lib (especially if you are actually using the summarized .mp4 generation feature), you may notice on a few videos the .mp4 generation fail due to an OS memory exception. This means that you don’t have the RAM for ffmpeg to fork processes to subchunk out your video.


Authored and maintained by Lucas Ou-Yang. Shoutout to Zulko for helping code and giving advice to some parts of this project.

We use moviepy and ffmpeg for video manipulation. We also use google’s youtube api. Please feel free to email & contact me if you run into issues or just would like to talk about the future of this library!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vsummarize-0.0.1.tar.gz (206.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page