-
-
Save kureikei/beaafd0faaeaa72e6ab9672fc80e3ec9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var file = new File("/Users/kei/Creative Cloud Files/scripts/clip.sbv"); // TODO: 実際のパスに変更 | |
file.open( "w" ); | |
var seq = app.project.activeSequence; // 現在のプロジェクトのアクティブなシーケンス | |
for (var i = 0; i < seq.videoTracks.length; ++i) { // ビデオトラックから探す | |
writeClipTimecodes(seq.videoTracks[i]); | |
} | |
for (var i = 0; i < seq.audioTracks.length; ++i) { // オーディオトラックから探す | |
writeClipTimecodes(seq.audioTracks[i]); | |
} | |
file.close(); | |
file = null; | |
function writeClipTimecodes(track) { | |
for (var i = 0; i < track.clips.length; ++i) { // トラック内のクリップ | |
var clip = track.clips[i]; | |
if (!clip.isSelected()) { // 選択されていなければスキップ | |
continue; | |
} | |
var start = clip.start; | |
var end = clip.end; | |
// .sbv 形式のタイムコードと字幕テキスト | |
file.writeln( | |
(Math.floor(start.seconds / 3600)) + ":" + | |
(Math.floor(start.seconds / 60) % 60) + ":" + | |
(start.seconds % 60) + "," + | |
(Math.floor(end.seconds / 3600)) + ":" + | |
(Math.floor(end.seconds / 60) % 60) + ":" + | |
(end.seconds % 60)); | |
file.writeln(clip.name); // 字幕テキストは仮にクリップ名とする | |
file.writeln(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment