- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试调整以下 Applescript 代码,以将包含视频和 8 个音频 channel 的多 channel Quicktime 文件的音频 channel 分配从默认的“单声道”更改为“左、右、左前、右前、LFE”等,这可以从“显示电影属性/音频设置”中手动完成。下面的脚本成功地改变了音频 channel 的“名称”,但我希望它改变“ channel ”的分配,但我不知道如何让它工作。我使用 Quicktime Pro 7 在 Mavericks。
on run
open (choose file with prompt "Choose source file(s)" with multiple selections allowed)
end run
on open ff
repeat with f in ff
remap_sound_tracks_name(f's POSIX path)
end repeat
end open
on remap_sound_tracks_name(f)
(*
string f : POSIX path of source movie file
*)
script o
on map(n)
set mm to {¬
{"Sound Track 1", "Left"}, ¬
{"Sound Track 2", "Right"}, ¬
{"Sound Track 3", "Center"}, ¬
{"Sound Track 4", "LFE Screen"}, ¬
{"Sound Track 5", "Left Surround"}, ¬
{"Sound Track 6", "Right Surround"}, ¬
{"Sound Track 7", "Left Total"}, ¬
{"Sound Track 8", "Right Total"} ¬
}
repeat with m in mm
if m's item 1 = n then return m's item 2
end repeat
return n
end map
set f to f as POSIX file
tell application id "com.apple.quicktimeplayer" -- QuickTime Player 7
set dc to count documents
open f
repeat until (count documents) > dc
delay 0.2
end repeat
tell document 1
repeat with t in (get tracks whose audio channel count > 0)
set t to t's contents
set n to t's name
set n1 to my map(n)
if n1 ≠ n then set t's name to n1
end repeat
if modified then save
close
end tell
end tell
end script
tell o to run
end remap_sound_tracks_name
最佳答案
Hiroto 在苹果论坛上回答了这个问题。它运行和工作,但很慢:
(*
remap audio channel layouts.applescript
v0.1
*)
on run
open (choose file with prompt ("Choose movie file(s)") ¬
with multiple selections allowed)
end run
on open aa
set channel_layouts_map1 to {¬
{"Sound Track 1", "Sound Track 1", {"Left"}}, ¬
{"Sound Track 2", "Sound Track 2", {"Right"}}, ¬
{"Sound Track 3", "Sound Track 3", {"Center"}}, ¬
{"Sound Track 4", "Sound Track 4", {"LFE Screen"}}, ¬
{"Sound Track 5", "Sound Track 5", {"Left Surround"}}, ¬
{"Sound Track 6", "Sound Track 6", {"Right Surround"}}, ¬
{"Sound Track 7", "Sound Track 7", {"Left Total"}}, ¬
{"Sound Track 8", "Sound Track 8", {"Right Total"}} ¬
}
set channel_layouts_map2 to {¬
{"Sound Track 1", "Sound Track 1", {"Left"}}, ¬
{"Sound Track 2", "Sound Track 2", {"Right"}}, ¬
{"Sound Track 3", "Sound Track 3", {"Center"}}, ¬
{"Sound Track 4", "Sound Track 4", {"LFE Screen"}}, ¬
{"Sound Track 5", "Sound Track 5", {"Left Surround"}}, ¬
{"Sound Track 6", "Sound Track 6", {"Right Surround"}}, ¬
{"Sound Track 7", "Sound Track 7", {"Left Total", "Right Total"}} ¬
}
set channel_layouts_map3 to {¬
{"Sound Track 1", "Sound Track 7", {"Left"}}, ¬
{"Sound Track 2", "Sound Track 8", {"Right"}} ¬
}
set channel_layouts_map4 to {¬
{"Sound Track", "Sound Track", {"Left", "Right"}} ¬
}
repeat with a in aa
set f to a's POSIX path
set k to count_sound_tracks(f, {_close:false})
if k = 8 then
remap_audio_channels(f, channel_layouts_map1)
else if k = 7 then
remap_audio_channels(f, channel_layouts_map2)
else if k = 2 then
remap_audio_channels(f, channel_layouts_map3)
else if k = 1 then
remap_audio_channels(f, channel_layouts_map4)
else
-- ignore it (just close it)
close_document(f, {_save:false})
end if
end repeat
end open
on count_sound_tracks(f, {_close:_close})
(*
string f : POSIX path of QT movie
boolean _close: true to close document, false othewise
*)
tell application id "com.apple.quicktimeplayer" -- QuickTime Player 7 Pro
open (f as POSIX file)
tell (document 1 whose path = f)
repeat until exists
delay 0.2
end repeat
set k to count (tracks whose audio channel count > 0)
if _close then close
end tell
end tell
return k
end count_sound_tracks
on close_document(f, {_save:_save})
(*
string f : POSIX path of QT movie
boolean _save: true to save document (if modified), false othewise
*)
tell application id "com.apple.quicktimeplayer" -- QuickTime Player 7 Pro
tell (document 1 whose path = f)
if exists then
if _save and modified then save
close
end if
end tell
end tell
end close_document
on remap_audio_channels(f, channel_layouts_map)
(*
string f : POSIX path of source movie
list channel_layouts_map : list of {trk, trk_new, layouts}
trk = (string or integer) name or index of source sound track
trk_new = (string or integer) new name for source track (integer i denotes original name of sound track i)
layouts = list of audio channel layout for channel(s) in source sound track
Mono
Left
Right
Center
LFE Screen
Left Surround
Right Surround
Left Center
Right Center
Center Surround
Rear Surround Left
Rear Surround Right
Left Total
Right Total
Discrete-0
Discrete-1
Unused
e.g. 1
{{"Sound Track 1", "Left", {"Left"}}, ¬
{"Sound Track 2", "Right", {"Right"}}, ¬
{"Sound Track 3", "Center", {"Center"}}, ¬
{"Sound Track 4", "LFE Screen", {"LFE Screen"}}, ¬
{"Sound Track 5", "Left Surround", {"Left Surround"}}, ¬
{"Sound Track 6", "Right Surround", {"Right Surround"}}, ¬
{"Sound Track 7", "Left Total", {"Left Total"}}, ¬
{"Sound Track 8", "Right Total", {"Right Total"}}}
e.g. 2
{{1, 1, {"Left", "Right"}}, ¬
{2, 2, {"Center", "LFE, Screen"}}, ¬
{3, 3, {"Left Surround", "Right Surround"}}, ¬
{4, 4, {"Left Total", "Right Total"}}}
* this handler behaves as follows:
1) open f
2) scan sound tracks of document 1 for each trk and remap the track's audio channel layouts as specified
3) scan sound tracks of document 1 for each trk and rename the track as specified
4) save and close document 1
* if specified trk is not found, it is ignored and no remapping is performed on the track.
* if specified layout is not found, it is ignored and no remapping is performed on the layout.
* if specified layout count is greater than channel count of the target track, excessive layouts are ignored.
* if specified layout count is smaller than channel count of target track, excessive channels are ignored.
* if trk and trk_new denotes the same track, renaming is not performed on the track.
*)
script o
property map : channel_layouts_map
property pp : {}
property qq : {}
-- get name and id of sound tracks
tell application id "com.apple.quicktimeplayer" -- QuickTime Player 7 Pro
activate
open (f as POSIX file)
tell (document 1 whose path = f)
repeat until exists
delay 0.2
end repeat
tell (tracks whose audio channel count > 0)
set {pp, qq} to {name, id} -- name and id of sound tracks
end tell
end tell
end tell
-- remap audio channel layouts as specified
tell application "System Events"
tell (process 1 whose bundle identifier = "com.apple.quicktimeplayer")
-- open movie properties window
keystroke "j" using {command down}
tell (window 1 whose subrole = "AXDialog") -- properties for movie
repeat until exists
delay 0.2
end repeat
repeat with m in my map
set {trk, undef, layouts} to m
-- [TRK:
repeat 1 times
if trk's class = integer then
if trk < 1 or trk > (count my pp) then exit repeat -- TRK:
set trk to my pp's item trk
end if
tell scroll area 1
tell table 1
tell (row 1 whose text field 1's value = trk) -- target sound track whose name = trk
if not (exists) then exit repeat -- TRK:
select
end tell
end tell
end tell
tell tab group 1
click radio button 3 -- audio settings
tell scroll area 1
tell table 1 -- channel assignment table
set ix to count layouts
repeat with i from 1 to count rows
if i > ix then exit repeat
tell row i -- channel i
tell pop up button 1
click
tell menu 1 -- channel assignment menu
tell (menu item 1 whose title = layouts's item i)
if exists then click
end tell
end tell
end tell
end tell
end repeat
end tell
end tell
end tell
end repeat
-- /TRK:]
end repeat
-- close movie properties window
click (button 1 whose subrole = "AXCloseButton")
end tell
end tell
end tell
-- rename sound tracks as specified
tell application id "com.apple.quicktimeplayer"
tell document 1
repeat with m in my map
-- [RENAME:
repeat 1 times
set {x, y} to m's items 1 thru 2 -- {old name or index, new name or index}
if x's class = integer then
if x < 1 or x > (count my pp) then exit repeat -- RENAME:
else
set x to my _index_of(pp, x)
if x = 0 then exit repeat -- RENAME:
end if
if y's class = integer then
if y < 1 or y > (count my pp) then exit repeat -- RENAME:
set y to my pp's item y
end if
set p to my pp's item x
set q to my qq's item x
if p ≠ y then set track id q's name to y
end repeat
-- /RENAME:]
end repeat
if modified then save
close
end tell
end tell
end script
tell o to run
end remap_audio_channels
on _index_of(xx, x) -- renamed _bsearch() v0.1
(*
list xx : source list
anything x : item to be searched in xx
return integer : the first index of x in xx if {x} is in xx, or 0 if not.
*)
script o
property aa : xx
local i, j, k
if {x} is not in my aa then return 0
set i to 1
set j to count my aa
repeat while j > i
set k to (i + j) div 2
if {x} is in my aa's items i thru k then
set j to k
else
set i to k + 1
end if
end repeat
return i
end script
tell o to run
end _index_of
关于macos - Quicktime 音频 channel 分配 - 左、右、左前、LFE 等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22843008/
当我学习 Windows 的可移植可执行 (PE) 文件格式时,PE-Explorer 之类的工具和 PEView帮助我快速而良好地学习东西。现在,我需要学习和理解apple quick time 文
我正在尝试将一段音频从一部 QuickTime 电影复制到另一部,但没有成功;音频似乎没有被复制。 C++基本代码: // Copy from another QT movie, *src, to t
我将 macOS 更新为 Sierra,但我的一些文件消失了。最重要的是 Allegro 的图书馆。我正在尝试像我第一次安装时看到的视频( https://www.youtube.com/watch?
我通过向 webview 提供 youtube url 来运行 youtube 视频,webview 打开 youtube 视频并在点击时自动在 MPMoviePlayerController 中运行
所以在我们的应用程序中,上传后会显示视频预览。但是,在我的计算机上,我收到一个缩略图,上面写着“缺少插件”,经过进一步检查,它说要安装 quicktime 插件。 但是,Chrome 提供的安装插件的
我正在编写一个多路复用器,它采用 mpeg4 帧(和 h264)并将它们放入 mp4 容器中。我创建的视频 ( test1.mp4 ) 可以在 Windows 媒体播放器和 VLC 中成功播放,但无法
我尝试在我的 Mac 上播放简单的 mp3 文件 iPhone 模拟器。我使用 AVFoundation.framework 和 AVAudioPlayer。在我的一台 Mac 上,一切正常,但在另一
在页面上嵌入 Quicktime 视频作为 IE 系列浏览器(无 flash/html5)的优雅回退。稍后我有一个覆盖视频的 div,因此 Quicktime 嵌入必须是 wmode=transpar
我有一个站点(下面的链接),其中客户的工作显示在一个长的水平页面上。菜单固定在左侧,滚动时图像会消失在菜单下方。 客户端现在已经上传了 quicktime 电影,它们不像图像那样位于菜单下,而是在菜单
我正在尝试使用 从 HTML 文档流式传输 Quicktime 文件标签。 视频格式为: Video: h264 (Main), yuv420p, 640x360, 2175 kb/s, 24 fp
目前我正在编写使用 ffmpeg 库对媒体文件进行转码的软件。问题是如果 H264 QuickTime 无法播放结果流并显示黑屏。音频流按预期工作。我读过 QuickTime 只能处理 yuv420p
有谁知道 App Store 何时开始要求在物理设备上进行应用程序预览并显示此弹出窗口? 即使我将 iPhone Xs 镜像到我的 Mac,也不会显示弹出窗口。如果视频上没有弹出窗口,应用商店将拒绝应
首先,我是 Mac 编程的新手。我已下载 macam project并使用 Xcode 4.1 成功将调试版本编译为 32 位代码。输出是我手动复制到 Library/QuickTime 文件夹的 Q
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 4年前关闭。 Improve thi
我正在尝试为一个必须执行以下操作的项目编写一个小的 AppleScript: 开始录制 QuickTime 影片 最小化录音窗口 打开一部电影,将自己置于全屏 电影播放完毕后,应停止录制 录音应将自身
我一直想知道是否可以找出用于解压缩 Quicktime 电影的编解码器(如 h.264、motion jpeg..),最好是 NSString。我搜索了 Quicktime 和 QTKit api 以
当网站首次加载时,我使用 jQuery 隐藏了大约 5 部 Quicktime 电影。我注意到,当我将网站上线时,打开网站需要 5-10 秒才能显示任何内容。有时我什至会得到一个“沙滩球”光标,就好像
我一直在寻找这个。我需要构建一个独立的实用程序,该实用程序应该: 将图像序列转换为 .mov 格式 获取用户的输入并将其显示在 mov 中。 我计划使用 Java 来完成此操作,因为这是一种跨平台语言
有没有办法获取 QuickTime 视频信息? (在谷歌搜索中,我发现了一个损坏的 QT cl 选项。) 我正在寻找 pasp、长度、音频 channel 、音频分配、拍手以及经常使用程序“Dumps
我有一个发送视频流的自定义硬件设备。 如何使该流可用于 QuickTime 应用程序? 长话短说:在 Windows 上,我创建了一个 DirectShow 过滤器,因此任何与 DirectShow
我是一名优秀的程序员,十分优秀!