Videogriping

Back in the day, friend of ds106 John Johnston made some awesome supercuts using Videogrep:

I always wanted to try it, but I could never get it to work. I have a hard time finding appropriate directions for doing any kind of command-line work. They all seem to assume that I know more than I do – that I don’t need everything spelled out to the character. So when ds106 master Alan pointed out this Videogrep Tutorial, I was intrigued…

And then I was frustrated. Failure from the first step. “pip3 install yt-dlp” seemed simple enough. Maybe it even installed. But what happened when I tried to run it?

zsh: command not found: yt-dlp

I didn’t know what to do with that, so I googled it. If I interpreted the various results correctly, it means that the command is not installed in a directory that Terminal pulls commands from. Further googling uncovered a variety of cryptic directions on how to fix it. None of them work of course. I don’t know where the command got installed, so I can’t add that directory to PATH.

I went back to the tutorial a couple days later and noticed a spot where yt-dlp was underlined. That link took me to the GitHub page, which gave some other installation options. The “brew install yt-dlp/taps/yt-dlp” command seemed to want to work, except it said my command-line tools were out of date. The error message listed several potential fixes. I had to type an intimidating rm command and reinstall CommandLineTools, which initially said it would take 198 hours and some minutes, but ended up being a bit quicker.

So I was able to install yt-dlp with brew. I tried the same process to install videogrep, but it didn’t work. The pip3 install command worked eventually. Maybe reinstalling the CommandLineTools did the trick there too. Anyway, it took a few days, but I got the commands installed. Now to use them.

I thought I’d try to make a happy supercut of our friend Bob. If I wanted to use the Bob Ross – Deep Forest Falls (Season 28 Episode 8) video, the download command would be:

yt-dlp “https://www.youtube.com/watch?v=urHQRbRNuYI” -o bobross1.mp4

This downloaded the video and renamed it bobross1.mp4. I’d also need the subtitles. The command for that is:

yt-dlp “https://www.youtube.com/watch?v=urHQRbRNuYI” –write-auto-sub

That downloads a .vtt file that I manually renamed to bobross1.vtt

The first time I tried the download command, it put the files in a strange spot. I think they landed in the /Users directory. I dragged them to the Desktop directory, where I could see them more easily (if I keep my desktop clean-ish).

Then I tried the videogrep command

videogrep –input bobross1.mp4 –search “happy”

And it said file not found, or something to that effect. I found that the command should have the full path to the file:

videogrep –input “/Users/paulbond/Desktop/bobross1.mp4” –search “happy” 

I don’t know if the path needed quote marks but I did it anyway. And it worked! It gave me a file called supercut.mp4. I played with some other switches. The command

videogrep –input “/Users/paulbond/Desktop/bobross1.mp4” –search “happy” –output happybob1.mp4

let me determine the output name. I did a few episodes and combined them in iMovie to make this video.

It’s not much, but at least I got it to work.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.