mps-youtube / pafy

Python library to download YouTube content and retrieve metadata
1.38k stars 315 forks source link

pafy not displaying full list of formats #138

Open msemple1111 opened 8 years ago

msemple1111 commented 8 years ago

Bug: I'm trying to download a music video. Upon running both the python version and command line version, I don't seem to be able produce the full list of "normal" and "audio" stream qualities. The video is 1080p with a max audio of 256kb/s. I have tried this on another 1080p video with the same problem. On a 720p video the problem does not occur.

I have reproduced this on my Mac laptop successfully. I am on Mac OSX 10.10.5 Python 3.4.2

import pafy

url = "https://www.youtube.com/watch?v=ghaW1Rp639I"
video = pafy.new(url)

allstreams = video.allstreams
for s in allstreams:
    print(s.mediatype, s.extension, s.quality)

Outputs:

audio webm 50k
audio webm 70k
audio webm 128k
audio m4a 128k
audio webm 160k
video mp4 256x144
video webm 256x144
video mp4 426x240
video webm 426x240
video webm 640x360
video mp4 640x360
video webm 854x480
video mp4 854x480
video webm 1280x720
video mp4 1280x720
video webm 1920x1080
video mp4 1920x1080
normal 3gp 176x144
normal 3gp 320x180
normal flv 426x240
normal webm 640x360
normal mp4 640x360
normal mp4 1280x720

Look how the is "video mp4 1920x1080" but no "normal mp4 1920x1080" or "audio m4a 256k" I know this video can be played in 1080p but why there is no "normal" 1080p entry?

ids1024 commented 8 years ago

Above 720p, YouTube does not have normal streams. The player streams audio and video separately and combines them.

msemple1111 commented 8 years ago

How come the audio only goes upto 160k? I thought that video went upto 256k. P.S. Why does youtube do this?

ids1024 commented 8 years ago

I don't know about the audio. Are you sure it is not just that that specific video does not have a 256k version?

https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP