[FFmpeg-user] Any Mac OS X users interested in ffmpeg AppleScript droplets? - here's one for cat
llee040 at sbcglobal.net
Wed Nov 5 16:22:16 CET 2014
If you+IBk-re interested, here+IBk-s an OS X (Mac) AppleScript droplet source for
concatenating multiple video files using existing ffmpeg executable.
How do I use it?
Copy the lines containing "begin script" through "end script" 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
<http://brew.sh/> 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
property temppath : "/private/tmp/"
property startnum : 0
property tmpfile : "/tmp/execme.command"
on open the_items
set theshellscript to ""
repeat with i from 1 to (count of the_items)
set itemcount to (count of the_items)
set the_item to item i of the_items as alias
tell application "Finder"
set sost to (container of the_item) as string
set pos_filepath to POSIX path of sost
set this_filepath to (the_item as string)
if last character of this_filepath is ":" then
tell me to set it_is_a_folder to true
set it_is_a_folder to false
set thesourcename to (name of (info for the_item))
set namepart to (name extension of (info for the_item))
set the_source_file to POSIX path of this_filepath
--set newname to replace_chars(thesourcename, namepart, "joined.mp4")
set finalname to replace_chars(thesourcename, "." & namepart, "")
if i = 1 then
set the filelistbody to "# comment" & return & "file" & space & (quoted form
of the_source_file) & return
set the filelistbody to filelistbody & "file" & space & (quoted form of
the_source_file) & return
on error onerr
display dialog onerr
set fileData to "echo" & space & "+AFw"" & filelistbody & "+AFw"" & space & ">
set theshellscript to fileData & ";sleep 3;/usr/local/bin/ffmpeg -f concat
-i ffmpegCatList.txt -c copy" & space
set shellExec to space & (quoted form of (pos_filepath & finalname & "_1-" &
i & "." & namepart))
set theshellscript to the theshellscript & shellExec & ";sleep 3" & return
set theshellscript to theshellscript & ";/bin/echo '
" & finalname & "_1-" & i & "." & namepart & space & "FINISHED!" & "
';mv" & space & (quoted form of tmpfile) & space & (quoted form of (POSIX
path of (path to trash))) & ";mv ffmpegCatList.txt" & space & (quoted form
of (POSIX path of (path to trash)))
do shell script "echo " & quoted form of theshellscript & " > " & tmpfile
do shell script "chmod " & tmpfile
do shell script "open -a Terminal.app" & space & tmpfile
on replace_chars(this_text, _bad, _good)
set AppleScript's text item delimiters to the _bad
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the _good as string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
--set the_items to ((choose folder) as list)
More information about the ffmpeg-user