1 Reply Latest reply: Jul 21, 2014 6:26 AM by Mark Jalbert
designidea Level 1 Level 1

i'm not a technical person and i hoping that i can get a help to create a custom applescript app. i'd like to create an applescript app to run video files from any folder to encode (using ffmpeg) and save the re-encoded version in a new folder inside the current file folder. i found the script that i need to run inside the applescript:


ffmpeg -i ORG-FILENAME -c:v libx264 -crf 27 -c:a libfaac -q:a 100 -map_metadata 0 NEW-FOLDER/ORG-FILENAME && touch -r ORG-FILENAME NEW-FOLDER/ORG-FILENAME


i searched through the forum and found something that might work but my limited knowledge can't get this to work:


on run

    tell application "Finder"

        set theFolder to (choose folder)

    end tell


end run

on open theFolder

    proceed(theFolder as alias)

end open

on proceed(theFolder)

    tell application "Finder"

        set parentFolder to parent of theFolder as string

        if not (exists parentFolder & "A") then

            make new folder at parent of theFolder with properties {name:"A"}

        end if

    end tell

    tell application "Terminal"

        do script "for f in " & quoted form of POSIX path of theFolder & " do ffmpeg -i \"$f\" -c:v libx264 -crf 27 -c:a libfaac -q:a 100 -map_metadata 0 " & quoted form of (POSIX path of (parentFolder & "A")) & " \"$f\"


    end tell

end proceed


when i run this i get:

for f in '/Users/admin/Pictures/0/1/' do ffmpeg -i "$f" -c:v libx264 -crf 27 -c:a libfaac -q:a 100 -map_metadata 0 '/Users/admin/Pictures/0/A' "$f"


macbookpro-7:~ admin$ for f in '/Users/admin/Pictures/0/1/' do ffmpeg -i "$f" -c:v libx264 -crf 27 -c:a libfaac -q:a 100 -map_metadata 0 '/Users/admin/Pictures/0/A' "$f"

> done

-bash: syntax error near unexpected token `done'


can anyone help me please

MacBook Pro with Retina display, OS X Mountain Lion (10.8.5)