GithubHelp home page GithubHelp logo

videogrep's Introduction

Videogrep

Videogrep is a command line tool that searches through dialog in video or audio files and makes supercuts based on what it finds. It will recognize .srt or .vtt subtitle tracks, or transcriptions that can be generated with vosk, pocketsphinx, and other tools.

Examples

Tutorial

See my blog for a short tutorial on videogrep and yt-dlp, and part 2, on videogrep and natural language processing.


Installation

Videogrep is compatible with Python versions 3.6 to 3.10.

To install:

pip install videogrep

If you want to transcribe video or audio, you also need to install vosk:

pip install vosk

Note: the previous version of videogrep supported pocketsphinx for speech-to-text. Vosk seems much better so I've added support for it and will likely be phasing out support for pocketsphinx.

Usage

The most basic use:

videogrep --input path/to/video.mp4 --search 'search phrase'

It works with audio too:

videogrep --input path/to/audio.mp3 --search 'search phrase'

You can put any regular expression in the search phrase.

NOTE: videogrep requires a matching subtitle track with each video you want to use. The video/audio file and subtitle file need to have the exact same name, up to the extension. For example, my_movie.mp4 and my_movie.srt will work, and my_movie.mp4 and my_movie_subtitle.srt will not work.

Videogrep will search for matching srt and vtt subtitles, as well as json transcript files that can be generated with the --transcribe argument.

Options

--input [filename(s)] / -i [filename(s)]

File or files to use as input. Most video or audio formats should work. If you mix audio and video input files, the resulting output will only be audio.

--output [filename] / -o [filename]

Name of the file to generate. By default this is supercut.mp4. Any standard video or audio extension will also work. (If you're using audio input or mixed audio and video input and you keep the default supercut.mp4 as the output filename, videogrep will automatically change the output to supercut.mp3)

Videogrep will also recognize the following extensions for saving files:

  • .mpv.edl: generates an edl file playable by mpv (useful for previews)
  • .m3u: media playlist
  • .xml: Final Cut Pro timeline, compatible with Adobe Premiere and Davinci Resolve
videogrep --input path/to/video --search 'search phrase' --output coolvid.mp4

--search [query] / -s [query]

Search term, as a regular expression. You can add as many of these as you want. For example:

videogrep --input path/to/video --search 'search phrase' --search 'another search' --search 'a third search' --output coolvid.mp4

--search-type [type] / -st [type]

Type of search you want to perform. There are two options:

  • sentence: (default): Generates clips containing the full sentences of your search query.
  • fragment: Generates clips containing the exact word or phrase of your search query.

Both options take regular expressions. You may only use the fragment search if your transcript has word-level timestamps, which will be the case for youtube .vtt files, or if you generated a transcript using Videogrep itself.

videogrep --input path/to/video --search 'experience' --search-type fragment

--max-clips [num] / -m [num]

Maximum number of clips to use for the supercut.

--demo / -d

Show the search results without making the supercut.

--preview / -pr

Preview the supercut in mpv (requires mpv to be installed)

--randomize / -r

Randomize the order of the clips.

--padding [seconds] / -p [seconds]

Padding in seconds to add to the start and end of each clip.

--resyncsubs [seconds] / -rs [seconds]

Time in seconds to shift the shift the subtitles forwards or backwards.

--transcribe / -tr

Transcribe the video/audio using vosk. This will generate a .json file in the same folder as the video. By default this uses vosk's small english model.

NOTE: Because of some compatibility issues, vosk must be installed separately with pip install vosk.

videogrep -i vid.mp4 --transcribe

--model [modelpath] / -mo [modelpath]

In combination with the --transcribe option, allows you to specify the path to a vosk model folder to use. Vosk models are available here in a variety of languages.

videogrep -i vid.mp4 --transcribe --model path/to/model/

--export-clips / -ec

Exports clips as individual files rather than as a supercut.

videogrep -i vid.mp4 --search 'whatever' --export-clips

--export-vtt / -ev

Exports the transcript of the supercut as a WebVTT file next to the video.

videogrep -i vid.mp4 --search 'whatever' --export-vtt

--ngrams [num] / -n [num]

Shows common words and phrases from the video or audio file.

videogrep -i vid.mp4 --ngrams 1

Use it as a module

from videogrep import 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.

Example Scripts

Also see the examples folder for:


Credits

Videogrep is maintained by Sam Lavigne, and built using MoviePy and Vosk. A big thanks goes out to all those who have contributed, particuarly to Charlie Macquarie for his efforts in getting the project to work with audio-only media.

Videogrep has received financial support from the Department of Digital Humanities, King’s College London and from the Clinic for Open Source Arts.

videogrep's People

Contributors

antiboredom avatar autonomoid avatar bencomp avatar blha303 avatar bryant1410 avatar charliemacquarie avatar darkceptor44 avatar djds23 avatar edsu avatar habi avatar kant avatar matteogheza avatar miamiww avatar nicoweio avatar pluggi avatar seanson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

videogrep's Issues

Trouble with making supercut from batch of clips

Hello,

This may be a super silly question. Videogrep works fine when the path points to a file but not a whole folder of clips/.srts.

videogrep --input /Users/test/Documents/python\ scripts/donaldtrump/ --search 'have' --search-type word
[!] No subtitle files were found.
Traceback (most recent call last):
File "/usr/local/bin/videogrep", line 5, in
videogrep.main()
File "/usr/local/lib/python2.7/site-packages/videogrep/videogrep.py", line 339, in main
videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, args.maxclips, args.padding, args.demo, args.randomize, args.sync, args.use_transcript)
File "/usr/local/lib/python2.7/site-packages/videogrep/videogrep.py", line 281, in videogrep
composition = compose_from_srts(srts, search, searchtype, padding=padding, sync=sync)
File "/usr/local/lib/python2.7/site-packages/videogrep/videogrep.py", line 178, in compose_from_srts
for srt in srts:
TypeError: 'bool' object is not iterable

Am I missing something? I've tried with and without the backslash after the folder name.

Thanks!

No module named '__main__.vtt'; '__main__' is not a package

I am using Win10, python 3.70, everything installed fine, but I got this, problem.
In CMD, I used>
SET PATH=%PATH%;O:\Python3.7\Lib\site-packages\videogrep
already .srt or .vtt subtitle on folder and subtitle is showing on vlc player.

G:\Python37\Lib\site-packages\videogrep>videogrep --input "G:\iG\bikini" --sea
rch 'auditions'
Traceback (most recent call last):
File "G:\Python37\Lib\site-packages\videogrep\videogrep.py", line 14, in
from .vtt import parse_auto_sub
ModuleNotFoundError: No module named 'main.vtt'; 'main' is not a package

G:\Python3.7\Lib\site-packages\videogrep>

Totally clueless! any help. thanks.

See nothing when i run the command

Hello, when i run the following command, i see nothing.
python videogrep-master/videogrep.py --input /media/hieu/Hihihe/Films --output love.mp4 -s "love" --search-type hyper --padding 2 --max-clips 1 --test --randomize

I edited 2 lines,
FFMPEG_BINARY = '/usr/bin/ffmpeg'
usable_extensions = ['mp4', 'avi', 'mov','mkv']

Here i my folder structure:
tree Letters.to.Juliet.2010.[mHD-720p][AC3][x264][TRiM]/
Letters.to.Juliet.2010.[mHD-720p][AC3][x264][TRiM]/
├── Letters.to.Juliet.2010.[mHD-720p][AC3][x264][TRiM].mkv
├── Letters.to.Juliet.2010.[mHD-720p][AC3][x264][TRiM].nfo
├── Letters.to.Juliet.2010.[mHD-720p][AC3][x264][TRiM].srt
└── Letters.to.Juliet.2010.[mHD-720p][AC3][x264][TRiM].vie.srt

Create individual clips

Any suggestions for a few lines to add to export the clips as individual files instead of stitched into a full movie?

Persistent errors: Windows error (123) and max() arg is empty sequence

I'm using Win XP, SP3. This old girl runs on hamsters. Still, she can handle most python scripts. Here's what I've done so far: Uninstalled and reinstalled all of the elements needed including Python27. I have uninstalled all other Pythons. I have checked all the environment variables and pointed the scripts to my ffmpg installation. I have gone through the videogrep script and removed all unnecessary white space and standardised the tabs (to tabs, then to spaces). When I run the script it finds the .srt file, then the .mp4 file. In my example search ...

(python -m pdb d:\videogrep-master\videogrep.py --input "E:\Movies\TheMatrix\The_Matrix.mp4" --search "JJ NNS" --search-type pos)

... it finds 24 instances of the search term. Notice that I am running this through pdb. 24 results means that the script calls create_supercut_in_batches(). create_supercut_in_batches() then calls create_supercut() inside a try/except block which in turn calls demo_supercut() whose sole function seems to be to print out the details of each clip (start, end, line). All this works fine and I get the list printed to my screen for the first 20 clips, and then again for the next 4 clips. This is where I'm lost. All of this is happening inside the try/except block in create_supercut_in_batches(). What isn't happening are any of the commands in the try block that follow the call to create_supercut(). Here's the code:

while start_index < total_clips:
        filename = outputfile + '.tmp' + str(start_index) + '.mp4'
        try:
            create_supercut(composition[start_index:end_index], filename, padding)
            batch_comp.append(filename)
            gc.collect()
            start_index += batch_size
            end_index += batch_size
        except:
            start_index += batch_size
            end_index += batch_size
            next

So, none of this gets done:

            batch_comp.append(filename)
            gc.collect()
            start_index += batch_size
            end_index += batch_size

...which means, in turn, that batch_comp is an empty set. The next command following the while loop (inside of which is the try/except block above) calls moviepy:

clips = [VideoFileClip(filename) for filename in batch_comp]

... but batch-comp is an empty set, thus (I guess) generating the max() args error.

Sorry to be so long-winded, but this is an issue that others are having too and this is my best shot at it so far. The problem is I'm stumped. Why don't the commands that follow the call to create_supercut() in the try block get actioned? As I say, I've checked all the white spaces and the tabs etc. I've placed break points on those lines and they just don't get triggered.

Any help, please.

Subtitle detection - find {videoname}.{lang}.srt

The youtube-dl script downloads english subtitles using the naming scheme.

{videoname}.{lang}.srt

e.g.

Bob The Builder.en.srt
Bob The Builder.avi

It might be worth using a library to find the subtitles, (maybe whatever xbmc uses) - so it's easy to find various types.

silence.py requires .srt file?

Apologies if I’m being a doofus and missing something obvious here, but am I correct in thinking that in order to use silence.py you need a .srt file, rather than a pocketsphinx transcript? And if this is the case, is there a way to convert a pocketsphinx transcript into a .srt?

I also want to say THANK YOU for videogrep and audiogrep, both such great tools for creation - and thanks in advance to anyone who replies! :)

No subtitle files were found

when I run a command :
python videogrep.py --input C:\Users\Guestuser\Desktop\Newfolder --search 'big'

it shows the following error

[!] No subtitle files were found.
Traceback (most recent call last):
File "videogrep.py", line 422, in
main()
File "videogrep.py", line 418, in main
videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, args.maxclips, args.padding, args.demo, args.randomize, args.sync, args.use_transcript)
File "videogrep.py", line 357, in videogrep
composition = compose_from_srts(srts, search, searchtype, padding=padding, sync=sync)
File "videogrep.py", line 254, in compose_from_srts
for srt in srts:
TypeError: 'bool' object is not iterable

This is my folder structure.
image

Please, anyone, tell me the solution.

The Mac App! Wow

I've been trying to look into GUI interfaces and your videogrep beta app is fantastic!
Are you planning on releasing the source?
If not, can you please tell me what frameworks you're using?
Thank you,
Great Job

Not able to install videogrep in Arch Linux

$ sudo pip install videogrep
Collecting videogrep
Downloading videogrep-0.5.0.tar.gz
Requirement already satisfied: audiogrep in /usr/lib/python3.6/site-packages (from videogrep)
Collecting Pattern (from videogrep)
Downloading pattern-2.6.zip (24.6MB)
100% |████████████████████████████████| 24.6MB 19kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-u2qtl19h/Pattern/setup.py", line 40
print n
^
SyntaxError: Missing parentheses in call to 'print'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-u2qtl19h/Pattern/

videogrep ffmpeg mosaic

Seeing as videogrep uses ffmpeg to concat the videos together, is it possible to create a mosaic rather than a single long video? The ultimate goal would be to have the videos aligned so that the search text is all being said at the same time in the mosaic, but just outputting it as a mosaic first seems like a good enough entry point to me.

Thanks!

Exception Attribute Error / Windows Error 5

Hi,

First thanks for this great project! Hopefully you can help me with this error.

Ran this command on Windows 7, 64-bit:
python videogrep.py --input c:/orange/ --search "text" --max-clips 3

Got this:

Traceback (most recent call last):
File "videogrep.py", line 261, in
videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, arg
s.maxclips, args.padding, args.test, args.randomize, args.sync)
File "videogrep.py", line 241, in videogrep
create_supercut(composition, outputfile, padding)
File "videogrep.py", line 86, in create_supercut
videofileclips = dict([(f, VideoFileClip(f)) for f in all_filenames])
File "C:\Python27\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 5
8, in init
self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt)
File "C:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 1
7, in init
infos = ffmpeg_parse_infos(filename, print_infos)
File "C:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 1
97, in ffmpeg_parse_infos
stderr=sp.PIPE)
File "C:\Python27\lib\subprocess.py", line 679, in init
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 896, in _execute_child
startupinfo)
WindowsError: [Error 5] Access is denied
Exception AttributeError: "FFMPEG_VideoReader instance has no attribute 'proc'"
in <bound method FFMPEG_VideoReader.del of <moviepy.video.io.ffmpeg_reader.F
FMPEG_VideoReader instance at 0x04E78B48>> ignored

I saw an earlier discussion of a similar error here:
#18

Unfortunately for me, using -m flag does it help, no matter what values I try.

Thank you in advance~

Trouble running videogrep

When I try to run videogrep through cli, I get

'videogrep' is not recognized as an internal or external command,
operable program or batch file.

Running Windows 10, it seems that in Python36-32\Scripts, it seems that the videogrep file is not a .exe like the others. I believe this is the culprit, but I'm not sure how to make it a .exe.

Subtitles from freeview transport streams

It would be good if it could extract these somehow, as it would make it super easy to capture stuff off the TV.

[Freeview is the UK digital tv standard (DVB-T), I think it's similar in other places tooo]

Some quick googling + I found this

http://ccextractor.sourceforge.net/

Which seems like it might be able to extract subs from pretty much anything and convert to srt

Encountering ValueError during operation

First of all, brilliant idea and very well executed !

I was trying to use videogrep to generate a supercut of clips from a movie, but I encountered a ValueError.

I edited 2 lines,
FFMPEG_BINARY = '/usr/bin/ffmpeg'
usable_extensions = ['mp4', 'avi', 'mov', 'mkv']

The folder structure that I'm trying to run it on -
/Fight Club
├── Fight Club.mkv
└── Fight Club.srt

$ python videogrep.py --input ~/Stuff/Movies/Fight\ Club --search 'Tyler'

The traceback of the error -

Traceback (most recent call last):
  File "videogrep.py", line 200, in <module>
    videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, args.maxclips, args.padding, args.test, args.randomize)
  File "videogrep.py", line 182, in videogrep
    create_supercut(composition, outputfile, padding)
  File "videogrep.py", line 87, in create_supercut
    video = concatenate(clips)
  File "/home/alexmathew/pyenv/local/lib/python2.7/site-packages/moviepy/video/compositing/concatenate.py", line 55, in concatenate
    w = max([r[0] for r in sizes])
ValueError: max() arg is an empty sequence

Do let me know what the possible problems could be, and how to fix it.

No audio.

First off, videogrep is awesome. Just wait until buzzfeed & filmdrunk discover it.

That said, I'm having some trouble. Every mp4 video that I run through generates a supercut without audio. I know that playable ogg files are being generated & that videogrep is finding the phrases I'm looking for, but the final output mp4 is silent.

I'm running a pretty simple case & I reinstalled ffmpeg via brew per instruction.
python videogrep.py --input video.mp4 --search 'man' --search-type hyper

No subtitle files were found!

C:\Python37>python C:\Python37\myvideogrep.py -i "C:\A" --search "Not you" -o "C:\test.mp4"python C:\Python37\myvideogrep.py -i "C:\A" --search "Not you" -o "C:\test.mp4"
usage: myvideogrep.py [-h] --input [INPUTFILE [INPUTFILE ...]]
[--search SEARCH]
[--search-type {re,pos,hyper,fragment,franken,word}]
[--use-transcript] [--use-vtt] [--max-clips MAXCLIPS]
[--output OUTPUTFILE] [--export-clips] [--demo]
[--randomize] [--youtube YOUTUBE] [--padding PADDING]
[--resyncsubs SYNC] [--transcribe] [--ngrams NGRAMS]
myvideogrep.py: error: unrecognized arguments: C:\Python37\myvideogrep.py

C:\Python37>python C:\Python37\myvideogrep.py -i "G:\I" -s "All" -st word -o test.mp4
[!] No subtitle files were found.
Traceback (most recent call last):
File "C:\Python37\myvideogrep.py", line 3, in
videogrep.main()
File "C:\Python37\lib\site-packages\videogrep\videogrep.py", line 528, in main
videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, args.maxclips, args.padding, args.demo, args.randomize, args.sync, args.use_transcript, args.use_vtt, args.export_clips)
File "C:\Python37\lib\site-packages\videogrep\videogrep.py", line 456, in videogrep
composition = compose_from_srts(srts, search, searchtype)
File "C:\Python37\lib\site-packages\videogrep\videogrep.py", line 317, in compose_from_srts
for srt in srts:
TypeError: 'bool' object is not iterable

After long time fixing #57, I got this new error like this>
#48
will any Windows Users fix this issue, it will be helpful for me. thanks.

UnicodeDecodeError on accented characters

I am attempting to videogrep a video that is English language but brief lines in Spanish occasionally appear. It looks like subtitles that have some non-English characters cause a unicode decode error to be thrown:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 19669: invalid continuation byte

This can easily be fixed by finding and replacing accented characters with non-accented characters in the subtitle track, but maybe this can be done programmatically without altering the original subtitle file? I'm not sure how common it is to find English language subtitles with correct non-English accent markings, etc.

MoviePy fixes ?

Hi there,

First: bravo ! It's a very cool project, and it made my day !

I noticed that your script videogrep.py uses MoviePy in a way that could be improved, so here are a few remarks.

Remark 1

For every video segment assembled in create_supercut, you create a clip by calling VideoFileClip. This is bad, as every time you call VideoFileClip, MoviePÿ creates a new FFMPEG process to communicate with the file, and it takes 10-20 Mo of RAM. If you have 30 segments inside the same video file, you should call VideoFileClip one time only on this video file, then cut different subclips from that one instance.

Remark 2

The function concatenate ignores the starting and ending times specified by the set_start and set_end functions, actually it will recompute these times (like what you did with your cumulative 'time' variable).

Putting remarks 1 and 2 together, here is how I would have implemented your create_supercut (note that I separate the 'padding addition' from the actual video editing):

def create_supercut(composition, outputfile, padding):

    print ("Creating clips.")

    # add padding when necessary
    for (clip, nextclip) in in zip(composition, composition[1:]):
        if ( ( nextclip['file'] == clip['file'] ) and
             ( nextclip['start'] < clip['end'] )):
            nextclip['start'] += padding

    # put all clips together:
    all_filenames = set([c['file'] for c in composition)
    videofileclips = dict([(f, VideoFileClip(f)) for f in all_filenames])
    cut_clips = [videofileclips[ c['file']  ].subclip(c['start'], c['end'])
                       for c in composition]     
    final_clip = concatenate( cut_clips)
    final_clip.to_videofile(outputfile)

Now some minor remarks:

Minor remark 1

In my examples I often use

from moviepy.editor import *

but for long scripts it is a little frowned upon, your scripts we be better understandable if you state what you import

from moviepy.editor import VideoFileClip, concatenate

The moviepy.editor module is meant for editing videos "by hand" in an interactive way, so it loads a lot of things (and starts a PyGame session) and can slow down your program at the beginning. Write rather this (the program will only fetch what it needs):

from moviepy.video.io.VideoFileClip import VideoFileClip
from moviepy.video.compositing.concatenate import concatenate

Minor remark 2

Apparently you have been a victim of the bug that makes that every time you generate a video file it creates an unwanted log file for the audio. I wasn't aware of this bug (it has been there in the last two months), but yesterday someone commited a fix for it, so the last version of MoviePy doesn't have it (no logfile is generated by default). So your 'cleaning' function is no longer needed.

Minor non-moviepy-related remarks

Maybe you should consider making a proper Python module (with a setup.py). This would come with advantages, like easy 'pip' install, automatic installation of the dependencies 'pattern' and 'moviepy' during the installation of videogrep, and automatic installation of the executable scripts like videogrep.py, so that they could be launched from anywhere, not just the folder where the script is.

Also, you could have a look at the python module "docopt", it makes the command line interface very easy to code and debug.

I hope this helped ! If you have any questions or request concerning MoviePy let me know.

Cheers !

Match Silence as in the (Total Recall) example

Hey!

This is a great project 👍
How may I match on silence?

You added one example with the output, which sadly has been removed on Youtube:
All the one to two second silences in "Total Recall"

Would be a great help for my current project to be able to do this :)

hypernym example works with 'body part' not 'body parts' which returns an error

For the "hyper: hypernym search. For example 'body parts' grabs all lines of dialog that reference a body part" part of the documentation it looks like 'body part' is the search that works. For some reason 'body parts' returns an error @:
File "/usr/local/lib/python2.7/site-packages/videogrep/searcher.py", line 34, in hypernym_search
synset = wordnet.synsets(search_word)[0]
IndexError: list index out of range

PyTube download problem

Looks like pip and github aren't getting along here:

NoMBA:videogrep benchun$ pip install -r requirements.txt
Downloading/unpacking git+https://github.com/NFicano/pytube.git #pypi download not working (from -r requirements.txt (line 9))
  Cloning https://github.com/NFicano/pytube.git  to /var/folders/ql/v1mvnf815gg8zxnpfn9rcvz00000gn/T/pip-jacUrL-build
fatal: unable to access 'https://github.com/NFicano/pytube.git /': The requested URL returned error: 400
  Complete output from command /usr/local/bin/git clone -q "https://github.com/NFicano/pytube.git " /var/folders/ql/v1mvnf815gg8zxnpfn9rcvz00000gn/T/pip-jacUrL-build:

----------------------------------------
Command /usr/local/bin/git clone -q "https://github.com/NFicano/pytube.git " /var/folders/ql/v1mvnf815gg8zxnpfn9rcvz00000gn/T/pip-jacUrL-build failed with error code 128 in None

tqdm module required

tqdm module required for videogrep, not listed as a requirement within readme and is not a requirement for Patterns or moviepy.

woops : requirements.txt

Hangs on Windows Python 2.7

I enter the search term and the console outputs the matches and says it's building the video but never actually builds it. I let it run overnight just to be sure it wasn't actually building. The console become unresponsive (not even cmd+c stops it) and I have to close the window. Any ideas?

search-type franken not working

Hi,

When using "-st franken" the search term is not found, if I use "-st pos" then the search term is found. Obviously I'm doing this on the same file.

The documentation (README) is not very clear on how to use the franken option. An example would help a lot.

Great project otherwise, my new favourite tool.

Exception AttributeError:

Thank you for your amazing scripts. It works like a charm. However, sometimes I get the following error:
$python videogrep.py --input ~/MD/Video/videogrepvids/ --search 'the end of the day' -p 3000 -r

Traceback (most recent call last):
File "videogrep.py", line 262, in
videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, args.maxclips, args.padding, args.test, args.randomize, args.sync)
File "videogrep.py", line 242, in videogrep
create_supercut(composition, outputfile, padding)
File "videogrep.py", line 87, in create_supercut
videofileclips = dict([(f, VideoFileClip(f)) for f in all_filenames])
File "/usr/lib/python2.7/site-packages/moviepy/video/io/VideoFileClip.py", line 58, in init
self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt)
File "/usr/lib/python2.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 17, in init
infos = ffmpeg_parse_infos(filename, print_infos)
File "/usr/lib/python2.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 200, in ffmpeg_parse_infos
proc.terminate()
File "/usr/lib/python2.7/subprocess.py", line 1532, in terminate
self.send_signal(signal.SIGTERM)
File "/usr/lib/python2.7/subprocess.py", line 1527, in send_signal
os.kill(self.pid, sig)
OSError: [Errno 3] No such process
Exception AttributeError: "FFMPEG_VideoReader instance has no attribute 'proc'" in <bound method FFMPEG_VideoReader.del of <moviepy.video.io.ffmpeg_reader.FFMPEG_VideoReader instance at 0x6fff90c6368>> ignored

Can you tell what's wrong? Thank you

`--search-type word` is giving a KeyError

I run this command:

videogrep --input videofile.mkv -vtt --search 'this' --search-type word

And get this:

Traceback (most recent call last):
  File "/usr/local/bin/videogrep", line 5, in <module>
    videogrep.main()
  File "/usr/local/lib/python3.8/site-packages/videogrep/videogrep.py", line 528, in main
    videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, args.maxclips, args.padding, args.demo, args.randomize, args.sync, args.use_transcrip
t, args.use_vtt, args.export_clips)
  File "/usr/local/lib/python3.8/site-packages/videogrep/videogrep.py", line 453, in videogrep
    composition = compose_from_vtt(vtts, search, searchtype)
  File "/usr/local/lib/python3.8/site-packages/videogrep/videogrep.py", line 416, in compose_from_vtt
    for word in sentence['words']:
KeyError: 'words'

The YouTube Function

Is this supposed to be functional, or is it new? Passing a youtube URL just prompts you for an input file.

Possible to specify amount of words on each side ?

I was doing some searches on "I" and get a lot on either side, for instance:

94.299 to 96.85:    our long-term economic plan and I see that as a demand for us to deliver

Is it possible to control the max number of words on each side ?

Search embedded subtitles

The ability to search subtitles embedded in the video (like MKVs) would remove the step of having to extract them.

FPS issue

[+] Concatenating clips.
[+] Writing ouput file.
Traceback (most recent call last):
  File "/usr/local/bin/videogrep", line 5, in <module>
    videogrep.main()
  File "/Library/Python/2.7/site-packages/videogrep/videogrep.py", line 339, in main
    videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, args.maxclips, args.padding, args.demo, args.randomize, args.sync, args.use_transcript)
  File "/Library/Python/2.7/site-packages/videogrep/videogrep.py", line 310, in videogrep
    create_supercut(composition, outputfile, padding)
  File "/Library/Python/2.7/site-packages/videogrep/videogrep.py", line 106, in create_supercut
    final_clip.to_videofile(outputfile, codec="libx264", temp_audiofile='temp-audio.m4a', remove_temp=True, audio_codec='aac')
  File "/Library/Python/2.7/site-packages/moviepy/tools.py", line 129, in fdepr
    return f(*a, **kw)
  File "<decorator-gen-51>", line 2, in write_videofile
  File "/Library/Python/2.7/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-50>", line 2, in write_videofile
  File "/Library/Python/2.7/site-packages/moviepy/decorators.py", line 133, in use_clip_fps_by_default
    for (arg, name) in zip(a, names)]
  File "/Library/Python/2.7/site-packages/moviepy/decorators.py", line 122, in fun
    " the clip's fps with `clip.fps=24`"%f.__name__)
AttributeError: No 'fps' (frames per second) attribute specified for function write_videofile and the clip has no 'fps' attribute. Either provide e.g. fps=24 in the arguments of the function, or define the clip's fps with `clip.fps=24`

The command ran:
videogrep --input *.MOV --search 'ate' -t

"pip install pattern" error

G:\Python3.7>pip install --upgrade setuptools
Successfully installed setuptools-40.0.0

G:\Python3.7>pip install pattern
Collecting pattern
Using cached https://files.pythonhosted.org/packages/bf/50/d09941d53416f2a86676bd0dc341d5968b599a763b73f5d13f51c57b5641/pattern-2.6.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Yell\AppData\Local\Temp\pip-install-xbhhy0js\pattern\setup.py", line 40
print n
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(n)?

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Yell\AppData\Local\Temp\pip-install-xbhhy0js\pattern\

Will you take a look into this? thanks.

ImportError: No module named pattern.search

Hi, I'm new to Python, so maybe I've made some stupid mistake. But I followed the instructions, double-checked if the requirements have installed, but still I get this output:

Traceback (most recent call last):
File "videogrep.py", line 7, in
import search as Search
File "/Users/adam/Desktop/videogrep/search.py", line 2, in
from pattern.search import Pattern, STRICT, search
ImportError: No module named pattern.search

I'm on a mac and pattern is in /usr/local/lib/python2.7/site-packages, so there should be no problem.

No video output

Hello, I'm trying to make my script work,by default it's not working in singlefile mode and folder mode, I've installed this pull(https://github.com/antiboredom/videogrep/pull/49/files) to add folder function, after this correctly finds words in subtitles and lists them from the folder, but no output video or any text related to video creation, does anyone has a clue where to dig?
videogrep -i /vids -s 'really' -st word -o test.mp4

PS. I have a impression I'm missing something, I've installed all the requirements.
The single file mode gives TypeError: 'bool' object is not iterable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.