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

Youtube - downloading/embedded automatic captions #3838

Closed
jezcomputer opened this issue Sep 27, 2014 · 3 comments
Closed

Youtube - downloading/embedded automatic captions #3838

jezcomputer opened this issue Sep 27, 2014 · 3 comments

Comments

@jezcomputer
Copy link

Hi - I've trying to download the Close Captions from Youtube ; this works for youtube with Subtitle is set - however if the captions are set as Automatic I don't seem to find a way to download/embed them

e.g.

youtube-dl --list-subs https://www.youtube.com/watch?v=IWAT8twFjIs
[youtube] Setting language
[youtube] Confirming age
[youtube] IWAT8twFjIs: Downloading webpage
[youtube] IWAT8twFjIs: Downloading video info webpage
[youtube] IWAT8twFjIs: Extracting video information
WARNING: video doesn't have subtitles
[youtube] IWAT8twFjIs: Looking for automatic captions
[youtube] IWAT8twFjIs: Downloading XML
[youtube] IWAT8twFjIs: Available subtitles for video:
[youtube] IWAT8twFjIs: Available automatic captions for video: vi,el,eo,en,ga,af,zh-Hans,mi,ca,gu,iw,zh-Hant,cs,cy,ar,mk,bg,zu,eu,et,az,id,ig,ru,gl,nl,pt,la,lo,jv,ne,sv,lv,lt,pa,es,th,tr,it,ro,is,fil,ta,yi,be,fr,hy,ceb,yo,sl,hr,bn,de,ht,da,fa,hmn,hi,no,bs,fi,ha,ja,uk,ka,te,sr,sq,mn,ko,kn,km,ur,sk,mt,so,pl,ms,mr,hu,sw

The download stage - works great for video which have been marked with Subtitle ; but not automatic ones.

youtube-dl --all-subs --embed-sub --sub-lang en https://www.youtube.com/watch?v=IWAT8twFjIs
[youtube] Setting language
[youtube] Confirming age
[youtube] IWAT8twFjIs: Downloading webpage
[youtube] IWAT8twFjIs: Downloading video info webpage
[youtube] IWAT8twFjIs: Extracting video information
WARNING: video doesn't have subtitles

@jaimeMF
Copy link
Collaborator

jaimeMF commented Sep 27, 2014

You have to add --write-auto-sub.
By the way, --all-subs will download all the available languages, so --sub-lang en will be ignored.

@jaimeMF jaimeMF closed this as completed Sep 27, 2014
@jezcomputer
Copy link
Author

Thanks JamieMF that works for Auto CC's ; is there a way to have a single command line that can download Subtitle or Auto CC's

e.g. https://www.youtube.com/watch?v=5-c-dPlMxzU is enabled with Subtitles -
e.g. ./youtube-dl --embed-sub --write-auto-sub https://www.youtube.com/watch?v=5-c-dPlMxzU
will not do it.

./youtube-dl --embed-sub --all-subs https://www.youtube.com/watch?v=5-c-dPlMxzU
Will bring down the Subtitles

Any help would be most grateful

@sakib-bin-helal
Copy link

sakib-bin-helal commented Nov 1, 2017

Please write a procedure describing how to embed automatic subtitles.Using youtube-dl --embed-subs --write-auto-sub produce an error displaying Invalid data found when processing input

Input=youtube-dl -v --write-auto-sub --embed-subs https://www.youtube.com/watch?v=4Flj9plmKGQ&list=PL19E79A0638C8D449&index=84

output=

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--prefer-ffmpeg', u'-v', u'--write-auto-sub', u'--embed-subs', u'https://www.youtube.com/watch?v=4Flj9plmKGQ']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.10.20
[debug] Python version 2.7.6 - Linux-3.19.0-32-generic-x86_64-with-LinuxMint-17.3-rosa
[debug] exe versions: avconv 11.3-6, avprobe 11.3-6
[debug] Proxy map: {}
[youtube] 4Flj9plmKGQ: Downloading webpage
[youtube] 4Flj9plmKGQ: Downloading video info webpage
[youtube] 4Flj9plmKGQ: Extracting video information
[youtube] 4Flj9plmKGQ: Looking for automatic captions
[youtube] 4Flj9plmKGQ: Downloading MPD manifest
[debug] Default format spec: bestvideo+bestaudio/best
[info] Writing video subtitles to: Solid of Revolution (part 8)-4Flj9plmKGQ.en.vtt
[debug] Invoking downloader on u'https://r3---sn-ax8xaj5ggpxg-jb2e.googlevideo.com/videoplayback?id=e05963f699662864&itag=133&source=youtube&requiressl=yes&pl=24&mm=31&mn=sn-ax8xaj5ggpxg-jb2e&ei=gln4WZGqI5KEogOA-5HwCQ&initcwndbps=303750&ms=au&mv=m&ratebypass=yes&mime=video/mp4&gir=yes&clen=6954370&lmt=1397542169304899&dur=254.401&signature=3F4DC3CCDDAFD8E9B5F358CC91891EDADDE12542.37F684FA470DDEB64BB3777D45DF7FEF38EDD1AC&key=dg_yt0&mt=1509447944&ip=122.152.55.249&ipbits=0&expire=1509469666&sparams=ip,ipbits,expire,id,itag,source,requiressl,pl,mm,mn,ei,initcwndbps,ms,mv,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: Solid of Revolution (part 8)-4Flj9plmKGQ.f133.mp4
[download] 100% of 6.63MiB in 00:14
[debug] Invoking downloader on u'https://r3---sn-ax8xaj5ggpxg-jb2e.googlevideo.com/videoplayback?id=e05963f699662864&itag=140&source=youtube&requiressl=yes&pl=24&mm=31&mn=sn-ax8xaj5ggpxg-jb2e&ei=gln4WZGqI5KEogOA-5HwCQ&initcwndbps=303750&ms=au&mv=m&ratebypass=yes&mime=audio/mp4&gir=yes&clen=4044718&lmt=1397542159299201&dur=254.630&signature=86C016C05BC94E8341FFB3AA5309EFC196BBE215.33CD4DB6498FCBA00014DFA2041E1E4C3DB45A48&key=dg_yt0&mt=1509447944&ip=122.152.55.249&ipbits=0&expire=1509469666&sparams=ip,ipbits,expire,id,itag,source,requiressl,pl,mm,mn,ei,initcwndbps,ms,mv,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: Solid of Revolution (part 8)-4Flj9plmKGQ.f140.m4a
[download] 100% of 3.86MiB in 00:08
[ffmpeg] Merging formats into "Solid of Revolution (part 8)-4Flj9plmKGQ.mp4"
[debug] ffmpeg command line: avconv -y -i 'file:Solid of Revolution (part 8)-4Flj9plmKGQ.f133.mp4' -i 'file:Solid of Revolution (part 8)-4Flj9plmKGQ.f140.m4a' -c copy -map '0:v:0' -map '1:a:0' 'file:Solid of Revolution (part 8)-4Flj9plmKGQ.temp.mp4'
Deleting original file Solid of Revolution (part 8)-4Flj9plmKGQ.f133.mp4 (pass -k to keep)
Deleting original file Solid of Revolution (part 8)-4Flj9plmKGQ.f140.m4a (pass -k to keep)
[ffmpeg] Embedding subtitles in 'Solid of Revolution (part 8)-4Flj9plmKGQ.mp4'
[debug] ffmpeg command line: avconv -y -i 'file:Solid of Revolution (part 8)-4Flj9plmKGQ.mp4' -i 'file:Solid of Revolution (part 8)-4Flj9plmKGQ.en.vtt' -map 0 -c copy -map '-0:s' '-c:s' mov_text -map '1:0' '-metadata:s:s:0' 'language=eng' 'file:Solid of Revolution (part 8)-4Flj9plmKGQ.temp.mp4'
ERROR: file:Solid of Revolution (part 8)-4Flj9plmKGQ.en.vtt: Invalid data found when processing input
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2031, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 393, in run
    self.run_ffmpeg_multiple_files(input_files, temp_filename, opts)
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 204, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
FFmpegPostProcessorError: file:Solid of Revolution (part 8)-4Flj9plmKGQ.en.vtt: Invalid data found when processing input

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

No branches or pull requests

3 participants