Package: vsummarize
Pythonic Video summarizationSick 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:>>>importvsummarize>>>data=vsummarize.summarize('http://youtube.com/watch?v=...',output='shorter.mp4')After this command, the physical summarized.mp4is 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.>>>printdata.hot_clips[('0:12', '0:16'), ..., ('12:31', '13:01')]>>>printdata.timestamps['0:12', '0:12', '0:14', ..., '12:31']>>>printdata.duration# in seconds65A demo:I tested this software on a 1 hour long Obama speech.Original video (59 minutes):http://www.youtube.com/watch?v=hed1nP9X7pISummarized video (3:30 minutes):http://www.youtube.com/watch?v=aDYDN9lsSHgA lot of the time, (even in my product www.shorten.tv),
you just want a list of hot video clips instead of physically summarizing
a video into a new.mp4because of the resource consumption.To do this, simply ignore the output video file parameter.>>>data=vsummarize.summarize('http://youtube.com/watch?v=...')>>>printdata.hot_clips[('0:12', '0:16'), ..., ('12:31', '13:01')]The physical, summarized.mp4has 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 useffmpeg + moviepyalong with the above.hot_clipsvideo sequences to stitch together the video.Features.mp4video summarizationyoutube comments timestamp extractionyoutube video hot timestamp extractionyoutube video hot sub-clip extractionGet it nowBecause 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 usemoviepy, the python video manipulation library, which in turn depends
on theffmpeglibrary.Be sure you havepip.The installation instructions are as follows:OSX:$ brew install ffmpegUbuntu:$ curl -O http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.2014-02-28.tar.gz
$ 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.gzAnd lastly, don’t forget to installvSummarizeitself!$ pip install vsummarizeThis app uses the google gdata api. I have a file namedsettings.pywhich contains
my personal api keys. I’ve removed that file from this repo for obvious
reasons but i’ve included a file calledrename_to_settings.pywhich has two api key
values for you to cleanly fill out. Also, please rename that file tosettings.pyafter
you are finished!WarningBecause this is such a resource intensive task & lib (especially if you are
actually using the summarized.mp4generation feature), you may notice on a few
videos the.mp4generation fail due to anOS memory exception. This means
that you don’t have the RAM forffmpegto fork processes to subchunk out your video.LicenseAuthored and maintained byLucas Ou-Yang.
Shoutout toZulkofor helping code and giving advice to
some parts of this project.We usemoviepyandffmpegfor video manipulation.
We also use google’s youtube api.
Please feel free toemail & contact meif you run into issues or just would like
to talk about the future of this library!