update yt-dlp

This commit is contained in:
Dani Tsvetkov 2024-06-17 12:15:26 +02:00
parent 685b3e6e5f
commit f6b7837f79

16
main.py
View File

@ -5,9 +5,9 @@ from common import run_os_cmd
from compare import linear_compare
# TODO: AMMEND THESE FOR NOW - should become cmdline params / text file
FINAL_TITLE = "plastic"
DE_VIDEO = "https://www.youtube.com/watch?v=mhmpeIyG0uM"
EN_VIDEO = "https://www.youtube.com/watch?v=RS7IzU2VJIQ"
FINAL_TITLE = "toki_nanpa"
DE_VIDEO = "https://www.youtube.com/watch?v=AgkDx8dIAio"
EN_VIDEO = "https://www.youtube.com/watch?v=_awfcwuJhpk"
DE_SLOW_DOWN_COEF = 0.75 # slows down DE video the second time around
# TODO: ASSUMPTION that if fix.txt exists it has been fixed already.
@ -116,14 +116,16 @@ def download_vids_and_subs():
run_os_cmd("rm en.mp4 de.mp4 subs.en.vtt subs.de.vtt")
run_os_cmd("mkdir -p logs")
run_os_cmd("mkdir -p tmp")
run_os_cmd("""youtube-dl -f worst --output="de.%(ext)s" {}""".format(DE_VIDEO))
run_os_cmd("""youtube-dl -f worst --output="en.%(ext)s" {}""".format(EN_VIDEO))
run_os_cmd("""/usr/bin/yt-dlp -f 'wv*[ext=mp4][height>=480]+ba[ext=m4a]/b[ext=mp4] / wv*+ba/b' --output="de.mp4" "{}" """.format(DE_VIDEO))
run_os_cmd("""/usr/bin/yt-dlp -f 'wv*[ext=mp4][height>=480]+ba[ext=m4a]/b[ext=mp4] / wv*+ba/b' --output="en.mp4" "{}" """.format(EN_VIDEO))
run_os_cmd(
"""youtube-dl --output="subs.%(ext)s" --write-sub --sub-format vtt --sub-lang de --skip-download {}""".format(
"""/usr/bin/yt-dlp --output="subs.de.vtt" --write-sub --sub-format vtt --sub-lang tok --skip-download "{}" """.format(
DE_VIDEO))
run_os_cmd(
"""youtube-dl --output="subs.%(ext)s" --write-sub --sub-format vtt --sub-lang en --skip-download {}""".format(
"""/usr/bin/yt-dlp --output="subs.en.vtt" --write-sub --sub-format vtt --sub-lang en --skip-download "{}" """.format(
EN_VIDEO))
run_os_cmd("""mv subs.de.vtt.tok.vtt subs.de.vtt""")
run_os_cmd("""mv subs.en.vtt.en.vtt subs.en.vtt""")
def get_delta_at_time(t, syncs):