I know this is an old post, but I thought I'd share the ruby script I wrote to translate between the EDL and the text format that works with Subler and mkvmerge and probably several more. It's fairly straightforward, and it wouldn't be hard to transform into other formats (the time and the name are extracted, it's just a matter or reformatting that data). I did a cursory search for Encore's chapter list format and came up empty, otherwise I'd have taken a stab at it.
Full instructions on making this executable would be a bit much for me to cover here (especially on all platforms), but in general:
- Make sure ruby is installed (if you're on a Mac it should already have ruby)
- Copy the code at the end of this comment to a new file, and save it as edl2chap (or something)
- Make sure the file is in your PATH (or else keep it with your project and use a relative path to it)
- Make sure the file is executable (chmod 755 edl2chap)
Then you'd use it something like:
- Code: Select all
edl2chap -l en -f 30 chapters.edl
And it will generate a file named chapters.en.txt. Not it will overwrite any existing file of that name.
The
-l flag lets you set a language; this shows up in the output filename. It defaults to "en".
The
-f flag lets you specify the framerate of the timeline. It defaults to 30. This is necessary for accurate math translating between frames (in the EDL) and milliseconds (in the chapter file). This could probably be sniffed out from the FCM line in the EDL but after a (again, cursory) search on the EDL file format, I couldn't find much information about expected FCM values and how they would translate to numbers, so it was far easier to just specify the frame rate manually.
- Code: Select all
#!/usr/bin/env ruby
require "optparse"
options = {:lang => 'en', :fr => 30}
ARGV.options do |opts|
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [OPTIONS] EDL_FILE"
opts.separator ""
opts.separator "Specific Options:"
opts.on( "-l", "--language", String,
"2-charater language code (will appear in output file name)" ) do |opt|
options[:lang] = opt
end
opts.on( "-f", "--framerate", Integer,
"Frame rate of EDL (default: 30)" ) do |opt|
options[:fr] = opt
end
opts.separator "Common Options:"
opts.on( "-h", "--help",
"Show this message." ) do
puts opts
exit
end
begin
opts.parse!
rescue
puts opts
exit
end
end
EDL = ARGV[0]
LANG = ARGV[1] || 'en'
edl = File.read(EDL)
output = EDL.gsub(/\.edl/, '') + ".#{LANG}.txt"
chapters = ""
index = 0
edl.split(/\r?\n\r?\n/).each do |l|
if l =~ /C +(\d\d:\d\d:\d\d:\d\d).+\|M:(.+) \|D/m
index += 1
time = $1
name = $2
tp = time.split(':')
Hood River = tp[0].to_i - 1
frames = tp[3]
ms = sprintf("%03d", (frames.to_f / options[:fr]) * 1000)
time.gsub!(/:\d\d$/, ".#{ms}")
chap_index = sprintf("%02d", index)
new_time = "#{hr}:#{tp[1]}:#{tp[2]}.#{ms}"
chapters += "CHAPTER#{chap_index}=#{new_time}\n"
chapters += "CHAPTER#{chap_index}NAME=#{name}\n"
end
end
File.open(output, "w") { |f| f.write chapters }
puts "File written to #{output}"
Use at your own risk!