I am trying

youtube-dl https://www.youtube.com/watch?v=0QRO3gKj3qw  --write-sub --convert-subtitles srt -v

the result is negative

    [debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'https://www.youtube.com/watch?v=0QRO3gKj3qw', u'--write-sub', u'--convert-subtitles', u'srt', u'-v']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.08.24.1
[debug] Python version 2.7.12 - Linux-4.4.0-36-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: avconv v12_dev0-3134-g6755eb5, avprobe v12_dev0-3134-g6755eb5, ffmpeg 3.1.2-1, ffprobe 3.1.2-1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] 0QRO3gKj3qw: Downloading webpage
[youtube] 0QRO3gKj3qw: Downloading video info webpage
[youtube] 0QRO3gKj3qw: Extracting video information
[youtube] 0QRO3gKj3qw: Downloading MPD manifest
[info] Writing video subtitles to: What is Google Chrome OS-0QRO3gKj3qw.en.vtt
[debug] Invoking downloader on u'https://r2---sn-hpa7zned.googlevideo.com/videoplayback?id=d1044ede02a3deac&itag=136&source=youtube&requiressl=yes&mv=m&ms=au&pl=19&mn=sn-hpa7zned&mm=31&initcwndbps=58750&nh=IgpwcjAxLm1pbDAyKgkxMjcuMC4wLjE&ratebypass=yes&mime=video/mp4&gir=yes&clen=10330102&lmt=1457610153524637&dur=200.916&mt=1472162919&sver=3&key=dg_yt0&signature=871A09D44DD94771EDE6E5D76843EE652268357E.5CE50080607644DD88125B0841D21F95B4C2BA01&upn=XhAQxU6qSMo&ip=,ipbits,expire,id,itag,source,requiressl,mv,ms,pl,mn,mm,initcwndbps,nh,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: What is Google Chrome OS-0QRO3gKj3qw.f136.mp4
[download] 100% of 9.85MiB in 00:49
[debug] Invoking downloader on u'https://r2---sn-hpa7zned.googlevideo.com/videoplayback?id=d1044ede02a3deac&itag=140&source=youtube&requiressl=yes&mv=m&ms=au&pl=19&mn=sn-hpa7zned&mm=31&initcwndbps=58750&nh=IgpwcjAxLm1pbDAyKgkxMjcuMC4wLjE&ratebypass=yes&mime=audio/mp4&gir=yes&clen=3194068&lmt=1457610143781263&dur=201.061&mt=1472162919&sver=3&key=dg_yt0&signature=0DD64B9C971E69D61C6D7DD01C8884412CC05A0E.66C91FC66FAC5ECAC65901F4C3C7B60A2E5A6167&upn=XhAQxU6qSMo&ip=,ipbits,expire,id,itag,source,requiressl,mv,ms,pl,mn,mm,initcwndbps,nh,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: What is Google Chrome OS-0QRO3gKj3qw.f140.m4a
[download] 100% of 3.05MiB in 00:18
[ffmpeg] Merging formats into "What is Google Chrome OS-0QRO3gKj3qw.mp4"
[debug] ffmpeg command line: avconv -y -i 'file:What is Google Chrome OS-0QRO3gKj3qw.f136.mp4' -i 'file:What is Google Chrome OS-0QRO3gKj3qw.f140.m4a' -c copy -map 0:v:0 -map 1:a:0 'file:What is Google Chrome OS-0QRO3gKj3qw.temp.mp4'
Deleting original file What is Google Chrome OS-0QRO3gKj3qw.f136.mp4 (pass -k to keep)
Deleting original file What is Google Chrome OS-0QRO3gKj3qw.f140.m4a (pass -k to keep)
[ffmpeg] Converting subtitles
[debug] ffmpeg command line: avconv -y -i 'file:What is Google Chrome OS-0QRO3gKj3qw.en.vtt' -f srt 'file:What is Google Chrome OS-0QRO3gKj3qw.en.srt'
ERROR: file:What is Google Chrome OS-0QRO3gKj3qw.en.vtt: Invalid data found when processing input
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1832, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 572, in run
    self.run_ffmpeg(old_file, new_file, ['-f', new_format])
  File "/usr/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 172, in run_ffmpeg
    self.run_ffmpeg_multiple_files([path], out_path, opts)
  File "/usr/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 168, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
  • Works fine with the latest youtube-dl and a modern ffmpeg: paste.ubuntu.com/23091014 – andrew.46 Aug 25 '16 at 23:17
  • ffmpeg - version ---> paste.ubuntu.com/23101449 – ibrahim dz Aug 28 '16 at 7:37
  • Indeed that should do it but youtube-dl seems to be calling avconv in your case. Try running with the option --prefer-ffmpeg and also run the command youtube-dl -U to get the latest copy... – andrew.46 Aug 28 '16 at 8:19

1. The Problem:

The problem can be seen in your debug. You have the latest youtube-dl:

[debug] youtube-dl version 2016.08.24.1

which is great but your degug log shows that you have both avconv and ffmpeg installed:

[debug] exe versions: avconv v12_dev0-3134-g6755eb5, avprobe v12_dev0-3134-g6755eb5, 
ffmpeg 3.1.2-1, ffprobe 3.1.2-1, rtmpdump 2.4

Note that if both are installed then avconv will be used as default:

--prefer-avconv           Prefer avconv over ffmpeg for running the postprocessors (default)
--prefer-ffmpeg           Prefer ffmpeg over avconv for running the postprocessors

2. The Solution:

Testing on my own system indicates that if you use ffmpeg rather than avconv your download and conversion works flawlessly, so you have 2 choices for a solution:

  1. Add --prefer-ffmpeg to your command line for a one-off command
  2. Add --prefer-ffmpeg to the file ~/.config/youtube-dl.conf for a more permanent result. You may have to create this file initially by running the command: touch ~/.config/youtube-dl.conf

Works very nicely on my system...

  • thank you andrew.46 the problem has been resolved – ibrahim dz Sep 18 '16 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.