Videogrep searches through dialog in video files (using .srt subtitle tracks or pocketsphinx transcriptions) and makes supercuts based on what it finds.
Videogrep now has an experimental graphic interface (Mac only). Download it here: http://saaaam.s3.amazonaws.com/VideoGrep.app.zip
Install with pip
pip install videogrep
Install ffmpeg with Ogg/Vorbis support. If you're on a mac with homebrew you can install ffmpeg with:
brew install ffmpeg --with-libvpx --with-libvorbis
(OPTIONAL) Install pocketsphinx for word-level transcriptions. On a mac:
brew tap watsonbox/cmu-sphinx brew install --HEAD watsonbox/cmu-sphinx/cmu-sphinxbase brew install --HEAD watsonbox/cmu-sphinx/cmu-sphinxtrain # optional brew install --HEAD watsonbox/cmu-sphinx/cmu-pocketsphinx
The most basic use:
videogrep --input path/to/video_or_folder --search 'search phrase'
You can put any regular expression in the search phrase.
You can also search for part-of-speech tags using Pattern. See the Pattern-Search documentation for some details about how this works, and the Penn Tree bank tag set for a list of usuable part-of-speech tags. For example the following will search for every line of dialog that contains an adjective (JJ) followed by a singular noun (NN):
videogrep --input path/to/video_or_folder --search 'JJ NN' --search-type pos
You can also do a hypernym search - which essentially searches for words that fit into a specific category. The following, for example, will search for any line of dialog that references a liquid (like water, coffee, beer, etc.):
videogrep --input path/to/video_or_folder --search 'liquid' --search-type hyper
NOTE: videogrep requires the subtitle track and the video file to have the exact same name, up to the extension. For example, my_movie.mp4 and my_movie.srt will work, my_movie.mp4 and my_movie_subtitle.srt will not work.
videogrep can take a number of options:
Video or subtitle file, or folder containing multiple files
Name of the file to generate. By default this is "supercut.mp4"
Type of search you want to perform. There are three options:
Maximum number of clips to use for the supercut
Show the search results without making the supercut
Randomize the order of the clips
Padding in milliseconds to add to the start and end of each clip
Transcribe the video using audiogrep/pocketsphinx. You must install pocketsphinx first!
Use the pocketsphinx transcript rather than a subtitle file for searching. If this is enabled you can do word-level searches.
from videogrep import videogrep videogrep.videogrep('path/to/your/files','output_file_name.mp4', 'search_term', 'search_type')
The videogrep module accepts the same parameters as the command line script. To see the usage check out the source.