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

Why is "-f mp4" needed on some systems but not others? #5567

Closed
joeschmoe40 opened this issue May 1, 2015 · 4 comments
Closed

Why is "-f mp4" needed on some systems but not others? #5567

joeschmoe40 opened this issue May 1, 2015 · 4 comments

Comments

@joeschmoe40
Copy link

@joeschmoe40 joeschmoe40 commented May 1, 2015

Observe:

(On "system A", running Linux)
$ youtube-dl.py --version
2015.04.28
$ youtube-dl.py -j 'https://www.youtube.com/watch?v=K5QMjtgWdG0' | jq .url
null
$

Now, on "system B", another Unix-y system, running the same version of youtube-dl, the above command returns a valid/useful url. As far as I can tell, the only material difference between the two systems is that system A is running Python 2.7.3 while system B is running 2.7.2. Yet, it is system A that fails.

Now, I've tracked this down, and figured out that it has to do with video formats and that in the failure mode, the problem is that the "url" field is wrapped inside an array (I think that's the correct JSON term for what I think of as a "structure") and thus the very simple "jq" program doesn't find it. Unfortunately, I don't know enough "jq" to know how to parse into the structures and extract the "url" filed(s) therefrom.

But, I have figured out that if I add the option "-f mp4" to the command line (just before the "-j"), then the problem goes away (i.e. I get a valid URL from jq).

So, my questions are:

  1. What could account for the different behavior between the two systems?
    and
  2. Is there anything wrong with fixing it by adding in "-f mp4"?
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented May 1, 2015

youtube-dl now default to download and merge DASH video and audio if ffmpeg/avconv is installed, so if one of your systems has it it will try to download them. You can extract them from the requested_formats field (jq .requested_formats) or use -f best (see the last paragraph at the formats documentation).

@jaimeMF jaimeMF closed this May 1, 2015
@joeschmoe40
Copy link
Author

@joeschmoe40 joeschmoe40 commented May 1, 2015

youtube-dl now default to download and merge DASH video and audio if ffmpeg/avconv is installed, so if one of your systems has it it will try to download them.

Yep. That was it. The system in question has ffmpeg/avconv. Pretty weird behavior, but I got it now.

You can extract them from the requested_formats field (jq .requested_formats) or use -f best (see the last paragraph at the formats documentation).

"-f best" works (and looks better than -f mp4).
But "jq .requested_formats" still returns null for me. Hmmm...

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented May 1, 2015

But "jq .requested_formats" still returns null for me. Hmmm...

It only works for systems with ffmpeg (or if you use -f bestvideo+bestaudio). If you are using -f best, you need to run jq .url.

@joeschmoe40
Copy link
Author

@joeschmoe40 joeschmoe40 commented May 1, 2015

It only works for systems with ffmpeg (or if you use -f bestvideo+bestaudio). If you are using -f best, you need to run jq .url.

I got that, but I just typo'd. So, no worries.
BTW, the magic bullet is:

$ youtube-dl.py -j 'https://www.youtube.com/watch?v=K5QMjtgWdG0' | jq '.requested_formats[]|.url'
$

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
2 participants
You can’t perform that action at this time.