【发布时间】:2023-03-28 16:56:01
【问题描述】:
我知道这可能有一个非常简单的答案。我正在尝试设置一个 Applescript 应用程序,该应用程序在激活后将启动 quicktime、打开新的电影录制、设置相机和音频、开始录制然后结束录制并在 30 秒后保存。
我目前有一个脚本,除了设置相机和音频源之外,它可以做所有事情。关于如何使用 applescript 选择某个摄像头和音频源的任何提示?
谢谢!
这是现在的代码..
--Set some Variables
--Max length of recording
set maxrec to 20 --in seconds
--Ending Message
set EndMsg to "Thank you for participating in this project. Your video has been recorded."
--Begin Loop
repeat
--Get the person's name
repeat
display dialog "What's your name?" default answer ""
set theName to (text returned of result)
if theName ≠ "" then exit repeat
end repeat
--Set the date
set theDate to current date
set y to text -4 thru -1 of ("0000" & (year of theDate))
set m to text -2 thru -1 of ("00" & ((month of theDate) as integer))
set d to text -2 thru -1 of ("00" & (day of theDate))
set h to text -2 thru -1 of ("00" & (hours of theDate))
set mm to text -2 thru -1 of ("00" & (minutes of theDate))
set dateStamp to (y & "-" & m & "-" & d & " " & h & mm as string)
--Create a folder for the person
tell application "Finder"
set p to path to movies folder from user domain
try
make new folder at p with properties {name:"Video Clips"}
end try
set p to (path to movies folder from user domain as text) & "Video Clips:"
make new folder at p with properties {name:dateStamp & " " & theName}
set thePath to result
--Establish the final name of the movie
set fileName to ((thePath as text) & dateStamp & ".mov" as string)
end tell
--Open New Recording, start and stop it
tell application "QuickTime Player"
set newMovieRecording to new movie recording
set windowID to id of first window whose name = "Movie Recording"
delay 2
tell newMovieRecording
--Set Camera to Blackmagic
set current camera of newMovieRecording to Blackmagic of video recording devices
start
end tell
set theSeconds to maxrec
repeat theSeconds times
display dialog theSeconds buttons {} giving up after 1 with title "REMAINING TIME"
set theSeconds to (theSeconds - 1)
end repeat
tell newMovieRecording
stop
end tell
--save and close the recording
set newMovieRecordingDoc to first document whose name = (get name of first window whose id = windowID)
tell newMovieRecordingDoc to save in fileName
set SavedRecordingDoc to first document whose name = (get name of first window whose id = windowID)
tell SavedRecordingDoc to close
quit
end tell
--Display "Thank You" Message
tell application "System Events" to set frontmost of process "Video Booth" to true
display dialog EndMsg giving up after 20 buttons {"Continue…"} ¬
default button 1
end repeat
这是我现在运行时遇到的错误。
error "QuickTime Player 出现错误:无法将文档 \"Movie Recording\" 的每个视频录制设备的 Blackmagic 转换为类型说明符。"从文件“Movie Recording”的每个视频录制设备的Blackmagic到指定者的编号-1700
【问题讨论】:
-
我对这行很感兴趣:将 newMovieRecording 的当前摄像机设置为视频录制设备的 Blackmagic 'Blackmagic' 的定义在哪里?我尝试用包含我的 iPhone 名称的字符串替换它,并得到“不允许访问”。
标签: macos camera applescript quicktime recording