我如何让AppleScript打开一个电影与正确版本的QuickTime播放器



我试图使用以下脚本与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。

是否有一种方法来修复这个脚本,使它打开的AVI电影在QuickTime播放器7而不是QuickTime播放器X?是否有一种方法来控制QuickTime Player 7通过命令行?

请注意,我不想使用像ffmpegX(或类似的)这样的转码器,这会降低AVI的质量(并且还会增加文件大小)。我只是想用一个新的MOV容器自动保存AVI,这样iTunes就可以用我已经安装的编解码器播放它。谢谢你的建议。

这里不是要"回答错误的问题",但是ffmpeg可以在不转码的情况下转换容器(因此不会显著改变文件大小或降低质量):

ffmpeg -vcodec copy -acodec copy -i inputFile.avi outputFile.mov

相关内容

最新更新