【发布时间】:2015-11-27 16:19:23
【问题描述】:
我正在编写一个脚本来帮助我的工作流程。我的工作涉及声音设计,我经常需要拍摄视频并提取音频。无论源/压缩如何,我都喜欢 .wav 格式 - 最好的质量,被所有音频编辑软件接受,并且在现场环境中播放的开销最小。
目前,我为此任务使用 Quicktime Pro 7 的导出功能 - 当前的 Quicktime X 不导出为 .wav。内置在操作系统中,所以我没有使用单独的工具,而是使用 QT。
我正在使用 Automator 编写服务 - 选择文件,在 QT 中打开它,导出为 wav 并将其保存在与原始文件相同的位置,然后退出。这是我到目前为止所拥有的,并且我不断收到错误消息。 ““运行 AppleScript”操作遇到错误。”它编译正确,但没有任何结果。昨晚深夜,出于某种原因,我让它吐出 .mov 文件(尽管试图告诉它挥手),现在我什至无法回到那里。
感谢任何帮助。正如您从评论部分看到的那样,我试图指定任何地方,因为试图使其与原件相同的位置正在逃避我。目前我只是让它提示我在哪里保存,所以我一次只能解决一个问题。干杯!
tell application "QuickTime Player 7"
--set saveFile to POSIX path of (((path to desktop) as Wave) & "test.wav")
set outfile to choose file name with prompt "Save altered file here:"
set error_states to {load state unknown, load error}
set successful_states to {loaded, complete}
repeat until load state of first document is in (error_states & successful_states)
delay 0.1
end repeat
tell document to save in outfile
if (load state of first document is in successful_states) then
if (can export first document as wave) then
export first document to outfile as wave
else
error "Cannot export " & (source_file as string) & " in .wav (Wave) format."
end if
else
error "File is not in a successful load state: " & (load state of first document as string)
end if
end tell
【问题讨论】:
标签: qt audio applescript