Ein AppleScrit mit dem man ein Segment aus einem Videofile in mp4 und mp3 komprimiert und ein Frame extrahiert. das Script muss im AppleScript Editor als Programm abgespeichert werden. Anschließend können die Videofiles per Drag&Drop drauf gezogen werden. Es muss dann nur noch die Anfangszeit und die Endzeit in Form von 00:00:00.00 angegeben werden.
Hat man kein File, oder mehr als ein File ausgewählt wird eine Warnmeldung ausgegeben.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | set filecount to 0 on open infile set filecount to count infile if (filecount > 1) then display dialog "Please select only one file!" return end if set filename to do shell script ¬ "perl -e \"print quotemeta ('" & POSIX path of infile & "');\"" set revChar to reverse of (characters of filename) as string set x to (offset of "." in revChar) + 1 set outname to text 1 thru -x of filename set StartFrame to text returned of (display dialog "Start Time:" with icon note default answer "00:15:00.24" buttons {"Cancel", "OK"} default button {"OK"}) set EndTime to text returned of (display dialog "End Time:" with icon note default answer "01:00:00.24" buttons {"Cancel", "OK"} default button {"OK"}) set ExtractFrame to text returned of (display dialog "Enter ExtractFrame:" with icon note default answer "00:00:30.10" buttons {"Cancel", "OK"} default button {"OK"}) set std1 to text 1 thru 2 of StartFrame set min1 to text 4 thru 5 of StartFrame set sec1 to text 7 thru 8 of StartFrame set fps1 to text 10 thru 11 of StartFrame set stdtoframe to std1 * 60 * 60 * 25 set mintoframe to min1 * 60 * 25 set sectoframe to sec1 * 25 set framenum to stdtoframe + mintoframe + sectoframe + fps1 set std2 to text 1 thru 2 of EndTime set min2 to text 4 thru 5 of EndTime set sec2 to text 7 thru 8 of EndTime set fps2 to text 10 thru 11 of EndTime set stdtoframe2 to std2 * 60 * 60 * 25 set mintoframe2 to min2 * 60 * 25 set sectoframe2 to sec2 * 25 set framenum2 to stdtoframe2 + mintoframe2 + sectoframe2 + fps2 set FrameRange to framenum2 - framenum set AppleScript's text item delimiters to "," set endstd to FrameRange / 25 / 60 / 60 as string set endstd to text item 1 of endstd set endmin to FrameRange / 25 / 60 - endstd * 60 as string set endmin to text item 1 of endmin set endsec to FrameRange / 25 - endstd * 3600 - endmin * 60 as string set endsec to text item 1 of endsec set endfps to round (FrameRange / 25 - endstd * 3600 - endmin * 60 - endsec) * 25 set timerange to endstd & ":" & endmin & ":" & endsec & "." & endfps tell application "Terminal" activate do script "/Applications/ffmpeg -ss " & StartFrame & " -t " & timerange & " -filter:v yadif=0:0:0 -i " & filename & " -pix_fmt yuv420p -vcodec libx264 -crf 23 -preset slower -s 384x216 -sws_flags lanczos -acodec aac -strict experimental -ac 1 -ar 44100 -ab 128k -threads 0 -y " & outname & ".mp4; /Applications/ffmpeg -ss " & StartFrame & " -t " & timerange & " -i " & filename & " -vn -acodec libmp3lame -ac 1 -ar 44100 -ab 64k -y " & outname & ".mp3; /Applications/ffmpeg -ss " & ExtractFrame & " -filter:v yadif=0:0:0 -i " & filename & " -frames 1 -s 500x280 -sws_flags lanczos -pix_fmt yuvj420p -sameq -y " & outname & "_" & ExtractFrame & ".jpg; exit" end tell end open if filecount < 1 then display dialog "Please Drag and Drop Video File for Video / Audio Compression and Frame- Extraction for Website on it!" return end if |