Youtube-dl and subtitles

Wildebeest

Member
If I'm downloading a video via youtube-dl how can I get (usable) subtitles? Even though they get frustratingly out of sync they are still useful for me.

I realise this may be different for every download source but I'm using a BBC iplayer programme as an example, as this is my main use case. As an example I'll use an episode of the drama "Clean Sweep".
  • If I use --list-subs it informs me that subtitles are available in English (en) and in ttml format. So far so good - there are English subs available. Well I already knew, they appear if I watch directly on the iplayer!​
  • https://wiki.hummy.tv/wiki/Custom_Firmware_Package_Notes#SRT tells me that:
    The Humax is able to play subtitles for MP4 and AVI files if the subtitle information is contained in an *.srt file, the following conditions must be met :-
    • The srt file must have the same title as the video file e.g. Fawlty-Towers-S1E3.srt for Fawlty-Towers-S1E3.avi
    • The .srt file needs to be saved as a text file specifically with ANSI encoding to avoid using fonts that are licensed
  • I tried using the following parameters:
    --all-subs
    --sub-lang "EN"
    --convert-subs "srt"
    (--all-subs is probably superfluous)​
  • Problem 1: This downloads a subtitle file (it seems the parameter --write-subs is not required BTW), but not quite to the file naming standards shown above, in that the filename contains the language code:
    Clean_Sweep_Series_1_Post-Mortem.en.srt
    In order to get subtitles to play I have to rename this file (using the CLI) to
    Clean_Sweep_Series_1_Post-Mortem.srt
    Clearly this isn't feasible for more than the odd file (unless I can get sweeper to do it, which I haven't looked into yet).​
  • Problem 2: If I rename the file, the subtitles play, but contain and display markup language, eg
    <font color="#ffffffff">Who else? You found me.</font>
Is there any easy solution to getting usable subs?

*** EDIT: am trying --embed-subs. Will report back when it's finished.
 
Last edited:
Back
Top