我正在尝试使用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 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 got an error: Can’t get document 1. Invalid index.
运行脚本时,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就可以用我已安装的编解码器来播放它。谢谢你的建议。
答案 0 :(得分:0)
这里不要“回答错误的问题”,但ffmpeg可以转换容器而不进行转码(因此不会显着改变文件大小或降低质量):
ffmpeg -vcodec copy -acodec copy -i inputFile.avi outputFile.mov