ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.73k stars 10.07k forks source link

Audio file not playable in VLC (2.0.8) when using --extract-audio #2288

Closed izkreny closed 9 years ago

izkreny commented 10 years ago

Hi!

After I did upgrade:

$ sudo pip install --upgrade youtube_dl
Downloading/unpacking youtube-dl
  Downloading youtube_dl-2014.01.30.2.tar.gz (281Kb): 281Kb downloaded
  Running setup.py egg_info for package youtube-dl

Installing collected packages: youtube-dl
  Found existing installation: youtube-dl 2014.01.21
    Uninstalling youtube-dl:
      Successfully uninstalled youtube-dl
  Running setup.py install for youtube-dl

    Installing youtube-dl script to /usr/local/bin
Successfully installed youtube-dl
Cleaning up...

I run this command:

$ youtube-dl -x http://www.youtube.com/watch?v=q8MqQWhKvpE
[youtube] Setting language
[youtube] q8MqQWhKvpE: Downloading webpage
[youtube] q8MqQWhKvpE: Downloading video info webpage
[youtube] q8MqQWhKvpE: Extracting video information
[download] Destination: Devendra Banhart - Never Seen Such Good Things-q8MqQWhKvpE.m4a
[download] 100% of 2.93MiB in 00:04
[youtube] Post-process file Devendra Banhart - Never Seen Such Good Things-q8MqQWhKvpE.m4a exists, skipping

Hint: pay attention to the last word in the last line above: skipping

And guess what? Audio file do not want to play in VLC media player 2.0.8 Twoflower (revision 2.0.8a-0-g68cf50b) @ Ubuntu 12.04.3 LTS.

Can somebody please try to reproduce this issue?

Thx!

jaimeMF commented 10 years ago

Ok, the problem is in de3ef3ed5865fb0579062b03c25354f2587c780f, we now download the file that only contains the audio (to save time) and use the m4a extension for it, that's why ffmpeg is not run. The problem is that most players don't play the DASH audio/video only files (at least mplayer plays them fine). In the meantime you can force to convert to other format using --audio-format aac (or your favourite format). @phihag Should we force to run ffmpeg if the downloaded file is DASH audio only?

izkreny commented 10 years ago

If you can setup youtube-dl to run ffmpeg on "file that only contains the audio" to make it playable in most players (i.e. replace DASH with M4A), that would be awesome---personally I definitely prefer as much untouched audio file as possible (i.e. -codec:a copy ffmpeg option).

Thx for your work, btw, yt-dl is excellent tool!

phihag commented 10 years ago

I can reproduce that the file is playable in mplayer, but not vlc. I'd like to find out where the fault lies (vlc or is the DASH format incompatible?), but as a workaround, how about specifying the ext .dashm4a for these files?

izkreny commented 10 years ago

I would say that it is definitely VLC's fault (at least in version I use, 2.0.8)---I could play MPEG-DASH .m4a file in Google Chrome 32.0.1700.102

izkreny commented 10 years ago

May I suggest that -x option stays as it were before, and that you add another new option, for example: --download-only-audio that would download MPEG-DASH .m4a file.

Although new -x behavior save download time, from some quick testing, it doesn't save bitrate, which is smaller, e.g., instead 191, it is 125. I can provide later more info about that if needed...

ghost commented 10 years ago

Noticed that NOT passing -k (aka --keep-video) only the .m4a (audio file) is downloaded(somehow) but deleted: Deleting original file Kirk Gadget - Hot Pursuit-L3j7qwyNRG8.m4a (pass -k to keep) (was this command: youtube-dl https://www.youtube.com/watch?v=L3j7qwyNRG8 --extract-audio -ctw --audio-format mp3 ) However passing -k doesn't 'cause the .m4a to be kept, but rather the .mp4 (video) first downloaded then kept. However the video is much larger(to download and store), here's to hoping for a way to keep only the .m4a file, thanks in advance.

ghost commented 10 years ago

Hey guys, someone(3dyd to be exact) just gave me an important(for me) piece of information:

Command:

ffmpeg.exe -i "Kirk Gadget - Hot Pursuit-L3j7qwyNRG8.m4a" -c:a copy xxx.m4a

will change format from dash to usual so foobar will be able to play it. This command will not transcode audio so you will not get any quality loss.

This makes the downloaded .m4a files work on foobar2000 (v1.3.1), while previously they were not working(they did work in media player classic home cinema and in vlc though, before this command, but not in foobar2000), they were showing this when not working: Could not load info (Unsupported format or corrupted file (array access out of range)) from: (file and path followed)

Is there any way to actually make youtube-dl execute something like this? (the key here is not transcoding the downloaded .m4a file) Thanks.

PS: if anyone's wondering 3dyd is the person who made foo_youtube component for foobar2000, which can be used to play the audio directly from a youtube URL, however it won't play the .m4a file directly (currently).

phihag commented 9 years ago

youtube-dl 2015.01.23.4 and newer will automatically correct the header of the m4a file if ffmpeg is present on the system. I am therefore closing this issue. See our FAQ if you need help updating. Thank you for the report!

izkreny commented 9 years ago

Thanks, it is working like a charm!