Hey there. I'm an editor trying to cobble together a script for generating video thumbnails automatically. I've done a small amount of programming in my past, but not enough to really code something like this. I've been able to cobble together a solution between Automator and a shell script (plus ffmpeg) I found on the web, but there's one final problem.
Currently the script is as follows:
First, an Automator action: "Get Selected Finder Items."
Then, a Run Shell Script action:
It grabs a thumb from 30 seconds into the video and saves it out as a jpg. Beautiful. Simple. Automatic.
The only problem, as you can probably guess, is that if I drop several files at once on the script, it gives them all the same name. It overwrites them progressively so that at the end, all you have is the last file.
What I'd like to know is, how can I pass the filenames from the Finder (which I'm using to drag the files over to the script) to the script and maintain them at the end. So if I give it Video1.m4v, Video2.mov, Video3.avi, etc., it will spit out Video1.jpg, Video2.jpg, Video3.jpg.
I'm so close to getting this thing working right and saving myself a ton of time, as I have to make hundreds of thumbnails sometimes. I tried many of the freeware apps and they all had things that bugged me and made them unusable for one reason or another.
Any help would be extremely appreciated! Thanks!
Currently the script is as follows:
First, an Automator action: "Get Selected Finder Items."
Then, a Run Shell Script action:
Code:
for f in "$@"
do
/usr/local/bin/ffmpeg -i "$f" -an -ss 00:00:30 -t 00:00:01 -r 1 -y /Users/me/Desktop/Thumbs/test/video%d.jpg
done
It grabs a thumb from 30 seconds into the video and saves it out as a jpg. Beautiful. Simple. Automatic.
The only problem, as you can probably guess, is that if I drop several files at once on the script, it gives them all the same name. It overwrites them progressively so that at the end, all you have is the last file.
What I'd like to know is, how can I pass the filenames from the Finder (which I'm using to drag the files over to the script) to the script and maintain them at the end. So if I give it Video1.m4v, Video2.mov, Video3.avi, etc., it will spit out Video1.jpg, Video2.jpg, Video3.jpg.
I'm so close to getting this thing working right and saving myself a ton of time, as I have to make hundreds of thumbnails sometimes. I tried many of the freeware apps and they all had things that bugged me and made them unusable for one reason or another.
Any help would be extremely appreciated! Thanks!