[FFmpeg-user] Any Mac OS X users interested in ffmpeg AppleScript droplets? - here's one for cat
Laine.Lee at utsa.edu
Tue Nov 4 20:46:43 CET 2014
Concatenate similar video files using this AppleScript.
How do I use it?
Copy the lines containing +ACI-begin script+ACI- through +ACI-end script+ACI- to your Mac's clipboard. Paste the clipboard contents into a Script (or AppleScript, depending on your version of OS X) Edtor window, then save as an application. Name your video files successively, and drop them all onto the AppleScript application's icon.
What does it do?
Uses your compiled version of the ffmpeg executable to concatenate the files in ascending order, creating the resulting file in the same location as the files you dropped. The ffmpeg executable should be compiled using Homebrew+ADw-http://brew.sh/+AD4- and/or be accessible by your command line shell at /usr/local/bin/ffmpeg. You should be able to change that specification in the AppleScript if you keep ffmpeg somewhere else.
I+IBk-ve tested with .m4v files containing 5.1 audio. Please help me test others. Thanks.
property temppath : +ACI-/private/tmp/+ACI-
property startnum : 0
property tmpfile : +ACI-/tmp/execme.command+ACI-
on open the+AF8-items
set theshellscript to +ACIAIg-
repeat with i from 1 to (count of the+AF8-items)
set itemcount to (count of the+AF8-items)
set the+AF8-item to item i of the+AF8-items as alias
tell application +ACI-Finder+ACI-
set sost to (container of the+AF8-item) as string
set pos+AF8-filepath to POSIX path of sost
set this+AF8-filepath to (the+AF8-item as string)
if last character of this+AF8-filepath is +ACI-:+ACI- then
tell me to set it+AF8-is+AF8-a+AF8-folder to true
set it+AF8-is+AF8-a+AF8-folder to false
set thesourcename to (name of (info for the+AF8-item))
set namepart to (name extension of (info for the+AF8-item))
set the+AF8-source+AF8-file to POSIX path of this+AF8-filepath
--set newname to replace+AF8-chars(thesourcename, namepart, +ACI-joined.mp4+ACI-)
set finalname to replace+AF8-chars(thesourcename, +ACI-.+ACI- +ACY- namepart, +ACIAIg-)
if i +AD0- 1 then
set the filelistbody to +ACIAIw- comment+ACI- +ACY- return +ACY- +ACI-file+ACI- +ACY- space +ACY- (quoted form of the+AF8-source+AF8-file) +ACY- return
set the filelistbody to filelistbody +ACY- +ACI-file+ACI- +ACY- space +ACY- (quoted form of the+AF8-source+AF8-file) +ACY- return
on error onerr
display dialog onerr
set fileData to +ACI-echo+ACI- +ACY- space +ACY- +ACIAXAAiACI- +ACY- filelistbody +ACY- +ACIAXAAiACI- +ACY- space +ACY- +ACIAPg- ffmpegCatList.txt+ACI-
set theshellscript to fileData +ACY- +ACIAOw-sleep 3+ADs-/usr/local/bin/ffmpeg -f concat -i ffmpegCatList.txt -c copy+ACI- +ACY- space
set shellExec to space +ACY- (quoted form of (pos+AF8-filepath +ACY- finalname +ACY- +ACIAXw-1-+ACI- +ACY- i +ACY- +ACI-.+ACI- +ACY- namepart))
set theshellscript to the theshellscript +ACY- shellExec +ACY- +ACIAOw-sleep 3+ACI- +ACY- return
set theshellscript to theshellscript +ACY- +ACIAOw-/bin/echo '
+ACI- +ACY- finalname +ACY- +ACIAXw-1-+ACI- +ACY- i +ACY- +ACI-.+ACI- +ACY- namepart +ACY- space +ACY- +ACI-FINISHED+ACEAIg- +ACY- +ACI-
'+ADs-mv+ACI- +ACY- space +ACY- (quoted form of tmpfile) +ACY- space +ACY- (quoted form of (POSIX path of (path to trash))) +ACY- +ACIAOw-mv ffmpegCatList.txt+ACI- +ACY- space +ACY- (quoted form of (POSIX path of (path to trash)))
do shell script +ACI-echo +ACI- +ACY- quoted form of theshellscript +ACY- +ACI- +AD4- +ACI- +ACY- tmpfile
do shell script +ACI-chmod +ACI- +ACY- tmpfile
do shell script +ACI-open -a Terminal.app+ACI- +ACY- space +ACY- tmpfile
on replace+AF8-chars(this+AF8-text, +AF8-bad, +AF8-good)
set AppleScript's text item delimiters to the +AF8-bad
set the item+AF8-list to every text item of this+AF8-text
set AppleScript's text item delimiters to the +AF8-good as string
set this+AF8-text to the item+AF8-list as string
set AppleScript's text item delimiters to +ACIAIg-
--set the+AF8-items to ((choose folder) as list)
More information about the ffmpeg-user