Skip to content

Instantly share code, notes, and snippets.

@craigeley
Last active December 31, 2019 15:35
Show Gist options
  • Save craigeley/dfe54889899ef095020291619f17c4c3 to your computer and use it in GitHub Desktop.
Save craigeley/dfe54889899ef095020291619f17c4c3 to your computer and use it in GitHub Desktop.
A script to convert an SRT file from Otter.ai to cue markers in Adobe Audition
#!/usr/local/opt/ruby/bin/ruby
# Scipt to convert Otter.ai-generated SRT files into Adobe Audition Markers
require 'srt'
require 'csv'
CSV.open("audition_markers.csv", "wb", col_sep: "\t") do |csv|
csv << ["Name", "Start", "Duration", "Time Format", "Type", "Description"]
end
file = SRT::File.parse(File.new("transcript_otter.ai.html"))
file.lines.each do |line|
float_start = line.start_time
float_end = line.end_time
format_start = Time.at(line.start_time).utc.strftime("%-M:%S.%3N")
dur = Time.at(float_end - float_start).utc.strftime("%-M:%S.%3N")
transcript = line.text[0]
CSV.open("audition_markers.csv", "a+", col_sep: "\t") do |csv|
csv << [transcript,format_start,dur,"decimal","Cue",nil]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment