AppleScript ffmpeg

[ffmpeg]mp4書き出し設定 縦ピクセルサイズを720で揃える


AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#
005# com.cocolog-nifty.quicktimer.icefloe
006----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
007##自分環境がos12なので2.8にしているだけです
008use AppleScript version "2.8"
009use framework "Foundation"
010use framework "AppKit"
011use scripting additions
012
013property refMe : a reference to current application
014set appFileManager to refMe's NSFileManager's defaultManager()
015
016################################################
017###設定項目 ffmpegへのパス
018set strFFMPEGFilePath to ("~/bin/ffmpeg7/ffmpeg") as text
019set strFFPROBEFilePath to ("~/bin/ffmpeg7/ffprobe") as text
020
021################################################
022set ocidBinPathStr to refMe's NSString's stringWithString:(strFFMPEGFilePath)
023set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
024set strFFMPEGFilePath to ocidBinPath as text
025#
026set ocidBinPathStr to refMe's NSString's stringWithString:(strFFPROBEFilePath)
027set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
028set strFFPROBEFilePath to ocidBinPath as text
029
030#############################
031###入力ファイル
032#############################
033tell current application
034  set strName to name as text
035end tell
036####スクリプトメニューから実行したら
037if strName is "osascript" then
038  tell application "Finder" to activate
039else
040  tell current application to activate
041end if
042############ デフォルトロケーション
043set appFileManager to refMe's NSFileManager's defaultManager()
044set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
045set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
046set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
047####UTIリスト
048set listUTI to {"public.movie"}
049####ダイアログを出す
050set listAliasFilePath to (choose file with prompt "ムービーファイルを選んでください" default location (aliasDefaultLocation) of type listUTI with invisibles, showing package contents and multiple selections allowed) as list
051#############################
052###保存先
053#############################
054set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSMoviesDirectory) inDomains:(refMe's NSUserDomainMask))
055set ocidMoviesDirPathURL to ocidURLsArray's firstObject()
056set ocidSaveDirPathURL to ocidMoviesDirPathURL's URLByAppendingPathComponent:("AVAssetExport")
057##フォルダを作っておく
058set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
059# 777-->511 755-->493 700-->448 766-->502
060ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
061set listDone to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
062if (item 2 of listDone) = (missing value) then
063  log "createDirectoryAtURL 正常処理"
064else if (item 2 of listDone) ≠ (missing value) then
065  log (item 2 of listDone)'s code() as text
066  log (item 2 of listDone)'s localizedDescription() as text
067  return "createDirectoryAtURL エラーしました"
068end if
069
070repeat with itemFilePath in listAliasFilePath
071  ###入力ファイル
072  set strFilePath to (POSIX path of itemFilePath) as text
073  set ocidFilePathStr to (refMe's NSString's stringWithString:(strFilePath))
074  set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
075  set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
076  ##
077  set ocidFileName to ocidFilePath's lastPathComponent()
078  set ocidBaseFileName to ocidFileName's stringByDeletingPathExtension()
079  ###上書きチェック
080  set numCnt to 0 as number
081  set strSaveFileName to (ocidBaseFileName's stringByAppendingPathExtension:("mp4"))
082  repeat 100 times
083    ###保存先URL
084    set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName))
085    set ocidSaveFilePath to ocidSaveFilePathURL's |path|()
086    set boolExist to (appFileManager's fileExistsAtPath:(ocidSaveFilePath) isDirectory:(false))
087    ##
088    if boolExist is true then
089      set numCnt to numCnt + 1 as number
090      set strZeroSup to "000" as text
091      set strZeroSup to (strZeroSup & (numCnt as text)) as text
092      set strZeroSup to (text -3 through -1 of strZeroSup) as text
093      set strZeroSupFileName to (ocidBaseFileName's stringByAppendingPathExtension:(strZeroSup))
094      set strSaveFileName to (strZeroSupFileName's stringByAppendingPathExtension:("mp4"))
095    else
096      log "保存先パス: " & ocidSaveFilePath as text
097      exit repeat
098    end if
099  end repeat
100  set strSaveFilePath to ocidSaveFilePath as text
101  #############################
102  ### ビデオの情報取得
103  #############################
104  #ビデオの縦横サイズとfps
105  set strCommandText to ("\"" & strFFPROBEFilePath & "\" -v error -hide_banner -select_streams v:0 -show_entries stream=width,height,r_frame_rate  -of xml \"" & strFilePath & "\"") as text
106  try
107    set strResponse to (do shell script strCommandText) as text
108    #######【A】try文処理する方のはじまり
109    #戻り値のXML
110    set ocidXmlString to (refMe's NSMutableString's stringWithString:(strResponse))
111    ###除去する文字列リスト
112    set listRemoveChar to {"\n", "\r", "\t"} as list
113    ##置換
114    repeat with itemChar in listRemoveChar
115      set strPattern to itemChar as text
116      set strTemplate to ("") as text
117      set ocidOption to (refMe's NSRegularExpressionCaseInsensitive)
118      set listResponse to (refMe's NSRegularExpression's regularExpressionWithPattern:(strPattern) options:(ocidOption) |error| :(reference))
119      if (item 2 of listResponse) ≠ (missing value) then
120        log (item 2 of listResponse)'s localizedDescription() as text
121        return "正規表現パターンに誤りがあります"
122      else
123        set ocidRegex to (item 1 of listResponse)
124      end if
125      set numLength to ocidXmlString's |length|()
126      set ocidRange to refMe's NSRange's NSMakeRange(0, numLength)
127      set ocidXmlString to (ocidRegex's stringByReplacingMatchesInString:(ocidXmlString) options:0 range:(ocidRange) withTemplate:(strTemplate))
128    end repeat
129    #NADATAに
130    set ocidStringData to (ocidXmlString's dataUsingEncoding:(refMe's NSUTF8StringEncoding))
131    #NSXMLに
132    set ocidOption to (refMe's NSXMLNodePreserveAll) + (refMe's NSXMLDocumentTidyHTML)
133    set listResponse to (refMe's NSXMLDocument's alloc()'s initWithData:(ocidStringData) options:(ocidOption) |error| :(reference))
134    if (item 2 of listResponse) = (missing value) then
135      log "NSXMLDocument 正常処理"
136      set ocidXMLDoc to (item 1 of listResponse)
137    else if (item 2 of listResponse) ≠ (missing value) then
138      log (item 2 of listResponse)'s code() as text
139      log (item 2 of listResponse)'s localizedDescription() as text
140      log "NSXMLDocumentエラー 警告がありました"
141      set ocidXMLDoc to (item 1 of listResponse)
142    end if
143    #
144    set listResponse to (ocidXMLDoc's nodesForXPath:"//stream"  |error| :(reference))
145    if (item 2 of listResponse) = (missing value) then
146      log "nodesForXPath 正常処理"
147      set ocidNodeArray to (item 1 of listResponse)
148    else if (item 2 of listResponse) ≠ (missing value) then
149      log (item 2 of listResponse)'s code() as text
150      log (item 2 of listResponse)'s localizedDescription() as text
151      return "nodesForXPath エラーしました"
152    end if
153    set ocidNodeXML to ocidNodeArray's firstObject()
154    set ocidWidth to (ocidNodeXML's attributeForName:("width"))'s stringValue()'s mutableCopy()
155    set ocidHeight to (ocidNodeXML's attributeForName:("height"))'s stringValue()'s mutableCopy()
156    set ocidFPS to (ocidNodeXML's attributeForName:("r_frame_rate"))'s stringValue()'s mutableCopy()
157    set ocidFPSstr to (ocidFPS's stringByReplacingOccurrencesOfString:("/") withString:("."))
158    #テキストを数値に
159    set ocidW to (refMe's NSDecimalNumber's alloc()'s initWithString:(ocidWidth))
160    set ocidH to (refMe's NSDecimalNumber's alloc()'s initWithString:(ocidHeight))
161    #固定高さPX
162    set ocid720H to (refMe's NSDecimalNumber's alloc()'s initWithString:("720"))
163    ##FPS
164    set ocidFormatter to refMe's NSNumberFormatter's alloc()'s init()
165    (ocidFormatter's setNumberStyle:(refMe's NSNumberFormatterDecimalStyle))
166    (ocidFormatter's setRoundingMode:(refMe's NSNumberFormatterRoundUp))
167    (ocidFormatter's setMaximumFractionDigits:(2))
168    # set ocidW to (ocidFormatter's numberFromString:(ocidWidth))
169    #   set ocidH to (ocidFormatter's numberFromString:(ocidHeight))
170    set numFPS to (ocidFormatter's numberFromString:(ocidFPSstr))
171    ##小数点以下の処理
172    set ocidAspectRatio to (ocid720H's decimalNumberByDividingBy:(ocidH))
173    set ocidAdjustW to (ocidW's decimalNumberByMultiplyingBy:(ocidAspectRatio))
174    ##繰り下げ
175    set ocidRoundDown to (refMe's NSDecimalNumberHandler's decimalNumberHandlerWithRoundingMode:(refMe's NSRoundDown) scale:(0) raiseOnExactness:(false) raiseOnOverflow:(false) raiseOnUnderflow:(false) raiseOnDivideByZero:(false))
176    set ocidRoundDownNo to (ocidAdjustW's decimalNumberByRoundingAccordingToBehavior:(ocidRoundDown))
177    ##2で割って
178    set ocidTWO to (refMe's NSDecimalNumber's alloc()'s initWithString:("2"))
179    set ocidRoundDownH to (ocidRoundDownNo's decimalNumberByDividingBy:(ocidTWO))
180    if (ocidRoundDownH as integer) = (ocidRoundDownH as real) then
181      log "偶数"
182      set numAdjustW to ocidRoundDownNo as integer
183    else
184      log "奇数"
185      set ocidONE to (refMe's NSDecimalNumber's alloc()'s initWithString:("1"))
186      set ocidOddNO to (ocidRoundDownNo's decimalNumberByAdding:(ocidONE))
187      set numAdjustW to ocidOddNO as integer
188    end if
189    log ocidW as text
190    log ocidH as text
191    log numAdjustW as text
192    
193    set strCommandText to ("\"" & strFFMPEGFilePath & "\" -i \"" & strFilePath & "\" -codec:v libx264 -profile:v baseline -vf \"scale=" & numAdjustW & ":720:force_original_aspect_ratio=increase,setsar=1:1\" -tune film -crf 28 -codec:a aac -ar 48K -ab 128k \"" & strSaveFilePath & "\"") as text
194    
195    log strCommandText
196    #do shell script strCommandText
197    
198    tell application "Terminal"
199      set objWindowID to (do script "\n\n")
200      activate
201      delay 1
202      do script strCommandText in objWindowID
203    end tell
204    delay 3
205    set listTime to {0, 0, 0} as list
206    set numInterval to 10 as integer
207    repeat
208      tell application "Terminal"
209        tell objWindowID
210          activate
211        end tell
212      end tell
213      delay 0.5
214      tell application "Terminal"
215        tell front window
216          tell front tab
217            set boolBusy to busy as boolean
218          end tell
219        end tell
220      end tell
221      if boolBusy is true then
222        ###スタートタイム
223        set strStartTime to doHMSms(listTime)
224        log "経過時間: " & strStartTime
225        delay numInterval
226        ##まず秒が加算されるといくつになるか?
227        set numChkDigUp to (item 3 of listTime) + numInterval
228        ###↑この結果が59より大きければ繰り上がる
229        if numChkDigUp ≥ 60 then
230          set (item 3 of listTime) to numChkDigUp - 60
231          if (item 2 of listTime) = 59 then
232            set (item 2 of listTime) to 0
233            ####修正箇所
234            ####  set (item 1 of listTime) to (item 1 of listTime) + 1
235            set (item 1 of listTime) to (item 1 of listTime)
236          else
237            set (item 2 of listTime) to (item 2 of listTime) + 1
238          end if
239        else
240          set (item 3 of listTime) to (item 3 of listTime) + numInterval
241        end if
242        ####エンドタイム
243        set strEndTime to doHMSms(listTime)
244      else if boolBusy is false then
245        exit repeat
246      end if
247    end repeat
248    
249    
250    #######【A】try文処理する方の終わり
251  on error
252    #エラーしたファイルにはラベル『グレー』を付与します
253    #停止させずに続行
254    set ocidLabelNo to (refMe's NSNumber's numberWithInteger:(1))
255    set listDone to (ocidFilePathURL's setResourceValue:(ocidLabelNo) forKey:(refMe's NSURLLabelNumberKey) |error| :(reference))
256    if (item 1 of listDone) is true then
257      log "setResourceValue 正常処理"
258    else if (item 2 of listDone) ≠ (missing value) then
259      log (item 2 of listDone)'s code() as text
260      log (item 2 of listDone)'s localizedDescription() as text
261      log "setResourceValue エラーしました"
262    end if
263  end try
264end repeat
265
266return
267set aliasSaveDirFilePath to (ocidSaveDirPathURL's absoluteURL()) as alias
268tell application "Finder"
269  open aliasSaveDirFilePath
270end tell
271
272return
273
274
275################################
276##経過時間計算
277################################
278on doHMSms(listTime)
279  set strH to item 1 of listTime
280  set strM to item 2 of listTime
281  set strS to item 3 of listTime
282  return doPadding2Dig(strH) & ":" & doPadding2Dig(strM) & ":" & doPadding2Dig(strS)
283end doHMSms
284
285###2桁ゼロサプレス
286on doPadding2Dig(numNO)
287  set strNO to ("0" & numNO) as text
288  return text -2 thru -1 of strNO
289end doPadding2Dig
290
291
292###3桁逆ゼロサブレス
293on doAfterPadding3Dig(numNO)
294  set strNO to (numNO & "00") as text
295  return text 1 thru 3 of strNO
296end doAfterPadding3Dig
297
298################################
299# 日付 doGetDateNo(argDateFormat,argCalendarNO)
300# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
301# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
302################################
303to doGetDateNo({argDateFormat, argCalendarNO})
304  ##渡された値をテキストで確定させて
305  set strDateFormat to argDateFormat as text
306  set intCalendarNO to argCalendarNO as integer
307  ###日付情報の取得
308  set ocidDate to current application's NSDate's |date|()
309  ###日付のフォーマットを定義(日本語)
310  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
311  ###和暦 西暦 カレンダー分岐
312  if intCalendarNO = 1 then
313    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
314  else if intCalendarNO = 2 then
315    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
316  else
317    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
318  end if
319  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
320  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
321  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
322  ###設定
323  ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
324  ocidFormatterJP's setLocale:(ocidLocaleJP)
325  ocidFormatterJP's setCalendar:(ocidCalendarJP)
326  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
327  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
328  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
329  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
330  ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
331  ###渡された値でフォーマット定義
332  ocidFormatterJP's setDateFormat:(strDateFormat)
333  ###フォーマット適応
334  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
335  ###テキストで戻す
336  set strDateAndTime to ocidDateAndTime as text
337  return strDateAndTime
338end doGetDateNo
AppleScriptで生成しました

|

ビデオサイズ変換(FFmpeg7用)

Ffmpeg001_20240409110801

ダウンロード - mov2mp4ffmpeg7.zip

バイナリーはこちらのサイトのものを利用 https://www.osxexperts.net/

|

ビデオからタイムラインのサムネイル 横型用 5x5サイズ


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#  Press [q] to stop, [?] for helpで作成中しばし待たれよ
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use framework "Foundation"
use AppleScript version "2.8"
use scripting additions

#################################
###ffprobe へのパス
set strPathToFFProbe to "echo $HOME/bin/ffmpeg.arm/ffprobe" as text
set strPathToFFProbe to (do shell script strPathToFFProbe)
#################################
###ffmpeg へのパス
set strPathToFFMPEG to "echo $HOME/bin/ffmpeg.arm/ffmpeg" as text
set strBinPath to (do shell script strPathToFFMPEG)
#################################
###ダイアログを出す
set theWithPrompt to "ビデオを選んでください"
set aliasDefaultLocation to path to desktop folder from user domain
set theFileType to "public.movie,public.mpeg-4,public.mpeg-4-audio" as text
set AppleScript's text item delimiters to {","}
set theFileTypeList to every text item of theFileType
set AppleScript's text item delimiters to ""
set listFileAlias to (choose file default location aliasDefaultLocation ¬
  with prompt theWithPrompt ¬
  of type theFileTypeList ¬
invisibles true ¬
  with multiple selections allowed without showing package contents) as list
#################
tell application "QuickTime Player"
launch
activate
end tell
tell application "Terminal"
launch
activate
end tell
#################################
### 選択したファイルの数だけ繰り返し
repeat with ObjFileAlias in listFileAlias
  tell application "QuickTime Player"
open ObjFileAlias
    tell document 1
properties
      set numDuration to (duration) as number
      set numDataRate to data rate as number
      set numDataSize to data size as number
      set strFileName to name as text
      set listDimension to natural dimensions as list
close
    end tell
  end tell
  set strFilePath to POSIX path of (ObjFileAlias as alias)
  set strCommandText to "\"" & strPathToFFProbe & "\" -show_streams \"" & strFilePath & "\" 2> /dev/null | grep nb_frames | head -n1 | sed 's/.*=//'"
  set numCntFlame to (do shell script strCommandText) as text
log numCntFlame
  if numCntFlame is "N/A" then
log "エラー:フレーム数を取得出来ませんでした"
    -->まぁだいたい元のムービーの不具合が多い
  else
    set numSec25 to (round (numCntFlame / 25) rounding down) as number
    set strPathToDistFileDir to "echo $HOME/Desktop/" as text
    set strPathToDistFile to ((do shell script strPathToDistFileDir) & strFileName & ".png") as text
    set strCommandText to "\"" & strBinPath & "\" -i \"" & strFilePath & "\" -vf select='not(mod(n\\," & numSec25 & "))',scale=256:144,tile=5x5 -frames:v 1 \"" & strPathToDistFile & "\"" as text
log strCommandText
    tell application "Terminal"
launch
activate
      set objWindowID to (do script "\n\n")
delay 1
do script strCommandText in objWindowID
    end tell
  end if
  
end repeat

|

ビデオからタイムラインのサムネイル 縦型用 3x15サイズ


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#  Press [q] to stop, [?] for help でしばし待たれよ
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AVFoundation"
use scripting additions
property refMe : a reference to current application
property refNSString : a reference to refMe's NSString
property refNSURL : a reference to refMe's NSURL
property refAVAsset : a reference to refMe's AVAsset

#################################
###ffmpeg へのパス(ここは設定項目です)
set strPathToFFMPEG to "echo $HOME/bin/ffmpeg/ffmpeg" as text
set strBinPath to (do shell script strPathToFFMPEG)
###通常はこちらかな?
# set strBinPath to ("/usr/local/bin/ffmpeg") as text
#################################
###ダイアログを出す

set theWithPrompt to "ビデオを選んでください"
set aliasDefaultLocation to path to desktop folder from user domain
set theFileType to "public.movie,public.mpeg-4,public.mpeg-4-audio" as text
set AppleScript's text item delimiters to {","}
set theFileTypeList to every text item of theFileType
set AppleScript's text item delimiters to ""
set listFileAlias to (choose file default location aliasDefaultLocation ¬
  with prompt theWithPrompt ¬
  of type theFileTypeList ¬
invisibles true ¬
  without showing package contents and multiple selections allowed) as list
###ファイルパス関連
set aliasFilePath to item 1 of listFileAlias as alias
set strFilePath to POSIX path of aliasFilePath as text
set ocidFilePath to refNSString's stringWithString:strFilePath
set ocidFullFilePath to ocidFilePath's stringByStandardizingPath()
set ocidFullFilePathURL to refMe's NSURL's fileURLWithPath:ocidFullFilePath
####出力ファイルパス
set strFileName to ocidFullFilePathURL's lastPathComponent
set ocidBaeFileName to strFileName's stringByDeletingPathExtension as text
set ocidContainerDirPath to ocidFullFilePathURL's URLByDeletingLastPathComponent
set strNSStringOrigFilePath to ocidContainerDirPath's |path|() as text
set strSaveFilePath to (strNSStringOrigFilePath & "/" & ocidBaeFileName & ".png") as text

log "##################AVAsset"
set ocidReadAsset to refAVAsset's assetWithURL:ocidFullFilePathURL
########duration(ビデオの長さ時間)を求める
set ocidReadAssetDuration to ocidReadAsset's duration()

(*tbn×秒数, tbn, flags, epoch*)
set strMovieSec to ((item 1 of ocidReadAssetDuration) / (item 2 of ocidReadAssetDuration)) as number
log strMovieSec & "秒"
(*
tbn = AVStream のタイム ベース
tbc = AVCodecContext のタイム ベース(timescale)
tbr = ビデオ フレーム レート
*)
(* 使わない値
########metadata(NSArray)
log ocidReadAsset's metadata() as list
log ocidReadAsset's commonMetadata() as list
log ocidReadAsset's availableMetadataFormats() as list
########creationDate
##log ((ocidReadAsset's creationDate)'s dateValue()) as date
########Accessing Suitabilityできる事
log ocidReadAsset's playable as boolean
log ocidReadAsset's exportable as boolean
log ocidReadAsset's readable as boolean
##log ocidReadAsset's rcomposable
log ocidReadAsset's compatibleWithAirPlayVideo as boolean
log ocidReadAsset's compatibleWithSavedPhotosAlbum as boolean
if (ocidReadAsset's exportable as boolean) is false then
log "このビデオは書き出しできません"
return
end if
###Accessing Content Protections
log ocidReadAsset's hasProtectedContent as boolean
if (ocidReadAsset's hasProtectedContent as boolean) is true then
log "このビデオは保護されています"
return
end if
###Accessing Fragment Support
log ocidReadAsset's containsFragments as boolean
###CMTimeGetSecondsでNaNが戻るのは値が無い場合
log refMe's CMTime's CMTimeGetSeconds(ocidReadAsset's overallDurationHint)
-->例:NaN
log refMe's CMTime's CMTimeAbsoluteValue(ocidReadAsset's overallDurationHint)
--> (*value:0, timescale:0, flags:0, epoch:0*)
###Accessing Asset Preferences
#log ocidReadAsset's preferredRate
#log ocidReadAsset's preferredVolume
#log ocidReadAsset's preferredTransform
#log ocidReadAsset's preferredMediaSelection
#log ocidReadAsset's preferredDisplayCriteria
#log ocidReadAsset's AVDisplayCriteria
###Accessing Media Selections
#log ocidReadAsset's allMediaSelections as list
#log ocidReadAsset's availableMediaCharacteristicsWithMediaSelectionOptions as list
*)
log "##################AVAssetTrack"
set ocidReadAssetTrackArray to ocidReadAsset's tracks()
###トラック数
set numCntTrackNo to (count of ocidReadAssetTrackArray) as integer
log "トラック数は: " & numCntTrackNo
###ビデオトラックは0なので0を取得エラーすればビデオが無い音声ムービー
set ocidAssetTrackTrack to (ocidReadAssetTrackArray's objectAtIndex:0)
####trackID
set strTrackID to ocidAssetTrackTrack's trackID() as text
####mediaType
set strMediaType to ocidAssetTrackTrack's mediaType() as text
if strMediaType is "vide" then
log "MediaType: vide ビデオトラック:トラックIDは" & strTrackID
else if strMediaType is "soun" then
log "MediaType: soun サウンドトラック:トラックIDは" & strTrackID
else
log "MediaType: " & strMediaType
log "TrackID: " & strTrackID
end if
###データレンジ
##log ocidAssetTrackTrack's totalSampleDataLength()
###タイムレンジ
##アセットとトラックの長さが同じとも限らないのでこの値を使う
set listAssetTrackTimeRange to (ocidAssetTrackTrack's timeRange()) as list
log listAssetTrackTimeRange
set listTimeScale to item 1 of listAssetTrackTimeRange as list
set listDuration to item 2 of listAssetTrackTimeRange as list
##ビデオトラックDuration値
set ocidAssetTrackTimeScale to (item 2 of listTimeScale) as integer
##TimeScale
set numDuration to (item 1 of listDuration) as integer
###タイムスケールは別値を使う
##naturalTimeScaleの値を使うとうまくいかない『場合』があるので
#set ocidAssetTrackTimeScale to ocidAssetTrackTrack's naturalTimeScale()
#log ocidAssetTrackTimeScale
####ビデオの縦横サイズ
set ocidAssetTrackNaturalSize to ocidAssetTrackTrack's naturalSize()
log ocidAssetTrackNaturalSize
####
set numWidth to ocidAssetTrackNaturalSize's width as integer
set numHeight to ocidAssetTrackNaturalSize's height as integer
###今回は横3毎なので1/3の幅が個別のイメージサイズ
set nunTileScaleWidth to numWidth / 3 as integer
set nunTileScaleHeight to numHeight / 3 as integer

if nunTileScaleWidth > nunTileScaleHeight then
  set strTile to "3x10" as text
  ###切り出し間隔Duration
  ###通常横系動画
  ###横3枚縦10枚合計30点必要なので30で割る
  set numImageTime to numDuration / 30 as number
  set numImageTimeSec to numImageTime / ocidAssetTrackTimeScale as integer
log numImageTimeSec & "秒毎"
else
  set strTile to "3x5" as text
  ###切り出し間隔Duration
  ##縦長動画用
  ###横3枚縦10枚合計30点必要なので15で割る
  set numImageTime to numDuration / 15 as number
  set numImageTimeSec to numImageTime / ocidAssetTrackTimeScale as integer
log numImageTimeSec & "秒毎"
end if


####フレームレート
set numFps to ocidAssetTrackTrack's nominalFrameRate() as number
####毎秒×フレームレートで 何フレーム毎にイメージ作成すれば良いか?
set numTimeScale to (item 2 of ocidReadAssetDuration) as integer
set nunVideoRuraByFlame to (numImageTimeSec / numTimeScale) as number
set numImageToFps to nunVideoRuraByFlame * numFps as integer


#set numImageToFps to numImageTimeSec * numFps as integer
#log "numFps: " & numImageToFps


####
(* 使わない値

set ocidAssetTrackNaturalSize to ocidAssetTrackTrack's naturalSize()
log ocidAssetTrackNaturalSize
set ocidCMTimeFrameDura to ocidAssetTrackTrack's minFrameDuration()
log ocidCMTimeFrameDura as record
log ocidAssetTrackTrack's estimatedDataRate()


log ((ocidAssetTrackTrack's formatDescriptions())'s objectAtIndex:0)
log ocidAssetTrackTrack's isPlayable()
log ocidAssetTrackTrack's isDecodable()
log ocidAssetTrackTrack's isEnabled()
log ocidAssetTrackTrack's isSelfContained()
log ocidAssetTrackTrack's requiresFrameReordering() as boolean
log ocidAssetTrackTrack's metadata() as list
log ocidAssetTrackTrack's commonMetadata() as list
log ocidAssetTrackTrack's availableMetadataFormats() as list
log ocidAssetTrackTrack's segments() as list
log ocidAssetTrackTrack's availableTrackAssociationTypes() as list
log ocidAssetTrackTrack's preferredTransform()
log ocidAssetTrackTrack's preferredVolume()
log ocidAssetTrackTrack's languageCode() as text
log ocidAssetTrackTrack's extendedLanguageTag()
log ocidAssetTrackTrack's hasAudioSampleDependencies()
*)
#################
tell application "Terminal"
launch
activate
end tell
#################################
### layout, nb_frames, margin, padding, color
####コマンド整形
set strCommandText to "\"" & strBinPath & "\" -i \"" & strFilePath & "\" -vf select='not(mod(n\\," & numImageToFps & "))',scale=" & nunTileScaleWidth & ":" & nunTileScaleHeight & ",tile=" & strTile & " -frames:v 1 \"" & strSaveFilePath & "\"" as text
log strCommandText
tell application "Terminal"
launch
activate
  set objWindowID to (do script "\n\n")
delay 1
do script strCommandText in objWindowID
end tell

set ocidReadAssetTrackArray to ""
set ocidReadAsset to ""
return


|

ビデオからイメージシーケンス


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AVFoundation"
use framework "AppKit"
use framework "CoreMedia"
use scripting additions
property refMe : a reference to current application

####################################
###設定項目
####################################
###ビデオの全長をX等分してそれ毎にキャプチャ
set numTotalImageCnt to 28 as integer

##########################################
###### ffmpeg 基本設定
##########################################
###ffmpeg へのパス
set strPathToFFMPEG to "/bin/echo $HOME/bin/ffmpeg.arm/ffmpeg" as text
set strPathToFFMPEG to (do shell script strPathToFFMPEG)
#普通はこちら
# strPathToFFMPEG to ("/usr/local/bin/ffmpeg")

####################################
####ダイアログ 入力ビデオ
####################################
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
############ デフォルトロケーション
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
set listUTI to {"public.movie"}
set strMes to ("ファイルを選んでください") as text
set strPrompt to ("ファイルを選んでください") as text
try
  ### ファイル
  set aliasFilePath to (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias
on error
log "エラーしました"
return "エラーしました"
end try
set strFilePath to POSIX path of aliasFilePath
set ocidFilePath to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePathURL to refMe's NSURL's fileURLWithPath:(ocidFilePath)

####################################
####ダイアログ 出力フォルダ
####################################
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set strMes to "フォルダを選んでください" as text
set strPrompt to "フォルダを選択してください" as text
try
  set aliasResponse to (choose folder strMes with prompt strPrompt default location aliasDefaultLocation without multiple selections allowed, invisibles and showing package contents) as alias
on error
log "エラーしました"
return "エラーしました"
end try
set strSaveDirPath to POSIX path of aliasResponse
set ocidSaveDirPath to refMe's NSString's stringWithString:(strSaveDirPath)
set ocidSaveDirPathURL to refMe's NSURL's fileURLWithPath:(ocidSaveDirPath)

##########################################
######AVAsset 基本処理
##########################################
set ocidReadAsset to refMe's AVAsset's assetWithURL:(ocidFilePathURL)
##Duration
set ocidReadAssetDuration to ocidReadAsset's duration()
###総秒
set cmTime to refMe's CMTimeGetSeconds(ocidReadAssetDuration)
###時間
set numHours to (round of ((cmTime as number) / 3600) rounding down) as integer
###分
set numMinutes to (round of (((cmTime as number) - (numHours * 3600)) / 60) rounding down) as integer
###残り秒
set numSec to cmTime - ((numHours * 3600) + (numMinutes * 60))
log "時間:" & numHours & "時 " & numMinutes & "分 " & numSec & "秒"
######AVAssetTrackGroup
set ocidReadAssetTrackGArray to ocidReadAsset's trackGroups()
set numCntTrackG to (ocidReadAssetTrackGArray count) as integer
log "トラックグループ数: " & numCntTrackG
log ("トラックグループID: " & ((ocidReadAssetTrackGArray's firstObject())'s trackIDs() as integer)) as text

######AVAssetTrack
set ocidReadAssetTrackArray to ocidReadAsset's tracks()
set numCntTrack to (ocidReadAssetTrackArray count) as integer
log "トラック数は: " & numCntTrack
##
repeat with itemIntNo from 0 to (numCntTrack - 1) by 1
  set ocidTrack to (ocidReadAssetTrackArray's objectAtIndex:(itemIntNo))
log className() of ocidTrack as text
  set strTrackID to ocidTrack's trackID() as text
log strTrackID
  set strMediaType to ocidTrack's mediaType() as text
  if strMediaType is "vide" then
    ########################
log "MediaType: vide ビデオトラック:トラックIDは" & strTrackID
    ## トラックの総時間
    set listAssetTrackTimeRange to ocidTrack's timeRange()
    set listStartTime to (item 1 of listAssetTrackTimeRange)
    set listDurationTime to (item 2 of listAssetTrackTimeRange)
log listStartTime as list
log listDurationTime as list
    ##タイムスケール
    set numAssetTrackTimeScale to ocidTrack's naturalTimeScale()
log numAssetTrackTimeScale
    ##トラックの画面サイズ
    set recordAssetTrackNaturalSize to ocidTrack's naturalSize()
log recordAssetTrackNaturalSize
    set numTrackWidth to (width of recordAssetTrackNaturalSize) as integer
    set numTrackHeight to (height of recordAssetTrackNaturalSize) as integer
    ##1フレームの長さ
    set recordCMTimeFrameDura to ocidTrack's minFrameDuration()
    
    set numFlameScale to ((item 1 of recordCMTimeFrameDura) / (item 2 of recordCMTimeFrameDura)) as number
log numFlameScale
    set numFlameRateDura to (1 / numFlameScale)
log numFlameRateDura
    ##フレームレート
    set numFlameRate to ocidTrack's nominalFrameRate() as number
log numFlameRate
  else if strMediaType is "soun" then
    ########################
log "MediaType: soun サウンドトラック:トラックIDは" & strTrackID
  end if
  
end repeat


##########################################
###### 時間処理
##########################################

###表示フォーマット
set ocidFormatter to refMe's NSDateFormatter's alloc()'s init()
ocidFormatter's setTimeStyle:(refMe's NSDateFormatterNoStyle)
ocidFormatter's setDateStyle:(refMe's NSDateFormatterNoStyle)
ocidFormatter's setDateFormat:("HH:mm:ss")
###ファイル名フォーマット
set ocidFileNameFormatter to refMe's NSDateFormatter's alloc()'s init()
ocidFileNameFormatter's setTimeStyle:(refMe's NSDateFormatterNoStyle)
ocidFileNameFormatter's setDateStyle:(refMe's NSDateFormatterNoStyle)
ocidFileNameFormatter's setDateFormat:("HH_mm_ss")
###開始時間 カレンダ
set ocidCalendar to refMe's NSCalendar's currentCalendar()
set ocidStartTimeComp to refMe's NSDateComponents's alloc()'s init()
ocidStartTimeComp's setHour:0
ocidStartTimeComp's setMinute:0
ocidStartTimeComp's setSecond:5
set ocidStartTime to ocidCalendar's dateFromComponents:(ocidStartTimeComp)
log (ocidFormatter's stringFromDate:(ocidStartTime)) as text
###インターバル秒
set intInterval to (cmTime / numTotalImageCnt) as integer
###インターバルカレンダ コンポーネント(何秒毎)
set ocidIntervalComp to refMe's NSDateComponents's alloc()'s init()
ocidIntervalComp's setSecond:(intInterval)
####ビデオの長さ
set ocidEndTimeComp to refMe's NSDateComponents's alloc()'s init()
ocidEndTimeComp's setHour:(numHours)
ocidEndTimeComp's setMinute:(numMinutes)
ocidEndTimeComp's setSecond:(numSec)
set ocidEndTime to ocidCalendar's dateFromComponents:(ocidEndTimeComp)
log (ocidFormatter's stringFromDate:(ocidEndTime)) as text

###スタート時間
set ocidCaptureTime to ocidStartTime

##########################################
###### 本処理
##########################################
###取得毎数分繰り返し
repeat numTotalImageCnt times
  ###画像を取り出す時間
  set ocidCaptureTime to ocidCalendar's dateByAddingComponents:(ocidIntervalComp) toDate:(ocidCaptureTime) options:(0)
  ###FFMPEG用の時間テキストに
  set strCaptureTime to (ocidFormatter's stringFromDate:(ocidCaptureTime)) as text
log strCaptureTime
  ###ファイル名用の時間テキスト
  set strFileNameTime to (ocidFileNameFormatter's stringFromDate:(ocidCaptureTime)) as text
  ###時間テキストをそのままファイル名にしてパスにしておく
  set strSaveFilePath to (strSaveDirPath & strFileNameTime & ".png") as text
  ###コマンド整形
  set strCommandText to (strPathToFFMPEG & " -ss " & strCaptureTime & " -i \"" & strFilePath & "\" -frames:v 1 \"" & strSaveFilePath & "\"") as text
log strCommandText
  ###コマンド実行
do shell script strCommandText
  ###1秒まって次の処理
delay 1
end repeat



return







##1秒毎
set strCommandText to (strPathToFFMPEG & " -i \"" & strFilePath & "\" -vf fps=1 \"" & strSaveDirPath & "%04d.png\"") as text


##10秒毎
set strCommandText to (strPathToFFMPEG & " -i \"" & strFilePath & "\" -vf fps=1/10 \"" & strSaveDirPath & "%04d.png\"") as text

##ビデオの長さの24等分毎に
set intInterval to (cmTime / 24) as integer
set numInterval to (1 / intInterval) as number
set strCommandText to (strPathToFFMPEG & " -i \"" & strFilePath & "\" -vf fps=" & numInterval & " \"" & strSaveDirPath & "%04d.png\"") as text



##############################
##新規ウィンドウ
tell application "Terminal"
  set objNewWindow to (do script "\n")
end tell
##############################
## コマンド実行
tell application "Terminal"
do script strCommandText in objNewWindow
end tell

return
######AVMetadataItem
set ocidReadAssetMetadataArray to ocidReadAsset's metadata()
log "メタデータの数: " & ((ocidReadAssetMetadataArray count) as integer) as text
repeat with itemMetaData in ocidReadAssetMetadataArray
log itemMetaData's identifier() as text
log itemMetaData's dataType() as text
log itemMetaData's |key|() as text
log itemMetaData's keySpace() as text
log itemMetaData's stringValue() as text
end repeat

######BOOL値が戻り
log ocidReadAsset's isPlayable()
log ocidReadAsset's isExportable()
log ocidReadAsset's isReadable()
log ocidReadAsset's isComposable()
log ocidReadAsset's isCompatibleWithAirPlayVideo()
log ocidReadAsset's isCompatibleWithSavedPhotosAlbum()
log ocidReadAsset's hasProtectedContent()



|

[ffmpeg]ムービーファイルをイメージシーケンス画像にする

 

【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# ###FFMPEGのインストールが別途必要です
# https://ffmpeg.org/
# fps 50の場合 1秒分で 50ファイル出来ますので留意ください
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AVFoundation"
use scripting additions
property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()
##############################
###設定項目
###FFMPEGのパス
###通常はこちらかな?
# set strBinPath to ("/usr/local/bin/ffmpeg") as text
set strBinPath to ("~/bin/ffmpeg.6/ffmpeg") as text

#
set ocidBinPathStr to refMe's NSString's stringWithString:(strBinPath)
set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
set strBinPath to ocidBinPath as string
#############################
###ダイアログ
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
############ デフォルトロケーション
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
############UTIリスト
set listUTI to {"public.movie"}

set strMes to ("ムービー・ファイルを選んでください") as text
set strPrompt to ("ムービー・ファイルを選んでください") as text
try
  ### ファイル選択時
  set aliasFilePath to (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias
on error
log "エラーしました"
return "エラーしました"
end try

###
set strFilePath to (POSIX path of aliasFilePath) as text
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
set strFilePathURL to (ocidFilePathURL's |path|()) as text
set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
set strFileName to (ocidBaseFilePathURL's lastPathComponent()) as text
###デスクトップにファイル名のフォルダ作って
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set strSetDirName to (strFileName & "_書出") as text
set ocidSaveDirPathURL to ocidDesktopDirPathURL's URLByAppendingPathComponent:(strSetDirName)
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
set strSaveSequenceDirPathURL to (ocidSaveDirPathURL's |path|()) as text


##イメージシーケンス生成
set strCommandText to ("pushd \"" & strSaveSequenceDirPathURL & "\" && " & strBinPath & " -i \"" & strFilePathURL & "\" frame%04d.png") as text
do shell script strCommandText
##



|

[AppleScript]ffmpegインストール(野良)

野良のバイナリーをインストールしますので
不安な方は非推奨です
(とはいえ、現時点での公式に近い位置のバイナリです)

【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#com.cocolog-nifty.quicktimer.icefloe
(*
解凍に7zzを利用します
未インストールの場合はエラーになります
7zzインストール
https://quicktimer.cocolog-nifty.com/icefloe/2024/01/post-01fee7.html
*)
#
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application

set strURL1 to ("https://evermeet.cx/ffmpeg/ffmpeg-6.1.1.7z") as text
set strURL2 to ("https://evermeet.cx/ffmpeg/ffprobe-6.1.1.7z") as text
set strURL3 to ("https://evermeet.cx/ffmpeg/ffplay-6.1.1.7z") as text

###設定項目
set str7zzPath to ("~/bin/7zip/7zz") as text


set ocid7zzFilePathStr to refMe's NSString's stringWithString:(str7zzPath)
set ocid7zzFilePath to ocid7zzFilePathStr's stringByStandardizingPath()
set ocid7zzFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocid7zzFilePath) isDirectory:false)
set str7zzFilePathURL to (ocid7zzFilePathURL's |path|()) as text
################################################
###### データ保存
################################################
###ディレクトリ
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidTempDirURL to appFileManager's temporaryDirectory()
set ocidUUID to refMe's NSUUID's alloc()'s init()
set ocidUUIDString to ocidUUID's UUIDString
set ocidSaveDirPathURL to ocidTempDirURL's URLByAppendingPathComponent:(ocidUUIDString) isDirectory:true
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
# 777-->511 755-->493 700-->448 766-->502
ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
################################################
###### 展開
################################################
###展開先
set ocidHomeDirURL to appFileManager's homeDirectoryForCurrentUser()
set ocidInstallDirPathURL to ocidHomeDirURL's URLByAppendingPathComponent:("bin/ffmpeg") isDirectory:true
set strInstallDirPathURL to (ocidInstallDirPathURL's |path|()) as text
###フォルダ作る
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
# 777-->511 755-->493 700-->448 766-->502
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidInstallDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
################################################
###### ダウンロード
################################################
###URL1
set coidBaseURLStr to refMe's NSString's stringWithString:(strURL1)
set ocidBaseURL to refMe's NSURL's URLWithString:(coidBaseURLStr)
set ocidFileName to ocidBaseURL's lastPathComponent()
set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(ocidFileName) isDirectory:false
set strSaveFilePath to ocidSaveFilePathURL's |path|() as text
#ダウンロード
set strCommandText to ("/usr/bin/curl -L \"" & strURL1 & "\" -o \"" & strSaveFilePath & "\" --connect-timeout 20")
do shell script strCommandText
#解凍
set strCommandText to ("\"" & str7zzFilePathURL & "\" x \"" & strSaveFilePath & "\" -aoa -o\"$HOME/bin/ffmpeg\"") as text
set strResponse to (do shell script strCommandText) as text
###URL2
set coidBaseURLStr to refMe's NSString's stringWithString:(strURL2)
set ocidBaseURL to refMe's NSURL's URLWithString:(coidBaseURLStr)
set ocidFileName to ocidBaseURL's lastPathComponent()
set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(ocidFileName) isDirectory:false
set strSaveFilePath to ocidSaveFilePathURL's |path|() as text
#ダウンロード
set strCommandText to ("/usr/bin/curl -L \"" & strURL2 & "\" -o \"" & strSaveFilePath & "\" --connect-timeout 20")
do shell script strCommandText
#解凍
set strCommandText to ("\"" & str7zzFilePathURL & "\" x \"" & strSaveFilePath & "\" -aoa -o\"$HOME/bin/ffmpeg\"") as text
set strResponse to (do shell script strCommandText) as text
###URL3
set coidBaseURLStr to refMe's NSString's stringWithString:(strURL3)
set ocidBaseURL to refMe's NSURL's URLWithString:(coidBaseURLStr)
set ocidFileName to ocidBaseURL's lastPathComponent()
set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(ocidFileName) isDirectory:false
set strSaveFilePath to ocidSaveFilePathURL's |path|() as text
#ダウンロード
set strCommandText to ("/usr/bin/curl -L \"" & strURL3 & "\" -o \"" & strSaveFilePath & "\" --connect-timeout 20")
do shell script strCommandText
#解凍
set strCommandText to ("\"" & str7zzFilePathURL & "\" x \"" & strSaveFilePath & "\" -aoa -o\"$HOME/bin/ffmpeg\"") as text
set strResponse to (do shell script strCommandText) as text


###################################
###保存先を開く
###################################
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set boolDone to appSharedWorkspace's openURL:(ocidInstallDirPathURL)
if boolDone is false then
  set aliasFilePathURL to (ocidInstallDirPathURL's absoluteURL()) as alias
  set boolResults to (appShardWorkspace's openURL:ocidCloudStorageDirURL)
  if boolResults is false then
    tell application "Finder"
make new Finder window to aliasFilePathURL
    end tell
  end if
end if




|

[ffmpeg] エンコードを変えずにそのままmp4に


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# リサイズ設定無し エンコード同じでmp4に
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use scripting additions
property refMe : a reference to current application

################################
####設定項目
################################
#一般的にはこちら
#set strFilePath to ("/usr/local/bin/ffmpeg") as text
#私用
set strFilePath to "~/bin/ffmpeg/ffmpeg" as text

################################
####BINPATH
################################
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
set strPathToFFMPEG to (ocidFilePathURL's |path|()) as text

################################
#####書き出し先パス
################################
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSMoviesDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidMoviesDirPathURL to ocidURLsArray's firstObject()
set ocidSaveDirPathURL to (ocidMoviesDirPathURL's URLByAppendingPathComponent:("_FFMPEG書出"))
##
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
# 777-->511 755-->493 700-->448 766-->502
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
################################
#####ダイアログを前面に
################################
tell current application
  set strName to name as text
end tell
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set listAliasFile to (choose file "ファイルを選んでください" with prompt "ファイルを選んでください" default location (path to desktop folder from user domain) of type {"com.apple.quicktime-movie", "public.movie"} with invisibles, showing package contents and multiple selections allowed) as list

repeat with itemAliasFile in listAliasFile
  set aliasFile to itemAliasFile as alias
  set strFilePath to (POSIX path of aliasFile) as text
  set ocidFilePathStr to (refMe's NSString's stringWithString:(strFilePath))
  set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
  set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
  ##拡張子をとったファイル名
  set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
  set strBaeFileFileName to (ocidBaseFilePathURL's lastPathComponent()) as text
  ##保存ファイル名
  set strSaveFileName to (strBaeFileFileName & ".mp4") as text
  ##保存URL
  set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName))
  set strSaveFilePath to ocidSaveFilePathURL's |path| as text
  (*
################ ビデオ
### bitrate
-vb 720k
-vb 3600k
-vb 7200k
-vb 1080k
### FPS
-r 23.9
-r 24
-r 30
-r 50
-r 60
-r 120
###
-codec:v libx264
-codec:v libx265
-codec:v h264_videotoolbox
###
-profile:v baseline
-profile:v main
-profile:v high
-profile:v high10
-profile:v high422
-profile:v high444
###
-tune film
-tune animation
-tune grain
-tune stillimage
-tune fastdecode
-tune zerolatency
###
-preset ultrafast
-preset superfast
-preset veryfast
-preset faster
-preset fast
-preset medium
-preset slow
-preset slower
-preset veryslow
###
-crf 0
-crf 22
-crf 28
-crf 63
### Pillarbox
-vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black"
### crop
-vf "scale=1280:720:force_original_aspect_ratio=increase, crop=1280:720"
### 幅合わせ  高自動 
-vf "scale=1280:-2"
###高さ合わせ 幅自動
-vf "scale=-2:720"
################ オーディオ
###
-codec:a copy
-codec:a aac
-codec:a aac_at
-codec:a libfdk_aac
-codec:a libmp3lame
### ビットレート bitrates
-b:a 32k
-b:a 96k
-b:a 128k
-b:a 256k
-b:a 320k
-b:a 512k
###サンプルレート Samplerate
-r:a 16K
-r:a 22050
-r:a 32K
-r:a 44100
-r:a 48K
-r:a 96K
-r:a 192K
###
-codec:a libmp3lame -ar 48K -ab 320k
-codec:a aac -ar 32K -ab 128k -aac_coder twoloop
*)
  
  ##set strCommandText to ("\"" & strPathToFFMPEG & "\" -i '" & strFilePath & "' -codec:v libx264 -profile:v baseline -tune film -crf 28 -codec:a aac -r:a 44100 -b:a 320k '" & strSaveFilePath & "'") as text
  set strCommandText to ("\"" & strPathToFFMPEG & "\" -i \"" & strFilePath & "\" -codec:v copy -codec:a copy \"" & strSaveFilePath & "\"") as text
  
  tell application "Terminal"
launch
activate
    set objWindowID to (do script "\n\n")
delay 1
do script strCommandText in objWindowID
    
  end tell
  
end repeat

###################################
###保存先を開く
###################################
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set boolDone to appSharedWorkspace's openURL:(ocidSaveDirPathURL)
if boolDone is false then
  set aliasFilePathURL to (ocidSaveDirPathURL's absoluteURL()) as alias
  set boolResults to (appShardWorkspace's openURL:ocidCloudStorageDirURL)
  if boolResults is false then
    tell application "Finder"
make new Finder window to aliasFilePathURL
    end tell
  end if
end if


################################
# 日付 doGetDateNo(argDateFormat,argCalendarNO)
# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
################################
to doGetDateNo({argDateFormat, argCalendarNO})
  ##渡された値をテキストで確定させて
  set strDateFormat to argDateFormat as text
  set intCalendarNO to argCalendarNO as integer
  ###日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義(日本語)
  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
  ###和暦 西暦 カレンダー分岐
  if intCalendarNO = 1 then
    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
  else if intCalendarNO = 2 then
    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
  else
    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
  end if
  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
  ###設定
ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
ocidFormatterJP's setLocale:(ocidLocaleJP)
ocidFormatterJP's setCalendar:(ocidCalendarJP)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
  ###渡された値でフォーマット定義
ocidFormatterJP's setDateFormat:(strDateFormat)
  ###フォーマット適応
  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
  ###テキストで戻す
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo


|

[Bash]ffmpegインストール


#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
#ユーザード $HOME/binにインストールする
#解凍に7zzを使用します
########################################
### 設定項目
STR_URL_FFMPEG="https://evermeet.cx/ffmpeg/ffmpeg-6.1.1.7z"
STR_URL_FFPROBE="https://evermeet.cx/ffmpeg/ffprobe-6.1.1.7z"
STR_URL_FFPLAY="https://evermeet.cx/ffmpeg/ffplay-6.1.1.7z"

########################################
###管理者インストールしているか?チェック
USER_WHOAMI=$(/usr/bin/whoami)
/bin/echo "実行ユーザーは:$USER_WHOAMI"
###実行しているユーザー名
CONSOLE_USER=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/ { print $3 }')
/bin/echo "コンソールユーザー:$CONSOLE_USER"
###ログイン名ユーザー名※Visual Studio Codeの出力パネルではrootになる設定がある
LOGIN_NAME=$(/usr/bin/logname)
/bin/echo "ログイン名:$LOGIN_NAME"
###UID
USER_NAME=$(/usr/bin/id -un)
/bin/echo "ユーザー名:$USER_NAME"
###SUDOUSER
/bin/echo "SUDO_USER: $SUDO_USER"
########################################
##OS
PLIST_PATH="/System/Library/CoreServices/SystemVersion.plist"
STR_OS_VER=$(/usr/bin/defaults read "$PLIST_PATH" ProductVersion)
/bin/echo "OS VERSION :" "$STR_OS_VER"
STR_MAJOR_VERSION="${STR_OS_VER%%.*}"
/bin/echo "STR_MAJOR_VERSION :" "$STR_MAJOR_VERSION"
STR_MINOR_VERSION="${STR_OS_VER#*.}"
/bin/echo "STR_MINOR_VERSION :" "$STR_MINOR_VERSION"
########################################
###ダウンロード起動時に削除する項目
USER_TEMP_DIR=$(/usr/bin/mktemp -d)
/bin/echo "起動時に削除されるディレクトリ:" "$USER_TEMP_DIR"
############################################################
############################################################
###BIN
/bin/mkdir -p "/Users/$CONSOLE_USER/bin/"
for ((numTimes = 1; numTimes <= 3; numTimes++)); do
sleep 1
/bin/mkdir -p "/Users/$CONSOLE_USER/bin/ffmpeg"
/usr/bin/touch "/Users/$CONSOLE_USER/bin/ffmpeg"
/usr/sbin/chown "$CONSOLE_USER" "/Users/$CONSOLE_USER/bin/ffmpeg"
/bin/chmod 700 "/Users/$CONSOLE_USER/bin/ffmpeg"
done

###ダウンロードSTR_URL_FFMPEG
DL_FILE_NAME="FFMPEG.7z"
if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL_FFMPEG" --connect-timeout 20; then
/bin/echo "ファイルのダウンロードに失敗しました HTTP1.1で再トライします"
  if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL_FFMPEG" --http1.1 --connect-timeout 20; then
/bin/echo "ファイルのダウンロードに失敗しました"
exit 1
  fi
fi
###旧バージョンをゴミ箱に
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/FFMPEG.XXXXXXXX")
/bin/mv "/Users/$CONSOLE_USER/bin/ffmpeg/ffmpeg" "$USER_TRASH_DIR"
##移動して
/bin/mv -f "$USER_TEMP_DIR/$DL_FILE_NAME" "/Users/$CONSOLE_USER/bin/ffmpeg"
/Users/"$CONSOLE_USER"/bin/7zip/7zz x "/Users/$CONSOLE_USER/bin/ffmpeg/$DL_FILE_NAME" -o"/Users/$CONSOLE_USER/bin/ffmpeg"
/bin/mv "/Users/$CONSOLE_USER/bin/ffmpeg/$DL_FILE_NAME" "$USER_TRASH_DIR"
###ダウンロードSTR_URL_FFMPEG
DL_FILE_NAME="FFPROBE.7z"
if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL_FFPROBE" --connect-timeout 20; then
/bin/echo "ファイルのダウンロードに失敗しました HTTP1.1で再トライします"
  if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL_FFPROBE" --http1.1 --connect-timeout 20; then
/bin/echo "ファイルのダウンロードに失敗しました"
exit 1
  fi
fi
###旧バージョンをゴミ箱に
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/FFMPEG.XXXXXXXX")
/bin/mv "/Users/$CONSOLE_USER/bin/ffmpeg/ffprobe" "$USER_TRASH_DIR"
/bin/mv -f "$USER_TEMP_DIR/$DL_FILE_NAME" "/Users/$CONSOLE_USER/bin/ffmpeg"
/Users/"$CONSOLE_USER"/bin/7zip/7zz x "/Users/$CONSOLE_USER/bin/ffmpeg/$DL_FILE_NAME" -o"/Users/$CONSOLE_USER/bin/ffmpeg"
/bin/mv "/Users/$CONSOLE_USER/bin/ffmpeg/$DL_FILE_NAME" "$USER_TRASH_DIR"
###ダウンロードSTR_URL_FFPLAY
DL_FILE_NAME="FFPLAY.7z"
if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL_FFPLAY" --connect-timeout 20; then
/bin/echo "ファイルのダウンロードに失敗しました HTTP1.1で再トライします"
  if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL_FFPLAY" --http1.1 --connect-timeout 20; then
/bin/echo "ファイルのダウンロードに失敗しました"
exit 1
  fi
fi
###旧バージョンをゴミ箱に
USER_TRASH_DIR=$(/usr/bin/mktemp -d "$HOME/.Trash/FFMPEG.XXXXXXXX")
/bin/mv "/Users/$CONSOLE_USER/bin/ffmpeg/ffplay" "$USER_TRASH_DIR"
/bin/mv -f "$USER_TEMP_DIR/$DL_FILE_NAME" "/Users/$CONSOLE_USER/bin/ffmpeg"
/Users/"$CONSOLE_USER"/bin/7zip/7zz x "/Users/$CONSOLE_USER/bin/ffmpeg/$DL_FILE_NAME" -o"/Users/$CONSOLE_USER/bin/ffmpeg"
/bin/mv "/Users/$CONSOLE_USER/bin/ffmpeg/$DL_FILE_NAME" "$USER_TRASH_DIR"
############################################################
###
/usr/bin/open "/Users/$CONSOLE_USER/bin/ffmpeg"


|

[ffmpeg]ムービーファイルをGIFにする


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# ###FFMPEGのインストールが別途必要です
# https://ffmpeg.org/
# fps 50の場合 1秒分で 50ファイル出来ますので留意ください
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AVFoundation"
use scripting additions
property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()
##############################
###設定項目
###FFMPEGのパス
###通常はこちらかな?
# set strBinPath to ("/usr/local/bin/ffmpeg") as text
set strBinPath to ("~/bin/ffmpeg.6/ffmpeg") as text

#ffmpeg
set ocidBinPathStr to refMe's NSString's stringWithString:(strBinPath)
set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
set strBinPath to ocidBinPath as string

#############################
###ダイアログ
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
############ デフォルトロケーション
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
############UTIリスト
set listUTI to {"public.movie"}

set strMes to ("ムービー・ファイルを選んでください") as text
set strPrompt to ("ムービー・ファイルを選んでください") as text
try
  ### ファイル選択時
  set aliasFilePath to (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias
on error
log "エラーしました"
return "エラーしました"
end try

###
set strFilePath to (POSIX path of aliasFilePath) as text
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
set strFilePathURL to (ocidFilePathURL's |path|()) as text
set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
set strFileName to (ocidBaseFilePathURL's lastPathComponent()) as text
###AVURLAssetを利用してFPSを求める
set ocidReadAsset to (refMe's AVURLAsset's alloc()'s initWithURL:(ocidFilePathURL) options:(missing value))
set ocidReadAssetArray to (ocidReadAsset's tracksWithMediaType:(refMe's AVMediaTypeVideo))
set ocidAssetVideoTrack to (ocidReadAssetArray's objectAtIndex:0)
####フレームレートFPS
set ocidFrameRate to ocidAssetVideoTrack's nominalFrameRate()
####整数にしてテキスト化
set strFPS to ((round (ocidFrameRate * 100)) / 100) as text


###デスクトップにファイル名のフォルダ作って
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set strSetDirName to (strFileName & "_書出") as text
set ocidSaveDirPathURL to ocidDesktopDirPathURL's URLByAppendingPathComponent:(strSetDirName)
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
##
set strSaveFileName to (strFileName & ".gif") as text
set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName)
set strSaveFilePathURL to ocidSaveFilePathURL's |path| as text
##イメージシーケンス生成
set strCommandText to ("\"" & strBinPath & "\" -i \"" & strFilePathURL & "\" -vf \"fps=" & strFPS & ",split[v0][v1];[v0]palettegen[p];[v1][p]paletteuse\" -loop 0 \"" & strSaveFilePathURL & "\"") as text
do shell script strCommandText



|

その他のカテゴリー

Acrobat Acrobat Annotation Acrobat BookMark Acrobat Dialog Acrobat Distiller Acrobat Form Acrobat JS Acrobat Manifest Acrobat Open Acrobat Plugin Acrobat Preflight Acrobat python Acrobat Reader Acrobat SCA Acrobat Sequ Acrobat Sign Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Adobe RemoteUpdateManager Apple AppleScript AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Audio AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript com.apple.LaunchServices.OpenWith AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript Guide AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript Mail AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFileManager enumeratorAtURL AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Events Plist AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML savedSearch AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript XMP AppleScript YouTube AppleScript Zero Suppress Applications CityCode Design github iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom