Skip to content

Instantly share code, notes, and snippets.

@skarfie123
Created September 1, 2023 22:21
Show Gist options
  • Save skarfie123/b5241f64ee7faed7e715c6931c1c13fb to your computer and use it in GitHub Desktop.
Save skarfie123/b5241f64ee7faed7e715c6931c1c13fb to your computer and use it in GitHub Desktop.
Convert Davinci Resolve timeline markers EDL to YouTube timestamps. Based on https://github.com/MaximRouiller/edl-to-ytjs
import re
import typer
def main(edl_file: str):
with open(edl_file, encoding="utf-8") as f:
lines = f.readlines()
regex_timestamp = r"\d{3,4} \d{3,4} V C \d{2}:(?P<marker_timestamp>\d{2}:\d{2}):\d{2} \d{2}:\d{2}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}:\d{2}"
regex_marker_name = r" \|C:\w+ \|M:(?P<marker_name>.+) \|D:1"
for i, line in enumerate(lines[:-1]):
if re.match(regex_timestamp, line):
marker_timestamp = re.search(regex_timestamp, lines[i]).group(
"marker_timestamp"
)
if re.match(regex_marker_name, lines[i + 1]):
marker_name = re.search(regex_marker_name, lines[i + 1]).group(
"marker_name"
)
print(marker_timestamp, marker_name)
if __name__ == "__main__":
typer.run(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment