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

No audio after first download #8800

Closed
schlingel opened this issue Mar 9, 2016 · 10 comments
Closed

No audio after first download #8800

schlingel opened this issue Mar 9, 2016 · 10 comments

Comments

@schlingel
Copy link

@schlingel schlingel commented Mar 9, 2016

I have written a small ruby script which uses youtube-dl to download all videos of a specific playlist as mp3s and set the mp3 tags.

The problem is that after the first video the files do not have any audio.

Youtube-dl is called as a system command like that:

youtube-dl --output \"#{file_name}\" --no-playlist --extract-audio --audio-format mp3 --audio-quality 0 \"#{url}\" 

This issue seems to be platform related. The script works on Linux but on my OSX 10.11.3 box the files have no audio.

youtube-dl is called like this:

youtube-dl -v --output "Familientragödien in der Bibel Sternstunde Religion, 28.2.2016.mp3" --no-playlist --extract-audio --audio-format mp3 --audio-quality 0 "https://www.youtube.com/watch?v=LIcBlkncCMw&index=1&list=PL1NXgjXDUNJnO_ZjqyqAy_VJAhbmdrOUL"
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'--output', u'Familientrag\xf6dien in der Bibel Sternstunde Religion, 28.2.2016.mp3', u'--no-playlist', u'--extract-audio', u'--audio-format', u'mp3', u'--audio-quality', u'0', u'https://www.youtube.com/watch?v=LIcBlkncCMw&index=1&list=PL1NXgjXDUNJnO_ZjqyqAy_VJAhbmdrOUL']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.03.06
[debug] Python version 2.7.11 - Darwin-15.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 2.8.4, ffprobe 2.8.4
[debug] Proxy map: {}
[youtube:playlist] Downloading just video LIcBlkncCMw because of --no-playlist
[youtube] LIcBlkncCMw: Downloading webpage
[youtube] LIcBlkncCMw: Downloading video info webpage
[youtube] LIcBlkncCMw: Extracting video information
[youtube] LIcBlkncCMw: Downloading MPD manifest
[debug] Invoking downloader on u'https://r5---sn-bvvbax-8pxz.googlevideo.com/videoplayback?id=o-AHu9koLHNnE5FUPkg0qPVlG-9Nc2R44BKtxKTNP_9eUE&expire=1457538334&ip=212.186.92.197&lmt=1457107852897546&pl=19&sparams=clen%2Cdur%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&source=youtube&initcwndbps=2606250&keepalive=yes&fexp=9413138%2C9416126%2C9419452%2C9420452%2C9422596%2C9423661%2C9423662%2C9424581%2C9425007%2C9425945%2C9426226%2C9426415%2C9427000%2C9427126%2C9427392%2C9427680%2C9429885&upn=MvyW1ij06Zc&key=yt6&mime=audio%2Fwebm&clen=14748694&ipbits=0&requiressl=yes&dur=1079.881&sver=3&ms=au&mt=1457516678&mv=m&itag=251&mm=31&signature=82DDB2B35B4549A89A24D46F4B9CBF9F35CD084E.A2C5EF2C4F9C64DDAABCC38249B11DD22AA9B5DE&mn=sn-bvvbax-8pxz&gir=yes&ratebypass=yes'
[download] Destination: Familientragödien in der Bibel Sternstunde Religion, 28.2.2016.mp3
[download] 100% of 14.07MiB in 00:06
[debug] ffmpeg command line: ffprobe -show_streams 'file:Familientragödien in der Bibel Sternstunde Religion, 28.2.2016.mp3'
[ffmpeg] Post-process file Familientragödien in der Bibel Sternstunde Religion, 28.2.2016.mp3 exists, skipping

My ffmpeg installation:

ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

My youtube-dl installation:

> youtube-dl --version
2016.03.06

The complete script is attached. (Requires ruby, ffmpeg and youtube-dl)

yt_pl_grabber.zip

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 9, 2016

Post the full output of youtube-dl when run with -v, i.e. add -v flag to your command line, copy the whole output and post it in the issue body wrapped in ``` for better formatting. It should look similar to this:

$ youtube-dl -v <your command line>
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
[debug] youtube-dl version 2015.12.06
[debug] Git HEAD: 135392e
[debug] Python version 2.6.6 - Windows-2003Server-5.2.3790-SP2
[debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
[debug] Proxy map: {}
...

Do not post screenshots of verbose log only plain text is acceptable.

The output (including the first lines) contains important debugging information. Issues without the full output are often not reproducible and therefore do not get solved in short order, if ever.

@dstftw dstftw closed this Mar 9, 2016
@schlingel
Copy link
Author

@schlingel schlingel commented Mar 9, 2016

Should I open a new case or do you reopen it?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 9, 2016

You explicitly told youtube-dl not to download playlist thus you'll not have anything downloaded apart from the video LIcBlkncCMw.

[youtube:playlist] Downloading just video LIcBlkncCMw because of --no-playlist

@schlingel
Copy link
Author

@schlingel schlingel commented Mar 9, 2016

That's right and I don't object to that.

It's what I want because the ruby script does a few things like ignoring private videos and setting id3 tags. It iterates over an object list, containing urls like the above and the title. (See attached ZIP file with ruby script for details)

But I don't see why that should cause youtube-dl to download a mp3 file without audio - which it does on my OSX box. Even if I execute youtube-dl directly in the terminal with the given command above it doesn't work - audio is missing for the file downloaded.

Do I use the tool wrong?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 9, 2016

Private videos and any other that cause errors can be skipped with -i.
So does it work for the first video or does not work at all? Decide already.
You also should never hardcode the extension in output template but rather use %(ext)s.

@schlingel
Copy link
Author

@schlingel schlingel commented Mar 9, 2016

Sorry, thought you'd had read my description above: It depends. If I run the script the first time, the first download works. After that it doesn't.

Thanks for the pointer with the extension.

@Hrxn
Copy link

@Hrxn Hrxn commented Mar 9, 2016

Your playlist, if you use it from your script, is just a file with URLs, correct?

Because then you could also try youtube-dl --extract-audio --audio-format mp3 -a YourPlaylist

-a or --batch-file

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 9, 2016

You should clearly state your problem. From

The problem is that after the first video the files do not have any audio.

it's impossible to decipher that you are passing bunch of video/playlist URLs in row but not misusing the behavior of a single playlist URL with --no-playlist (we just can't afford reading and deciphering the code of all the 3rdparty scripts written in all kinds of languages).
Anyway if this is due to hardcoded extension it should not work at all and should not be platform specific - ffmpeg is the same everywhere. YouTube does not serve mp3 so webm/m4a will be downloaded and conversion with ffmpeg will always take place and extension here is the key ffmpeg uses for it.

@schlingel
Copy link
Author

@schlingel schlingel commented Mar 9, 2016

Ah, that explains the issue. But I can't wrap my head around the clumsy interface. If I define the output file explicitly as a mp3 file, why should I use a wild card?

That eases the internal handling for youtube-dl, but doesn't make much sense from a user point of view. I want to define the final output name, not the internal handling path of youtube-dl.

And you're right. The player I used on Linux seems to parse the file headers and ignore the file extension. iTunes doesn't, apparently.

Thanks for the grumpy help.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 9, 2016

Output template specifies the template for files that will be downloaded not files that will be created after postprocessing (i.e. audio extraction in your case). You've already specified --audio-format to be mp3 and should not specify it anywhere else.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.