Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtitle format are not converted when video is not downloaded #86

Closed
Dnkhatri opened this issue Sep 12, 2020 · 3 comments
Closed

Subtitle format are not converted when video is not downloaded #86

Dnkhatri opened this issue Sep 12, 2020 · 3 comments
Labels

Comments

@Dnkhatri
Copy link

Dnkhatri commented Sep 12, 2020

ytdl-org#22869

it's a long running issue the devs of the original project dont seemed to be interested in fixing it

@blackjack4494
Copy link
Owner

I believe that happens because FFmpegSubtitlesConvertorPP is a PostProcessor so the trigger won't happen as there is only one subtitle file and nothing more. No clue how hard it is to overwrite current behaviour to fix post processing. Maye it's easier to use the FFmpegSubtitlesConvertorPP as a pre processor (if that is actually implemented somewhere, somehow) under certain conditions like --skip-download && --write-sub && --convert-subs. There should be no negative impact on this even if you wouldn't explicitly use --skip-download as the subtitle convertor compares the current format with the requested one and will just skip if it's the same.

The easiest solution I can think of right now is to hook into ...

Seems promising so far will fiddle around a bit more and show you the results.

If there is an subtitle file already I can convert it without triggering full download

PS D:\gitkraken\youtube-dl> python3 -m youtube_dlc -v --skip-download --write-sub --write-auto-sub --convert-subs srt "https://www.youtube.com/watch?v=8VYV_hY4C0o"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--skip-download', '--write-sub', '--write-auto-sub', '--convert-subs', 'srt', 'https://www.youtube.com/watch?v=8VYV_hY4C0o']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dlc version 2020.09.12
[debug] Git HEAD: dc6193c
[debug] Python version 3.6.5 (CPython) - Windows-10-10.0.19041-SP0
[debug] exe versions: ffmpeg 4.2.1, ffprobe 4.2.1
[debug] Proxy map: {}
!!! init
[youtube] 8VYV_hY4C0o: Downloading webpage
[youtube] 8VYV_hY4C0o: Looking for automatic captions
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://www.youtube.com/api/timedtext?lang=en-US&v=8VYV_hY4C0o&fmt=vtt&name='
[download] FluttERR MLH-8VYV_hY4C0o.en-US.vtt has already been downloaded
[download] 100% of 3.94KiB
<youtube_dlc.postprocessor.ffmpeg.FFmpegSubtitlesConvertorPP object at 0x000001885F2C3860>
!!! start
[ffmpeg] Converting subtitles
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:FluttERR MLH-8VYV_hY4C0o.en-US.vtt" -f srt "file:FluttERR MLH-8VYV_hY4C0o.en-US.srt"
!!! end
Deleting original file FluttERR MLH-8VYV_hY4C0o.en-US.vtt (pass -k to keep)

@blackjack4494
Copy link
Owner

patched - even loops through all subtitles when using --all-subs

PS D:\gitkraken\youtube-dl> python3 -m youtube_dlc -v --skip-download --write-sub --write-auto-sub --convert-subs srt "https://www.youtube.com/watch?v=8VYV_hY4C0o" --all-subs
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--skip-download', '--write-sub', '--write-auto-sub', '--convert-subs', 'srt', 'https://www.youtube.com/watch?v=8VYV_hY4C0o', '--all-subs']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dlc version 2020.09.12
[debug] Git HEAD: fc0999c
[debug] Python version 3.6.5 (CPython) - Windows-10-10.0.19041-SP0
[debug] exe versions: ffmpeg 4.2.1, ffprobe 4.2.1
[debug] Proxy map: {}
[youtube] 8VYV_hY4C0o: Downloading webpage
[youtube] 8VYV_hY4C0o: Looking for automatic captions
WARNING: Couldn't find automatic captions for 8VYV_hY4C0o
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://www.youtube.com/api/timedtext?lang=en-US&v=8VYV_hY4C0o&fmt=vtt&name='
[download] Destination: FluttERR MLH-8VYV_hY4C0o.en-US.vtt
[download] 100% of 3.94KiB in 00:00
[debug] Invoking downloader on 'https://www.youtube.com/api/timedtext?lang=fr-FR&v=8VYV_hY4C0o&fmt=vtt&name='
[download] Destination: FluttERR MLH-8VYV_hY4C0o.fr-FR.vtt
[download] 100% of 4.27KiB in 00:45
[debug] Invoking downloader on 'https://www.youtube.com/api/timedtext?lang=pt-BR&v=8VYV_hY4C0o&fmt=vtt&name='
[download] Destination: FluttERR MLH-8VYV_hY4C0o.pt-BR.vtt
[download] 100% of 4.00KiB in 00:00
[debug] Invoking downloader on 'https://www.youtube.com/api/timedtext?lang=ru&v=8VYV_hY4C0o&fmt=vtt&name='
[download] Destination: FluttERR MLH-8VYV_hY4C0o.ru.vtt
[download] 100% of 4.32KiB in 00:00
[debug] Invoking downloader on 'https://www.youtube.com/api/timedtext?lang=es-419&v=8VYV_hY4C0o&fmt=vtt&name='
[download] Destination: FluttERR MLH-8VYV_hY4C0o.es-419.vtt
[download] 100% of 3.95KiB in 00:00
[ffmpeg] Converting subtitles
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:FluttERR MLH-8VYV_hY4C0o.en-US.vtt" -f srt "file:FluttERR MLH-8VYV_hY4C0o.en-US.srt"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:FluttERR MLH-8VYV_hY4C0o.fr-FR.vtt" -f srt "file:FluttERR MLH-8VYV_hY4C0o.fr-FR.srt"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:FluttERR MLH-8VYV_hY4C0o.pt-BR.vtt" -f srt "file:FluttERR MLH-8VYV_hY4C0o.pt-BR.srt"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:FluttERR MLH-8VYV_hY4C0o.ru.vtt" -f srt "file:FluttERR MLH-8VYV_hY4C0o.ru.srt"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:FluttERR MLH-8VYV_hY4C0o.es-419.vtt" -f srt "file:FluttERR MLH-8VYV_hY4C0o.es-419.srt"
Deleting original file FluttERR MLH-8VYV_hY4C0o.en-US.vtt (pass -k to keep)
Deleting original file FluttERR MLH-8VYV_hY4C0o.fr-FR.vtt (pass -k to keep)
Deleting original file FluttERR MLH-8VYV_hY4C0o.pt-BR.vtt (pass -k to keep)
Deleting original file FluttERR MLH-8VYV_hY4C0o.ru.vtt (pass -k to keep)
Deleting original file FluttERR MLH-8VYV_hY4C0o.es-419.vtt (pass -k to keep)

Did basic testing. But should be stable enough. The overwrite flag won't be honoured for now but that shouldn't be a problem I guess?

@Dnkhatri
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants