Downloading a video file with subtitles using yt-dlp

I have downloaded an opera video and wished to obtain the english subtitiles. I used the command:-

yt-dlp -f 'bv*+ba' --write-subs en --merge-output-format mp4 FqMrivd0iUo -o '%(title)s.%(ext)s'

With this command I received a couple of warnings:-

[generic] Extracting URL: en
ERROR: [generic] 'en' is not a valid URL. Set --default-search "ytsearch" (or run  yt-dlp "ytsearch:en" ) to search YouTube
[youtube] Extracting URL: FqMrivd0iUo
[youtube] FqMrivd0iUo: Downloading webpage
[youtube] FqMrivd0iUo: Downloading ios player API JSON
[youtube] FqMrivd0iUo: Downloading android player API JSON
[youtube] FqMrivd0iUo: Downloading m3u8 information
[info] FqMrivd0iUo: Downloading 1 format(s): 137+140
[info] There are no subtitles for the requested languages
[download] Resuming download at byte 813829566

The download then proceeded and I have the mp4 file, albeit without subtitles.

For an earlier download, (the command for which I have lost,) subtitles were available and I have a good mp4 file and in addition I have another file with suffix .en.vtt. This seems to be a simple text file of the english subtitles and are displayed when I run VLC to play the mp4.
At least this seems to be the case as If I run the mp4 on its own in another directory I get no subtitles. Is it possible to have the subtitles embedded in the video?

You could try to use regex as described in the yt-dlp man page…

As example “en.*”

Or if you don’t know which langauages are available, find it out via --list-subs

And your output is clear:

[info] There are no subtitles for the requested languages

Hi and thanks for the reply. Yes I can see that in the example there were no subtitles available but the point of my question is that where subtitle was found I end up with two files and I am asking if the subtitles can be embedded.

If not, it makes the management and playing of these files when stored difficult as they must be treated as a pair. I have added the option --write-subs. Should I have used --embed-subs. Have you come across this before?

You need the post processing option --embed-subs

--embed-subs                    Embed subtitles in the video (only for mp4,
                                webm and mkv videos)

Thanks, I am trying it now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.