ffmpeg

[ffmpeg] タイムスケールを1000に設定する


AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004(*
005FFMPEGをインストールしていない場合は
006インストールもします
007
008リサイズ設定無し エンコード同じでmp4に
009タイムスケールを1000に設定します
010
011バイナリーはFFMPEGの野良サイトからダウンロードになりますので
012ぜキュイティを担保できません
013不安な方は実行してください
014*)
015#
016#com.cocolog-nifty.quicktimer.icefloe
017----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
018use AppleScript version "2.8"
019use framework "Foundation"
020use framework "AppKit"
021use scripting additions
022property refMe : a reference to current application
023set appFileManager to refMe's NSFileManager's defaultManager()
024
025
026################################
027####設定項目
028################################
029#インストール先
030set strBinFilePath to "~/bin/ffmpeg7.1/ffmpeg" as text
031
032
033################################
034####BINPATH  ffmpegのパス
035################################
036set ocidBinFilePathStr to refMe's NSString's stringWithString:(strBinFilePath)
037set ocidBinFilePath to ocidBinFilePathStr's stringByStandardizingPath()
038set ocidBinFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidBinFilePath) isDirectory:false)
039set strBinFilePath to (ocidBinFilePathURL's |path|()) as text
040#有無チェック
041set boolDirExists to appFileManager's fileExistsAtPath:(ocidBinFilePath) isDirectory:(false)
042if boolDirExists = true then
043  log "【OK】指定のパスにFFMPEGがあります"
044else if boolDirExists = false then
045  log "【NG】指定のパスにFFMPEGがありません\rインストールします 1分程度時間がかかります"
046  set boolDone to doGetFFMPEG()
047  if boolDone is true then
048    log "インストール成功 処理継続"
049  else
050    return "インストール失敗 処理中断"
051  end if
052end if
053
054################################
055#####書き出し先パス Moviesフォルダ内へ
056################################
057set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSMoviesDirectory) inDomains:(refMe's NSUserDomainMask))
058set ocidMoviesDirPathURL to ocidURLsArray's firstObject()
059set ocidSaveDirPathURL to (ocidMoviesDirPathURL's URLByAppendingPathComponent:("_FFMPEG書出"))
060##
061set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
062# 777-->511 755-->493 700-->448 766-->502
063ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
064set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
065################################
066#####ダイアログを前面に
067################################
068tell current application
069  set strName to name as text
070end tell
071if strName is "osascript" then
072  tell application "Finder" to activate
073else
074  tell current application to activate
075end if
076set listAliasFile to (choose file "ファイルを選んでください" with prompt "ファイルを選んでください" default location (path to desktop folder from user domain) of type {"com.apple.quicktime-movie", "public.movie", "public.item"} with invisibles, showing package contents and multiple selections allowed) as list
077
078repeat with itemAliasFile in listAliasFile
079  set aliasFile to itemAliasFile as alias
080  set strFilePath to (POSIX path of aliasFile) as text
081  set ocidFilePathStr to (refMe's NSString's stringWithString:(strFilePath))
082  set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
083  set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
084  ##拡張子をとったファイル名
085  set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
086  set strBaeFileFileName to (ocidBaseFilePathURL's lastPathComponent()) as text
087  ##保存ファイル名
088  set strSaveFileName to (strBaeFileFileName & ".mp4") as text
089  ##保存URL
090  set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName))
091  set strSaveFilePath to ocidSaveFilePathURL's |path| as text
092  (*
093################ ビデオ
094### bitrate
095-vb 720k
096-vb 3600k
097-vb 7200k
098-vb 1080k
099### FPS
100 -r 23.9
101 -r 24
102 -r 30
103 -r 50
104 -r 60
105 -r 120
106###
107 -codec:v  libx264
108 -codec:v  libx265
109 -codec:v  h264_videotoolbox
110###
111-profile:v baseline
112-profile:v main
113-profile:v high
114-profile:v high10
115-profile:v high422
116-profile:v high444
117###
118 -tune film
119 -tune animation
120 -tune grain
121 -tune stillimage
122 -tune fastdecode
123 -tune zerolatency
124###
125 -preset ultrafast
126 -preset superfast
127 -preset veryfast
128 -preset faster
129 -preset fast
130 -preset medium
131 -preset slow
132 -preset slower
133 -preset veryslow
134###
135 -crf 0
136 -crf 22
137 -crf 28
138 -crf 63
139### Pillarbox
140-vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black"
141### crop
142-vf "scale=1280:720:force_original_aspect_ratio=increase, crop=1280:720"
143### 幅合わせ  高自動 
144-vf "scale=1280:-2"
145###高さ合わせ 幅自動
146-vf "scale=-2:720"
147################ オーディオ
148###
149-codec:a  copy
150-codec:a  aac
151-codec:a  aac_at
152-codec:a  libfdk_aac
153-codec:a  libmp3lame
154### ビットレート bitrates
155-b:a 32k
156-b:a 96k
157-b:a 128k
158-b:a 256k
159-b:a 320k
160-b:a 512k
161###サンプルレート Samplerate
162-r:a 16K
163-r:a 22050
164-r:a 32K
165-r:a  44100
166-r:a 48K
167-r:a 96K
168-r:a 192K
169###
170-codec:a  libmp3lame  -ar 48K -ab 320k
171-codec:a  aac  -ar 32K -ab 128k -aac_coder twoloop
172
173    *)
174  
175  set strCommandText to ("\"" & ocidBinFilePath & "\" -i \"" & strFilePath & "\"  -codec:v copy -codec:a copy  -movflags +faststart -video_track_timescale 1000 \"" & strSaveFilePath & "\"") as text
176  
177  tell application "Terminal"
178    activate
179    set objWindowID to (do script "\n\n")
180    delay 1
181    do script strCommandText in objWindowID
182  end tell
183  delay 3
184  set listTime to {0, 0, 0} as list
185  set numInterval to 10 as integer
186  repeat
187    tell application "Terminal"
188      tell front window
189        tell front tab
190          set boolBusy to busy as boolean
191        end tell
192      end tell
193    end tell
194    if boolBusy is true then
195      ###スタートタイム
196      set strStartTime to doHMSms(listTime)
197      log "経過時間: " & strStartTime
198      delay numInterval
199      
200      ##まず秒が加算されるといくつになるか?
201      set numChkDigUp to (item 3 of listTime) + numInterval
202      ###↑この結果が59より大きければ繰り上がる
203      if numChkDigUp ≥ 60 then
204        set (item 3 of listTime) to numChkDigUp - 60
205        if (item 2 of listTime) = 59 then
206          set (item 2 of listTime) to 0
207          ####修正箇所
208          ####  set (item 1 of listTime) to (item 1 of listTime) + 1
209          set (item 1 of listTime) to (item 1 of listTime)
210        else
211          set (item 2 of listTime) to (item 2 of listTime) + 1
212        end if
213      else
214        set (item 3 of listTime) to (item 3 of listTime) + numInterval
215      end if
216      
217      ####エンドタイム
218      set strEndTime to doHMSms(listTime)
219      log strEndTime
220      
221    else if boolBusy is false then
222      exit repeat
223    end if
224  end repeat
225  
226  
227end repeat
228
229###################################
230###保存先を開く
231###################################
232set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
233set boolDone to appSharedWorkspace's openURL:(ocidSaveDirPathURL)
234if boolDone is false then
235  set aliasFilePathURL to (ocidSaveDirPathURL's absoluteURL()) as alias
236  set boolResults to (appShardWorkspace's openURL:ocidCloudStorageDirURL)
237  if boolResults is false then
238    tell application "Finder"
239      make new Finder window to aliasFilePathURL
240    end tell
241  end if
242end if
243
244################################
245##経過時間計算
246on doHMSms(listTime)
247  set strH to item 1 of listTime
248  set strM to item 2 of listTime
249  set strS to item 3 of listTime
250  return doPadding2Dig(strH) & ":" & doPadding2Dig(strM) & ":" & doPadding2Dig(strS)
251end doHMSms
252
253###2桁ゼロサプレス
254on doPadding2Dig(numNO)
255  set strNO to ("0" & numNO) as text
256  return text -2 thru -1 of strNO
257end doPadding2Dig
258
259
260###3桁逆ゼロサブレス
261on doAfterPadding3Dig(numNO)
262  set strNO to (numNO & "00") as text
263  return text 1 thru 3 of strNO
264end doAfterPadding3Dig
265
266################################
267# 日付 doGetDateNo(argDateFormat,argCalendarNO)
268# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
269# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
270################################
271to doGetDateNo({argDateFormat, argCalendarNO})
272  ##渡された値をテキストで確定させて
273  set strDateFormat to argDateFormat as text
274  set intCalendarNO to argCalendarNO as integer
275  ###日付情報の取得
276  set ocidDate to current application's NSDate's |date|()
277  ###日付のフォーマットを定義(日本語)
278  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
279  ###和暦 西暦 カレンダー分岐
280  if intCalendarNO = 1 then
281    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
282  else if intCalendarNO = 2 then
283    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
284  else
285    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
286  end if
287  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
288  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
289  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
290  ###設定
291  ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
292  ocidFormatterJP's setLocale:(ocidLocaleJP)
293  ocidFormatterJP's setCalendar:(ocidCalendarJP)
294  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
295  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
296  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
297  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
298  ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
299  ###渡された値でフォーマット定義
300  ocidFormatterJP's setDateFormat:(strDateFormat)
301  ###フォーマット適応
302  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
303  ###テキストで戻す
304  set strDateAndTime to ocidDateAndTime as text
305  return strDateAndTime
306end doGetDateNo
307
308###################################
309###ARM用にMakeされたFFMPEGをインストール
310###################################
311to doGetFFMPEG()
312  
313  #インストールURL
314  set strZip1 to ("https://ffmpeg.martin-riedl.de/download/macos/arm64/1728231167_7.1/ffmpeg.zip") as text
315  set strZip2 to ("https://ffmpeg.martin-riedl.de/download/macos/arm64/1728231167_7.1/ffprobe.zip") as text
316  set strZip3 to ("https://ffmpeg.martin-riedl.de/download/macos/arm64/1728231167_7.1/ffplay.zip") as text
317  ########################
318  #ダウンロード起動時に削除
319  set appFileManager to refMe's NSFileManager's defaultManager()
320  set ocidTempDirURL to appFileManager's temporaryDirectory()
321  set ocidUUID to refMe's NSUUID's alloc()'s init()
322  set ocidUUIDString to ocidUUID's UUIDString
323  set ocidSaveDirPathURL to ocidTempDirURL's URLByAppendingPathComponent:(ocidUUIDString) isDirectory:true
324  #ダウンロード用フォルダ
325  set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
326  ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions)
327  set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
328  #パス
329  set ocidSaveZip1PathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:("ffmpeg.zip") isDirectory:(false)
330  set ocidSaveZip2PathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:("ffprobe.zip") isDirectory:(false)
331  set ocidSaveZip3PathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:("ffplay.zip") isDirectory:(false)
332  set strSaveZip1Path to ocidSaveZip1PathURL's |path|() as text
333  set strSaveZip2Path to ocidSaveZip2PathURL's |path|() as text
334  set strSaveZip3Path to ocidSaveZip3PathURL's |path|() as text
335  ########################
336  #インストール先
337  set appFileManager to refMe's NSFileManager's defaultManager()
338  set ocidHomeDirURL to appFileManager's homeDirectoryForCurrentUser()
339  set ocidDistDirPathURL to ocidHomeDirURL's URLByAppendingPathComponent:("bin/ffmpeg7.1") isDirectory:(true)
340  ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
341  set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidDistDirPathURL) withIntermediateDirectories:(true) attributes:(ocidAttrDict) |error| :(reference)
342  set ocidFFmpegPathURL to ocidDistDirPathURL's URLByAppendingPathComponent:("ffmpeg") isDirectory:(false)
343  set ocidFFprobePathURL to ocidDistDirPathURL's URLByAppendingPathComponent:("ffprobe") isDirectory:(false)
344  set ocidFFplayPathURL to ocidDistDirPathURL's URLByAppendingPathComponent:("ffplay") isDirectory:(false)
345  set strFFmpegPath to ocidFFmpegPathURL's |path|() as text
346  set strFFprobePath to ocidFFprobePathURL's |path|() as text
347  set strFFplayPath to ocidFFplayPathURL's |path|() as text
348  set strDistDirPath to ocidDistDirPathURL's |path|() as text
349  ########################
350  #ダウンロード 1
351  try
352    set strCommandText to ("/usr/bin/curl -L \"" & strZip1 & "\" -o \"" & strSaveZip1Path & "\" --connect-timeout 20") as text
353    set strExec to ("/bin/zsh -c '" & strCommandText & "'")
354    do shell script strExec
355  on error
356    return false
357  end try
358  try
359    set strCommandText to ("/usr/bin/curl -L \"" & strZip2 & "\" -o \"" & strSaveZip2Path & "\" --connect-timeout 20") as text
360    set strExec to ("/bin/zsh -c '" & strCommandText & "'")
361    do shell script strExec
362  on error
363    return false
364  end try
365  try
366    set strCommandText to ("/usr/bin/curl -L \"" & strZip3 & "\" -o \"" & strSaveZip3Path & "\" --connect-timeout 20") as text
367    set strExec to ("/bin/zsh -c '" & strCommandText & "'")
368    do shell script strExec
369  on error
370    return false
371  end try
372  
373  ########################
374  #解凍
375  try
376    set strCommandText to ("/usr/bin/unzip  \"" & strSaveZip1Path & "\" -d \"" & strDistDirPath & "\"") as text
377    set strExec to ("/bin/zsh -c '" & strCommandText & "'")
378    do shell script strExec
379  on error
380    return false
381  end try
382  #解凍
383  try
384    set strCommandText to ("/usr/bin/unzip  \"" & strSaveZip2Path & "\" -d \"" & strDistDirPath & "\"") as text
385    set strExec to ("/bin/zsh -c '" & strCommandText & "'")
386    do shell script strExec
387  on error
388    return false
389  end try
390  #解凍
391  try
392    set strCommandText to ("/usr/bin/unzip  \"" & strSaveZip3Path & "\" -d \"" & strDistDirPath & "\"") as text
393    set strExec to ("/bin/zsh -c '" & strCommandText & "'")
394    do shell script strExec
395  on error
396    return false
397  end try
398  return true
399  
400end doGetFFMPEG
AppleScriptで生成しました

|

背景透過のムービーを作成する

準備
1:ffmpegのインストール
2:DaVinci Resolveのインストール
3:Switchのインストール
4:素材の用意
5:ビデオ作成
6:書き出し
7:webpへ変換



1:ffmpegのインストール
webpに変換するのに使います
オフィシャル(インテル版のみ)
https://evermeet.cx/ffmpeg/

martin-riedl.de(Arm インストールパッケージあり)非オフィシャル
https://ffmpeg.martin-riedl.de

osxexperts.net(バイナリーのみ)非オフィシャル
https://www.osxexperts.net

インストールパッケージになっているmartin-riedl.deがいいでしょう


2:DaVinci Resolveのインストール
DaVinci Resolveの無料版をダウンロードインストールしておきます
https://www.blackmagicdesign.com/support/family/davinci-resolve-and-fusion


3:Switchのインストール
Switch 無料でも利用可能です
透過ビデオの他 5.1ch再生時の音声の選択等
他のプレーヤーではできない事が色々できます。
無くても大丈夫ですが、proress4444の透過ビデオの透過確認に便利です
202411121145561_470x412

https://www.telestream.net/switch/overview.htm


4:素材の用意
透過PNGを使ったり
クロマキーを使ったりして
透過の素材を用意します。


5:ビデオ作成
背景の透過ぐあいの確認がしにくいですが
普通にタイムラインで編集でOKです


6:書き出し
ProRess4444のQuickTimeで書き出します
『アルファを書き出し』にチェックを忘れずに
202411121127011_430x453

音声は最終的にwebpになりますから
この時点である程度どのエンコードを使うか決め打ちしておくといいです

書き出したMOVファイルは
Switchを使って確認 透過が効いている事を確認しておくといいです


7:webpへ変換
ffmpegコマンドを使って
透過のあるProRes4444のQuickTimeムービーを
透過ありのvp9のWEBMに変換します。



スクリプト

ダウンロード - webm20transparent20video.zip



出来上がりイメージ 背景白
WEBM Transparent Video

出来上がりイメージ 背景赤

WEBM Transparent Video



AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004# リサイズ設定無し エンコード同じでmp4に
005#com.cocolog-nifty.quicktimer.icefloe
006----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
007use AppleScript version "2.8"
008use framework "Foundation"
009use framework "AppKit"
010use scripting additions
011property refMe : a reference to current application
012set appFileManager to refMe's NSFileManager's defaultManager()
013
014################################
015####設定項目
016################################
017#一般的にはこちら
018set strBinFilePath to ("/usr/local/bin/ffmpeg") as text
019
020
021################################
022####BINPATH  ffmpegのパス
023################################
024set ocidBinFilePathStr to refMe's NSString's stringWithString:(strBinFilePath)
025set ocidBinFilePath to ocidBinFilePathStr's stringByStandardizingPath()
026set ocidBinFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidBinFilePath) isDirectory:false)
027set strBinFilePath to (ocidBinFilePathURL's |path|()) as text
028
029
030################################
031#####ダイアログを前面に
032################################
033tell current application
034  set strName to name as text
035end tell
036if strName is "osascript" then
037  tell application "Finder" to activate
038else
039  tell current application to activate
040end if
041set aliasFilePath to (choose file "ファイルを選んでください" with prompt "ファイルを選んでください" default location (path to desktop folder from user domain) of type {"com.apple.quicktime-movie", "public.movie", "public.item"} with invisibles and showing package contents without multiple selections allowed) as alias
042
043
044set aliasFile to aliasFilePath as alias
045set strFilePath to (POSIX path of aliasFile) as text
046set ocidFilePathStr to (refMe's NSString's stringWithString:(strFilePath))
047set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
048set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
049set strFileName to ocidFilePathURL's lastPathComponent() as text
050##拡張子をとったファイル名
051set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
052set strBaeFileFileName to (ocidBaseFilePathURL's lastPathComponent()) as text
053
054##################
055#書き出し先パス
056set appFileManager to refMe's NSFileManager's defaultManager()
057set ocidHomeDirURL to appFileManager's homeDirectoryForCurrentUser()
058set strDirName to ("Sites/Movies/" & strBaeFileFileName) as text
059set ocidSaveDirPathURL to (ocidHomeDirURL's URLByAppendingPathComponent:(strDirName) isDirectory:(true))
060set ocidAttrDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
061(ocidAttrDict's setValue:(493) forKey:(refMe's NSFilePosixPermissions))
062set listBoolMakeDir to (appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference))
063##保存ファイル名
064set strSaveFileName to (strBaeFileFileName & ".webm") as text
065##保存URL
066set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName) isDirectory:(false))
067set strSaveFilePath to ocidSaveFilePathURL's |path| as text
068##コピーMOV
069set ocidDistFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strFileName) isDirectory:(false))
070set appFileManager to refMe's NSFileManager's defaultManager()
071set ListDone to (appFileManager's copyItemAtURL:(ocidFilePathURL) toURL:(ocidDistFilePathURL) |error| :(reference))
072
073
074
075(*
076################ ビデオ
077### bitrate
078-vb 720k
079-vb 3600k
080-vb 7200k
081-vb 1080k
082### FPS
083 -r 23.9
084 -r 24
085 -r 30
086 -r 50
087 -r 60
088 -r 120
089###
090 -codec:v  libx264
091 -codec:v  libx265
092 -codec:v  h264_videotoolbox
093###
094-profile:v baseline
095-profile:v main
096-profile:v high
097-profile:v high10
098-profile:v high422
099-profile:v high444
100###
101 -tune film
102 -tune animation
103 -tune grain
104 -tune stillimage
105 -tune fastdecode
106 -tune zerolatency
107###
108 -preset ultrafast
109 -preset superfast
110 -preset veryfast
111 -preset faster
112 -preset fast
113 -preset medium
114 -preset slow
115 -preset slower
116 -preset veryslow
117###
118 -crf 0
119 -crf 22
120 -crf 28
121 -crf 63
122### Pillarbox
123-vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black"
124### crop
125-vf "scale=1280:720:force_original_aspect_ratio=increase, crop=1280:720"
126### 幅合わせ  高自動 
127-vf "scale=1280:-2"
128###高さ合わせ 幅自動
129-vf "scale=-2:720"
130################ オーディオ
131###
132-codec:a  copy
133-codec:a  aac
134-codec:a  aac_at
135-codec:a  libfdk_aac
136-codec:a  libmp3lame
137### ビットレート bitrates
138-b:a 32k
139-b:a 96k
140-b:a 128k
141-b:a 256k
142-b:a 320k
143-b:a 512k
144###サンプルレート Samplerate
145-r:a 16K
146-r:a 22050
147-r:a 32K
148-r:a  44100
149-r:a 48K
150-r:a 96K
151-r:a 192K
152###
153-codec:a  libmp3lame  -ar 48K -ab 320k
154-codec:a  aac  -ar 32K -ab 128k -aac_coder twoloop
155##アルファ関連オプション
156-c:v libvpx-vp9
157
158-pix_fmt yuva420p
159-pix_fmt yuva444p
160-pix_fmt yuva444p10le
161
162-alpha_bits 16
163-auto-alt-ref 0
164
165
166
167    *)
168
169set strCommandText to ("\"" & ocidBinFilePath & "\" -i \"" & strFilePath & "\"  -c:v libvpx-vp9 -pix_fmt yuva444p10le -alpha_bits 16  -auto-alt-ref 0  -codec:a copy \"" & strSaveFilePath & "\"") as text
170
171tell application "Terminal"
172  activate
173  set objWindowID to (do script "\n\n")
174  delay 1
175  do script strCommandText in objWindowID
176end tell
177delay 3
178set listTime to {0, 0, 0} as list
179set numInterval to 10 as integer
180repeat
181  tell application "Terminal"
182    tell front window
183      tell front tab
184        set boolBusy to busy as boolean
185      end tell
186    end tell
187  end tell
188  if boolBusy is true then
189    ###スタートタイム
190    set strStartTime to doHMSms(listTime)
191    log "経過時間: " & strStartTime
192    delay numInterval
193    
194    ##まず秒が加算されるといくつになるか?
195    set numChkDigUp to (item 3 of listTime) + numInterval
196    ###↑この結果が59より大きければ繰り上がる
197    if numChkDigUp ≥ 60 then
198      set (item 3 of listTime) to numChkDigUp - 60
199      if (item 2 of listTime) = 59 then
200        set (item 2 of listTime) to 0
201        ####修正箇所
202        ####  set (item 1 of listTime) to (item 1 of listTime) + 1
203        set (item 1 of listTime) to (item 1 of listTime)
204      else
205        set (item 2 of listTime) to (item 2 of listTime) + 1
206      end if
207    else
208      set (item 3 of listTime) to (item 3 of listTime) + numInterval
209    end if
210    
211    ####エンドタイム
212    set strEndTime to doHMSms(listTime)
213    log strEndTime
214    
215  else if boolBusy is false then
216    exit repeat
217  end if
218end repeat
219
220#透過チェック用のHTM
221set strHTML to ("<!DOCTYPE html><html lang=\"en\"><head><meta charset=utf-8 /><title>HTML5 Video Sample</title><style>body{background: red;}</style></head><body><figure style=\"width: 1280px;margin: 10px;\"><figcaption>MP4 Video</figcaption><video autoplay controls  style=\"width: 1280px;margin: 0px;\"><source src=\"" & strFileName & "\" type=\"video/quicktime\"></source><source src=\"" & strSaveFileName & "\" type=\"video/webm\"></source></video></figure></body></html>")
222set strSaveHTMLFileName to (strBaeFileFileName & ".html") as text
223set ocidSaveHTMLFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveHTMLFileName) isDirectory:(false))
224set ocidHTMLStr to refMe's NSString's stringWithString:(strHTML)
225set ListDone to ocidHTMLStr's writeToURL:(ocidSaveHTMLFilePathURL) atomically:(true) encoding:(refMe's NSUTF8StringEncoding) |error| :(reference)
226
227###################################
228###保存先を開く
229###################################
230set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
231set boolDone to appSharedWorkspace's openURL:(ocidSaveDirPathURL)
232if boolDone is false then
233  set aliasFilePathURL to (ocidSaveDirPathURL's absoluteURL()) as alias
234  set boolResults to (appShardWorkspace's openURL:ocidCloudStorageDirURL)
235  if boolResults is false then
236    tell application "Finder"
237      make new Finder window to aliasFilePathURL
238    end tell
239  end if
240end if
241
242################################
243##経過時間計算
244on doHMSms(listTime)
245  set strH to item 1 of listTime
246  set strM to item 2 of listTime
247  set strS to item 3 of listTime
248  return doPadding2Dig(strH) & ":" & doPadding2Dig(strM) & ":" & doPadding2Dig(strS)
249end doHMSms
250
251###2桁ゼロサプレス
252on doPadding2Dig(numNO)
253  set strNO to ("0" & numNO) as text
254  return text -2 thru -1 of strNO
255end doPadding2Dig
256
257
258###3桁逆ゼロサブレス
259on doAfterPadding3Dig(numNO)
260  set strNO to (numNO & "00") as text
261  return text 1 thru 3 of strNO
262end doAfterPadding3Dig
263
264################################
265# 日付 doGetDateNo(argDateFormat,argCalendarNO)
266# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
267# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
268################################
269to doGetDateNo({argDateFormat, argCalendarNO})
270  ##渡された値をテキストで確定させて
271  set strDateFormat to argDateFormat as text
272  set intCalendarNO to argCalendarNO as integer
273  ###日付情報の取得
274  set ocidDate to current application's NSDate's |date|()
275  ###日付のフォーマットを定義(日本語)
276  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
277  ###和暦 西暦 カレンダー分岐
278  if intCalendarNO = 1 then
279    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
280  else if intCalendarNO = 2 then
281    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
282  else
283    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
284  end if
285  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
286  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
287  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
288  ###設定
289  ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
290  ocidFormatterJP's setLocale:(ocidLocaleJP)
291  ocidFormatterJP's setCalendar:(ocidCalendarJP)
292  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
293  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
294  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
295  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
296  ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
297  ###渡された値でフォーマット定義
298  ocidFormatterJP's setDateFormat:(strDateFormat)
299  ###フォーマット適応
300  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
301  ###テキストで戻す
302  set strDateAndTime to ocidDateAndTime as text
303  return strDateAndTime
304end doGetDateNo
AppleScriptで生成しました

|

[ffmpeg]MKVから字幕データを取り出す


AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004# MKV等からの字幕データ取り出し用
005#
006#com.cocolog-nifty.quicktimer.icefloe
007----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
008##自分環境がos12なので2.8にしているだけです
009use AppleScript version "2.8"
010use framework "Foundation"
011use framework "AppKit"
012use scripting additions
013
014property refMe : a reference to current application
015set appFileManager to refMe's NSFileManager's defaultManager()
016
017##ffprobeのパス
018#set strBinPathProbe to ("/usr/local/bin/ffmpeg/ffprobe") as text
019set strBinPathProbe to ("~/bin/ffmpeg7.1/ffprobe") as text
020
021##~を正規化
022set ocidBinPathStr to refMe's NSString's stringWithString:(strBinPathProbe)
023set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
024set strBinPathProbe to (ocidBinPath) as text
025
026##ffmpegのパス
027#set strBinPathFfmpeg to ("/usr/local/bin/ffmpeg/ffmpeg") as text
028set strBinPathFfmpeg to ("~/bin/ffmpeg7.1/ffmpeg") as text
029
030##~を正規化
031set ocidBinPathStr to refMe's NSString's stringWithString:(strBinPathFfmpeg)
032set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
033set strBinPathFfmpeg to (ocidBinPath) as text
034
035
036#############################
037#ファイル
038set strName to (name of current application) as text
039if strName is "osascript" then
040  tell application "Finder" to activate
041else
042  tell current application to activate
043end if
044#
045set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
046set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
047set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
048#
049set listUTI to {"org.matroska.mkv"}
050set strMes to ("ファイルを選んでください") as text
051set strPrompt to ("ファイルを選んでください") as text
052try
053  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
054on error
055  log "エラーしました"
056  return "エラーしました"
057end try
058##入力ファイルパス
059set strFilePath to (POSIX path of aliasFilePath) as text
060set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
061set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
062set strFilePath to (ocidFilePath) as text
063set ocidBaseFilePath to ocidFilePath's stringByDeletingPathExtension()
064################################
065#コマンドライン整形
066set strCommandText to ("\"" & strBinPathProbe & "\" -i  \"" & strFilePath & "\" -v error -show_streams -output_format json") as text
067set strExecCommand to ("/bin/zsh -c '" & strCommandText & "'") as text
068log "\r" & strCommandText & "\r"
069try
070  set strResponse to (do shell script strExecCommand) as text
071end try
072#
073set ocidString to refMe's NSString's stringWithString:(strResponse)
074
075################################
076#ID格納用
077set ocidIndexIDDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
078
079#戻り値を整形
080set ocidReadData to ocidString's dataUsingEncoding:(refMe's NSUTF8StringEncoding)
081#JSONをDICTに
082set ocidOption to (refMe's NSJSONReadingMutableContainers)
083set listJSONSerialization to (refMe's NSJSONSerialization's JSONObjectWithData:(ocidReadData) options:(ocidOption) |error| :(reference))
084set ocidPlistDict to item 1 of listJSONSerialization
085#各種値をダイアログ用のテキストに入れていく
086set ocidRootArray to ocidPlistDict's objectForKey:("streams")
087repeat with itemDict in ocidRootArray
088  set strIndexNo to (itemDict's valueForKey:("index")) as text
089  set ocidTypeStr to (itemDict's valueForKey:("codec_type"))
090  set ocidTagDict to (itemDict's objectForKey:("tags"))
091  if (ocidTypeStr as text) is "subtitle" then
092    set ocidLangStr to (ocidTagDict's valueForKey:("language"))
093    log ocidLangStr as text
094    (ocidIndexIDDict's setValue:(ocidLangStr) forKey:(strIndexNo))
095  end if
096end repeat
097################################
098#
099set ocidAllKeys to ocidIndexIDDict's allKeys()
100repeat with itemIndex in ocidAllKeys
101  set strIndex to itemIndex as text
102  set strLang to (ocidIndexIDDict's valueForKey:(strIndex)) as text
103  ##PLIST保存用のパス 
104  set strExtension to (strIndex & "-" & strLang & "-字幕.srt") as text
105  set ocidSaveFilePath to (ocidBaseFilePath's stringByAppendingPathExtension:(strExtension))
106  set strSaveFilePath to ocidSaveFilePath as text
107  #コマンドライン整形
108  set strCommandText to ("\"" & strBinPathFfmpeg & "\" -i  \"" & strFilePath & "\" -map 0:" & strIndex & " \"" & strSaveFilePath & "\"") as text
109  set strExecCommand to ("/bin/zsh -c '" & strCommandText & "'") as text
110  log "\r" & strCommandText & "\r"
111  try
112    set strResponse to (do shell script strExecCommand) as text
113  end try
114  
115end repeat
116
117
118
119return 0
AppleScriptで生成しました

|

[ffprobe]ffprobeで必要な情報を取得する

mkvの字幕情報が必要だったので

AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#
005#
006#com.cocolog-nifty.quicktimer.icefloe
007----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
008##自分環境がos12なので2.8にしているだけです
009use AppleScript version "2.8"
010use framework "Foundation"
011use framework "AppKit"
012use scripting additions
013
014property refMe : a reference to current application
015set appFileManager to refMe's NSFileManager's defaultManager()
016
017##ffprobeのパス
018set strBinPath to ("/usr/local/bin/ffmpeg/ffprobe") as text
019#set strBinPath to ("~/bin/ffmpeg7.1/ffprobe") as text
020##~を正規化
021set ocidBinPathStr to refMe's NSString's stringWithString:(strBinPath)
022set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
023set strBinPath to (ocidBinPath) as text
024
025#############################
026#ファイル
027set strName to (name of current application) as text
028if strName is "osascript" then
029  tell application "Finder" to activate
030else
031  tell current application to activate
032end if
033#
034set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
035set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
036set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
037#
038set listUTI to {"public.data"}
039set strMes to ("ファイルを選んでください") as text
040set strPrompt to ("ファイルを選んでください") as text
041try
042  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
043on error
044  log "エラーしました"
045  return "エラーしました"
046end try
047##入力ファイルパス
048set strFilePath to (POSIX path of aliasFilePath) as text
049set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
050set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
051set strFilePath to (ocidFilePath) as text
052##PLIST保存用のパス 
053set ocidBaseFilePath to ocidFilePath's stringByDeletingPathExtension()
054set ocidPlistFilePath to ocidBaseFilePath's stringByAppendingPathExtension:("情報.plist")
055set ocidPlistFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidPlistFilePath) isDirectory:false)
056#コマンドライン整形
057set strCommandText to ("\"" & strBinPath & "\" -i  \"" & strFilePath & "\" -v error -show_streams -output_format json") as text
058set strExecCommand to ("/bin/zsh -c '" & strCommandText & "'") as text
059log "\r" & strCommandText & "\r"
060try
061  set strResponse to (do shell script strExecCommand) as text
062end try
063
064##ダイアログに戻す用のテキスト
065set ocidOutPutString to refMe's NSMutableString's alloc()'s initWithCapacity:(0)
066ocidOutPutString's appendString:(strFilePath)
067ocidOutPutString's appendString:("\n")
068ocidOutPutString's appendString:("------------")
069ocidOutPutString's appendString:("\n")
070set ocidString to refMe's NSString's stringWithString:(strResponse)
071#戻り値を整形
072set ocidReadData to ocidString's dataUsingEncoding:(refMe's NSUTF8StringEncoding)
073#JSONをDICTに
074set ocidOption to (refMe's NSJSONReadingMutableContainers)
075set listJSONSerialization to (refMe's NSJSONSerialization's JSONObjectWithData:(ocidReadData) options:(ocidOption) |error| :(reference))
076set ocidPlistDict to item 1 of listJSONSerialization
077#各種値をダイアログ用のテキストに入れていく
078set ocidRootArray to ocidPlistDict's objectForKey:("streams")
079repeat with itemDict in ocidRootArray
080  set ocidIndexNo to (itemDict's valueForKey:("index"))
081  (ocidOutPutString's appendString:(ocidIndexNo as text))
082  (ocidOutPutString's appendString:("\n"))
083  set ocidTypeStr to (itemDict's valueForKey:("codec_type"))
084  (ocidOutPutString's appendString:(ocidTypeStr))
085  (ocidOutPutString's appendString:("\n"))
086  set ocidTagDict to (itemDict's objectForKey:("tags"))
087  #
088  if (ocidTypeStr as text) is "video" then
089    set ocidWidthNo to (itemDict's valueForKey:("width"))
090    (ocidOutPutString's appendString:(ocidWidthNo as text))
091    (ocidOutPutString's appendString:("\n"))
092    set ocidHeightNO to (itemDict's valueForKey:("height"))
093    (ocidOutPutString's appendString:(ocidHeightNO as text))
094    (ocidOutPutString's appendString:("\n"))
095    set ocidDurationStr to (ocidTagDict's valueForKey:("DURATION"))
096    if ocidDurationStr ≠ (missing value) then
097      (ocidOutPutString's appendString:(ocidDurationStr))
098    end if
099    (ocidOutPutString's appendString:("\n"))
100    set ocidFpsStr to (itemDict's valueForKey:("avg_frame_rate"))
101    set appExp to (refMe's NSExpression's expressionWithFormat:(ocidFpsStr))
102    set ocidRes to (appExp's expressionValueWithObject:(missing value) context:(missing value))
103    (ocidOutPutString's appendString:(ocidRes as text))
104    (ocidOutPutString's appendString:("\n"))
105  else if (ocidTypeStr as text) is "audio" then
106    set ocidRateStr to (itemDict's valueForKey:("sample_rate"))
107    (ocidOutPutString's appendString:(ocidRateStr))
108    (ocidOutPutString's appendString:("\n"))
109    set ocidChannelStr to (itemDict's valueForKey:("channel_layout"))
110    (ocidOutPutString's appendString:(ocidChannelStr))
111    (ocidOutPutString's appendString:("\n"))
112    set ocidLangAvStr to (ocidTagDict's valueForKey:("language"))
113    (ocidOutPutString's appendString:(ocidLangAvStr))
114    (ocidOutPutString's appendString:("\n"))
115  else if (ocidTypeStr as text) is "subtitle" then
116    set ocidLangStr to (ocidTagDict's valueForKey:("language"))
117    (ocidOutPutString's appendString:(ocidLangStr))
118    (ocidOutPutString's appendString:("\n"))
119  end if
120  set ocidCodecStr to (itemDict's valueForKey:("codec_long_name"))
121  (ocidOutPutString's appendString:(ocidCodecStr))
122  (ocidOutPutString's appendString:("\n"))
123  (ocidOutPutString's appendString:("------------"))
124  (ocidOutPutString's appendString:("\n"))
125end repeat
126
127
128
129
130
131##############################
132#####ダイアログ
133##############################
134tell current application
135  set strName to name as text
136end tell
137####スクリプトメニューから実行したら
138if strName is "osascript" then
139  tell application "Finder"
140    activate
141  end tell
142else
143  tell current application
144    activate
145  end tell
146end if
147set aliasIconPath to (POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/SidebarMoviesFolder.icns") as alias
148try
149  set recordResult to (display dialog "戻り値です" with title "戻り値です" default answer (ocidOutPutString as text) buttons {"クリップボードにコピー", "終了", "PLIST保存"} default button "PLIST保存" cancel button "終了" giving up after 20 with icon aliasIconPath without hidden answer) as record
150on error
151  return "エラーしました"
152end try
153if (gave up of recordResult) is true then
154  return "時間切れです"
155end if
156##############################
157#####PLIST保存
158##############################
159if button returned of recordResult is "PLIST保存" then
160  #保存
161  #DICTをPLISTに変換
162  set ocidFormat to (refMe's NSPropertyListBinaryFormat_v1_0)
163  set listResponse to refMe's NSPropertyListSerialization's dataWithPropertyList:(ocidPlistDict) format:(ocidFormat) options:0  |error| :(reference)
164  if (item 2 of listResponse) = (missing value) then
165    set ocidPlistData to (item 1 of listResponse)
166  else if (item 2 of listResponse) ≠ (missing value) then
167    set strErrorNO to (item 2 of listResponse)'s code() as text
168    set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
169    refMe's NSLog("■:" & strErrorNO & strErrorMes)
170    return "エラーしました" & strErrorNO & strErrorMes
171  end if
172  #保存 PLIST不要な場合は削除でいい
173  set ocidOption to (refMe's NSDataWritingAtomic)
174  set listDone to ocidPlistData's writeToURL:(ocidPlistFilePathURL) options:(ocidOption) |error| :(reference)
175  if (item 1 of listDone) is true then
176    log "正常終了"
177  else if (item 1 of listDone) is false then
178    set strErrorNO to (item 2 of listResponse)'s code() as text
179    set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
180    refMe's NSLog("■:" & strErrorNO & strErrorMes)
181    return "エラーしました" & strErrorNO & strErrorMes
182  end if
183  #読み込んだDICTの内容をクリア
184  set ocidPlistDict to (missing value)
185end if
186##############################
187#####値のコピー
188##############################
189if button returned of recordResult is "クリップボードにコピー" then
190  try
191    set strText to text returned of recordResult as text
192    ####ペーストボード宣言
193    set appPasteboard to refMe's NSPasteboard's generalPasteboard()
194    set ocidText to (refMe's NSString's stringWithString:(strText))
195    appPasteboard's clearContents()
196    appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString)
197  on error
198    tell application "Finder"
199      set the clipboard to strText as text
200    end tell
201  end try
202end if
203
204
205return 0
AppleScriptで生成しました

|

[ffmpeg]ビデオファイルとオーディオファイルを結合


AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004# リサイズ設定無し エンコード同じでmp4に
005#com.cocolog-nifty.quicktimer.icefloe
006----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
007use AppleScript version "2.8"
008use framework "Foundation"
009use framework "AppKit"
010use scripting additions
011property refMe : a reference to current application
012set appFileManager to refMe's NSFileManager's defaultManager()
013
014################################
015####設定項目
016################################
017#一般的にはこちら
018#set strFilePath to ("/usr/local/bin/ffmpeg") as text
019#
020set strBinFilePath to "~/bin/ffmpeg7/ffmpeg" as text
021
022################################
023####BINPATH  ffmpegのパス
024################################
025set ocidBinFilePathStr to refMe's NSString's stringWithString:(strBinFilePath)
026set ocidBinFilePath to ocidBinFilePathStr's stringByStandardizingPath()
027set ocidBinFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidBinFilePath) isDirectory:false)
028set strBinFilePath to (ocidBinFilePathURL's |path|()) as text
029
030################################
031#####書き出し先パス Moviesフォルダ内へ
032################################
033set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSMoviesDirectory) inDomains:(refMe's NSUserDomainMask))
034set ocidMoviesDirPathURL to ocidURLsArray's firstObject()
035set ocidSaveDirPathURL to (ocidMoviesDirPathURL's URLByAppendingPathComponent:("_FFMPEG書出"))
036##
037set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
038# 777-->511 755-->493 700-->448 766-->502
039ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
040set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
041################################
042#####ダイアログを前面に
043################################
044tell current application
045  set strName to name as text
046end tell
047if strName is "osascript" then
048  tell application "Finder" to activate
049else
050  tell current application to activate
051end if
052set aliasVideoFile to (choose file "【ビデオ】ファイルを選んでください" with prompt "【ビデオ】ファイルを選んでください" default location (path to desktop folder from user domain) of type {"com.apple.quicktime-movie", "public.movie", "public.item"} without invisibles, showing package contents and multiple selections allowed) as alias
053
054tell application "Finder"
055  
056  set aliasContainerDirPath to (container of aliasVideoFile) as alias
057end tell
058
059
060set aliasAudioFile to (choose file "【オーディオ】ファイルを選んでください" with prompt "【オーディオ】ファイルを選んでください" default location (aliasContainerDirPath) of type {"public.audio", "public.item"} without invisibles, showing package contents and multiple selections allowed) as alias
061set strAudioFilePath to (POSIX path of aliasAudioFile) as text
062
063set strFilePath to (POSIX path of aliasVideoFile) as text
064set ocidFilePathStr to (refMe's NSString's stringWithString:(strFilePath))
065set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
066set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
067##拡張子をとったファイル名
068set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
069set strBaeFileFileName to (ocidBaseFilePathURL's lastPathComponent()) as text
070##保存ファイル名
071set strSaveFileName to (strBaeFileFileName & ".mp4") as text
072##保存URL
073set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName))
074set strSaveFilePath to ocidSaveFilePathURL's |path| as text
075(*
076################ ビデオ
077### bitrate
078-vb 720k
079-vb 3600k
080-vb 7200k
081-vb 1080k
082### FPS
083 -r 23.9
084 -r 24
085 -r 30
086 -r 50
087 -r 60
088 -r 120
089###
090 -codec:v  libx264
091 -codec:v  libx265
092 -codec:v  h264_videotoolbox
093###
094-profile:v baseline
095-profile:v main
096-profile:v high
097-profile:v high10
098-profile:v high422
099-profile:v high444
100###
101 -tune film
102 -tune animation
103 -tune grain
104 -tune stillimage
105 -tune fastdecode
106 -tune zerolatency
107###
108 -preset ultrafast
109 -preset superfast
110 -preset veryfast
111 -preset faster
112 -preset fast
113 -preset medium
114 -preset slow
115 -preset slower
116 -preset veryslow
117###
118 -crf 0
119 -crf 22
120 -crf 28
121 -crf 63
122### Pillarbox
123-vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black"
124### crop
125-vf "scale=1280:720:force_original_aspect_ratio=increase, crop=1280:720"
126### 幅合わせ  高自動 
127-vf "scale=1280:-2"
128###高さ合わせ 幅自動
129-vf "scale=-2:720"
130################ オーディオ
131###
132-codec:a  copy
133-codec:a  aac
134-codec:a  aac_at
135-codec:a  libfdk_aac
136-codec:a  libmp3lame
137### ビットレート bitrates
138-b:a 32k
139-b:a 96k
140-b:a 128k
141-b:a 256k
142-b:a 320k
143-b:a 512k
144###サンプルレート Samplerate
145-r:a 16K
146-r:a 22050
147-r:a 32K
148-r:a  44100
149-r:a 48K
150-r:a 96K
151-r:a 192K
152###
153-codec:a  libmp3lame  -ar 48K -ab 320k
154-codec:a  aac  -ar 32K -ab 128k -aac_coder twoloop
155
156set strCommandText to ("\"" & strBinFilePath & "\" -i \"" & strFilePath & "\"  -codec:v  libx264 -profile:v baseline    -tune film  -crf 28 -codec:a  aac  -r:a 44100  -b:a 320k \"" & strSaveFilePath & "\"") as text
157  
158set strCommandText to ("\"" & strBinFilePath & "\" -i \"" & strFilePath & "\"  -codec:v  libx264  -crf 24 -codec:a  aac  -r:a 44100  -b:a 160 \"" & strSaveFilePath & "\"") as text
159  
160set strCommandText to ("\"" & strBinFilePath & "\" -i '" & strFilePath & "'  -codec:v  libx264 -profile:v baseline    -tune film  -crf 28 -codec:a  aac  -r:a 44100  -b:a 320k '" & strSaveFilePath & "'") as text
161  set strCommandText to ("\"" & strBinFilePath & "\" -i \"" & strFilePath & "\" -map 0 -codec:v libx264 -profile:v baseline -tune film -crf 28 -codec:a aac -r:a 44100 -b:a 320k \"" & strSaveFilePath & "\"") as text
162  
163  set strCommandText to ("\"" & strBinFilePath & "\" -i \"" & strFilePath & "\"  \"" & strSaveFilePath & "\"") as text
164  
165  
166  set strCommandText to ("\"" & strBinFilePath & "\" -i \"" & strFilePath & "\"  -codec:v libx264 -r:v 24  -b:v 64k -codec:a aac -r:a 44100 -b:a 320k  \"" & strSaveFilePath & "\"") as text
167    *)
168
169#set strCommandText to ("\"" & ocidBinFilePath & "\" -i \"" & strFilePath & "\"  -codec:v copy -codec:a copy \"" & strSaveFilePath & "\"") as text
170
171set strCommandText to ("\"" & ocidBinFilePath & "\" -i \"" & strFilePath & "\"  -i \"" & strAudioFilePath & "\" -codec:v copy -codec:a copy -strict experimental -map 0:v:0 -map 1:a:0 \"" & strSaveFilePath & "\"") as text
172
173#ffmpeg -i "$video_path" -i "$audio_path" -c:v copy -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 output.mp4
174
175
176tell application "Terminal"
177  activate
178  set objWindowID to (do script "\n\n")
179  delay 1
180  do script strCommandText in objWindowID
181end tell
182delay 3
183set listTime to {0, 0, 0} as list
184set numInterval to 10 as integer
185repeat
186  tell application "Terminal"
187    tell front window
188      tell front tab
189        set boolBusy to busy as boolean
190      end tell
191    end tell
192  end tell
193  if boolBusy is true then
194    ###スタートタイム
195    set strStartTime to doHMSms(listTime)
196    log "経過時間: " & strStartTime
197    delay numInterval
198    
199    ##まず秒が加算されるといくつになるか?
200    set numChkDigUp to (item 3 of listTime) + numInterval
201    ###↑この結果が59より大きければ繰り上がる
202    if numChkDigUp ≥ 60 then
203      set (item 3 of listTime) to numChkDigUp - 60
204      if (item 2 of listTime) = 59 then
205        set (item 2 of listTime) to 0
206        ####修正箇所
207        ####  set (item 1 of listTime) to (item 1 of listTime) + 1
208        set (item 1 of listTime) to (item 1 of listTime)
209      else
210        set (item 2 of listTime) to (item 2 of listTime) + 1
211      end if
212    else
213      set (item 3 of listTime) to (item 3 of listTime) + numInterval
214    end if
215    
216    ####エンドタイム
217    set strEndTime to doHMSms(listTime)
218    log strEndTime
219    
220  else if boolBusy is false then
221    exit repeat
222  end if
223end repeat
224
225###################################
226###保存先を開く
227###################################
228set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
229set boolDone to appSharedWorkspace's openURL:(ocidSaveDirPathURL)
230if boolDone is false then
231  set aliasFilePathURL to (ocidSaveDirPathURL's absoluteURL()) as alias
232  set boolResults to (appShardWorkspace's openURL:ocidCloudStorageDirURL)
233  if boolResults is false then
234    tell application "Finder"
235      make new Finder window to aliasFilePathURL
236    end tell
237  end if
238end if
239
240################################
241##経過時間計算
242on doHMSms(listTime)
243  set strH to item 1 of listTime
244  set strM to item 2 of listTime
245  set strS to item 3 of listTime
246  return doPadding2Dig(strH) & ":" & doPadding2Dig(strM) & ":" & doPadding2Dig(strS)
247end doHMSms
248
249###2桁ゼロサプレス
250on doPadding2Dig(numNO)
251  set strNO to ("0" & numNO) as text
252  return text -2 thru -1 of strNO
253end doPadding2Dig
254
255
256###3桁逆ゼロサブレス
257on doAfterPadding3Dig(numNO)
258  set strNO to (numNO & "00") as text
259  return text 1 thru 3 of strNO
260end doAfterPadding3Dig
261
262################################
263# 日付 doGetDateNo(argDateFormat,argCalendarNO)
264# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
265# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
266################################
267to doGetDateNo({argDateFormat, argCalendarNO})
268  ##渡された値をテキストで確定させて
269  set strDateFormat to argDateFormat as text
270  set intCalendarNO to argCalendarNO as integer
271  ###日付情報の取得
272  set ocidDate to current application's NSDate's |date|()
273  ###日付のフォーマットを定義(日本語)
274  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
275  ###和暦 西暦 カレンダー分岐
276  if intCalendarNO = 1 then
277    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
278  else if intCalendarNO = 2 then
279    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
280  else
281    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
282  end if
283  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
284  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
285  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
286  ###設定
287  ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
288  ocidFormatterJP's setLocale:(ocidLocaleJP)
289  ocidFormatterJP's setCalendar:(ocidCalendarJP)
290  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
291  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
292  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
293  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
294  ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
295  ###渡された値でフォーマット定義
296  ocidFormatterJP's setDateFormat:(strDateFormat)
297  ###フォーマット適応
298  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
299  ###テキストで戻す
300  set strDateAndTime to ocidDateAndTime as text
301  return strDateAndTime
302end doGetDateNo
AppleScriptで生成しました

|

[ffmpeg]左右別ファイルになっているサウンドファイルをステレオファイルにマージする


AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#
005#
006#
007# com.cocolog-nifty.quicktimer.icefloe
008----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
009##自分環境がos12なので2.8にしているだけです
010use AppleScript version "2.8"
011use framework "Foundation"
012use framework "AVFoundation"
013use scripting additions
014
015property refMe : a reference to current application
016
017
018#################################
019###ffmpeg へのパス
020set strBinPath to ("~/bin/ffmpeg7/ffmpeg") as text
021
022set ocidBinPathStr to refMe's NSString's stringWithString:(strBinPath)
023set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
024set strBinPath to ocidBinPath as text
025
026
027
028###入力
029tell application "Finder"
030  set aliasDefaultLocation to (path to desktop folder from user domain) as alias
031end tell
032####UTIリスト
033set listUTI to {"public.audio"}
034
035####ダイアログを出す
036set listFilePath to (choose file with prompt "LーRの順にファイルを選んでください" default location (aliasDefaultLocation) of type listUTI with invisibles, showing package contents and multiple selections allowed) as list
037
038###入力ファイルのパス
039set aliasFilePathL to (item 1 of listFilePath) as alias
040set aliasFilePathR to (item 2 of listFilePath) as alias
041#
042set strFilePathL to (POSIX path of aliasFilePathL) as text
043set strFilePathR to (POSIX path of aliasFilePathR) as text
044
045#######################
046##出力ファイルパス
047#######################
048set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePathL)
049set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
050set ocidBaseFilePath to ocidFilePath's stringByDeletingPathExtension()
051set ocidSaveFilePath to ocidBaseFilePath's stringByAppendingPathExtension:("combine.mp3")
052set strSaveFilePath to ocidSaveFilePath as text
053
054
055set strCommandText to ("\"" & strBinPath & "\" -i \"" & strFilePathL & "\" -i \"" & strFilePathR & "\" -filter_complex \"[0:a][1:a]amerge=inputs=2,pan=stereo|c0<c0|c1<c1[a]\" -map \"[a]\" \"" & strSaveFilePath & "\"") as text
056log strCommandText
057##実行
058##### コマンド実行
059tell application "Terminal"
060  launch
061  activate
062  set objWindowID to (do script "\n\n")
063  delay 1
064  do script strCommandText in objWindowID
065end tell
066
AppleScriptで生成しました

|

[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 setUsesGroupingSeparator:(false)
168    (ocidFormatter's setMaximumFractionDigits:(2))
169    # set ocidW to (ocidFormatter's numberFromString:(ocidWidth))
170    #   set ocidH to (ocidFormatter's numberFromString:(ocidHeight))
171    set numFPS to (ocidFormatter's numberFromString:(ocidFPSstr))
172    ##小数点以下の処理
173    set ocidAspectRatio to (ocid720H's decimalNumberByDividingBy:(ocidH))
174    set ocidAdjustW to (ocidW's decimalNumberByMultiplyingBy:(ocidAspectRatio))
175    ##繰り下げ
176    set ocidRoundDown to (refMe's NSDecimalNumberHandler's decimalNumberHandlerWithRoundingMode:(refMe's NSRoundDown) scale:(0) raiseOnExactness:(false) raiseOnOverflow:(false) raiseOnUnderflow:(false) raiseOnDivideByZero:(false))
177    set ocidRoundDownNo to (ocidAdjustW's decimalNumberByRoundingAccordingToBehavior:(ocidRoundDown))
178    ##2で割って
179    set ocidTWO to (refMe's NSDecimalNumber's alloc()'s initWithString:("2"))
180    set ocidRoundDownH to (ocidRoundDownNo's decimalNumberByDividingBy:(ocidTWO))
181    if (ocidRoundDownH as integer) = (ocidRoundDownH as real) then
182      log "偶数"
183      set numAdjustW to ocidRoundDownNo as integer
184    else
185      log "奇数"
186      set ocidONE to (refMe's NSDecimalNumber's alloc()'s initWithString:("1"))
187      set ocidOddNO to (ocidRoundDownNo's decimalNumberByAdding:(ocidONE))
188      set numAdjustW to ocidOddNO as integer
189    end if
190    log ocidW as text
191    log ocidH as text
192    log numAdjustW as text
193    
194    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
195    
196    log strCommandText
197    #do shell script strCommandText
198    
199    tell application "Terminal"
200      set objWindowID to (do script "\n\n")
201      activate
202      delay 1
203      do script strCommandText in objWindowID
204    end tell
205    delay 3
206    set listTime to {0, 0, 0} as list
207    set numInterval to 10 as integer
208    repeat
209      tell application "Terminal"
210        tell objWindowID
211          activate
212        end tell
213      end tell
214      delay 0.5
215      tell application "Terminal"
216        tell front window
217          tell front tab
218            set boolBusy to busy as boolean
219          end tell
220        end tell
221      end tell
222      if boolBusy is true then
223        ###スタートタイム
224        set strStartTime to doHMSms(listTime)
225        log "経過時間: " & strStartTime
226        delay numInterval
227        ##まず秒が加算されるといくつになるか?
228        set numChkDigUp to (item 3 of listTime) + numInterval
229        ###↑この結果が59より大きければ繰り上がる
230        if numChkDigUp ≥ 60 then
231          set (item 3 of listTime) to numChkDigUp - 60
232          if (item 2 of listTime) = 59 then
233            set (item 2 of listTime) to 0
234            ####修正箇所
235            ####  set (item 1 of listTime) to (item 1 of listTime) + 1
236            set (item 1 of listTime) to (item 1 of listTime)
237          else
238            set (item 2 of listTime) to (item 2 of listTime) + 1
239          end if
240        else
241          set (item 3 of listTime) to (item 3 of listTime) + numInterval
242        end if
243        ####エンドタイム
244        set strEndTime to doHMSms(listTime)
245      else if boolBusy is false then
246        exit repeat
247      end if
248    end repeat
249    
250    
251    #######【A】try文処理する方の終わり
252  on error
253    #エラーしたファイルにはラベル『グレー』を付与します
254    #停止させずに続行
255    set ocidLabelNo to (refMe's NSNumber's numberWithInteger:(1))
256    set listDone to (ocidFilePathURL's setResourceValue:(ocidLabelNo) forKey:(refMe's NSURLLabelNumberKey) |error| :(reference))
257    if (item 1 of listDone) is true then
258      log "setResourceValue 正常処理"
259    else if (item 2 of listDone) ≠ (missing value) then
260      log (item 2 of listDone)'s code() as text
261      log (item 2 of listDone)'s localizedDescription() as text
262      log "setResourceValue エラーしました"
263    end if
264  end try
265end repeat
266
267return
268set aliasSaveDirFilePath to (ocidSaveDirPathURL's absoluteURL()) as alias
269tell application "Finder"
270  open aliasSaveDirFilePath
271end tell
272
273return
274
275
276################################
277##経過時間計算
278################################
279on doHMSms(listTime)
280  set strH to item 1 of listTime
281  set strM to item 2 of listTime
282  set strS to item 3 of listTime
283  return doPadding2Dig(strH) & ":" & doPadding2Dig(strM) & ":" & doPadding2Dig(strS)
284end doHMSms
285
286###2桁ゼロパディング
287on doPadding2Dig(numNO)
288  set strNO to ("0" & numNO) as text
289  return text -2 thru -1 of strNO
290end doPadding2Dig
291
292
293###3桁逆ゼロサブレス
294on doAfterPadding3Dig(numNO)
295  set strNO to (numNO & "00") as text
296  return text 1 thru 3 of strNO
297end doAfterPadding3Dig
298
299################################
300# 日付 doGetDateNo(argDateFormat,argCalendarNO)
301# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
302# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
303################################
304to doGetDateNo({argDateFormat, argCalendarNO})
305  ##渡された値をテキストで確定させて
306  set strDateFormat to argDateFormat as text
307  set intCalendarNO to argCalendarNO as integer
308  ###日付情報の取得
309  set ocidDate to current application's NSDate's |date|()
310  ###日付のフォーマットを定義(日本語)
311  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
312  ###和暦 西暦 カレンダー分岐
313  if intCalendarNO = 1 then
314    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
315  else if intCalendarNO = 2 then
316    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
317  else
318    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
319  end if
320  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
321  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
322  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
323  ###設定
324  ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
325  ocidFormatterJP's setLocale:(ocidLocaleJP)
326  ocidFormatterJP's setCalendar:(ocidCalendarJP)
327  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
328  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
329  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
330  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
331  ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
332  ###渡された値でフォーマット定義
333  ocidFormatterJP's setDateFormat:(strDateFormat)
334  ###フォーマット適応
335  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
336  ###テキストで戻す
337  set strDateAndTime to ocidDateAndTime as text
338  return strDateAndTime
339end 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


|

その他のカテゴリー

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