Macos 如何让AppleScript使用正确版本的QuickTime Player打开电影?
我试图在QuickTime Player 7 v7.6.6中使用以下脚本将AVI容器文件批量转换为MOV容器文件:Macos 如何让AppleScript使用正确版本的QuickTime Player打开电影?,macos,applescript,quicktime,avi,mov,Macos,Applescript,Quicktime,Avi,Mov,我试图在QuickTime Player 7 v7.6.6中使用以下脚本将AVI容器文件批量转换为MOV容器文件: tell application "Finder" try set myFolder to (the folder of the front window) as alias on error beep end try -- get list of .avi files set aviFiles to fi
tell application "Finder"
try
set myFolder to (the folder of the front window) as alias
on error
beep
end try
-- get list of .avi files
set aviFiles to files of myFolder whose name contains ".avi"
end tell
tell application "QuickTime Player 7" to activate
repeat with aviFile in aviFiles
set aviName to name of aviFile as text
set dispName to (text 1 thru ((length of aviName) - 4)) of aviName
set movName to dispName & ".mov"
set movPath to (POSIX path of myFolder & movName)
tell application "QuickTime Player 7"
open aviFile
save front document in movPath
close front document
end tell
end repeat
在Finder中选择文件夹并运行此脚本时,出现以下错误:
QuickTime Player 7出现错误:无法获取文档1。无效索引。
当我运行脚本时,QuickTime Player X和QuickTime Player 7都被激活(打开)
看起来电影文件aviFile
实际上是在QuickTime Player X中打开的,而不是在QuickTime Player 7中打开的,这可以解释为什么错误消息指出QTP7无法获取文档1
有没有办法修复此脚本,使其在QuickTime Player 7而不是QuickTime Player X中打开AVI电影?有没有办法通过命令行控制QuickTime Player 7
注意,我不想使用像ffmpegX(或类似的)这样的转码器,这会降低AVI的质量(同时也会增大文件大小)。我只想用一个新的MOV容器自动重新保存AVI,这样iTunes就可以用我已经安装的编解码器播放AVI了。感谢您的建议。这里不要“回答错误的问题”,但ffmpeg可以在不进行转码的情况下转换容器(因此不会显著更改文件大小或降低质量):
ffmpeg -vcodec copy -acodec copy -i inputFile.avi outputFile.mov