python-20 / video-downloader

A python application to download videos
GNU General Public License v3.0
9 stars 10 forks source link

Stream quality #45

Open cherylli opened 4 years ago

cherylli commented 4 years ago

I think we can just ignore progressive because you can download the same resolution with adaptive so we only need to worry about one thing.

Looking at using ffmpeg-python

AlexPHorta commented 4 years ago

I agree it's easier. Why ffmpeg?

https://pytube3.readthedocs.io/en/latest/api.html#pytube.query.StreamQuery.filter

This wouldn't serve? Or the purpose is different?

cherylli commented 4 years ago

Its the recommended one. Look here for Progressive vs Adaptive https://pytube3.readthedocs.io/en/latest/user/quickstart.html#working-with-streams although i've a new discovery i think.

AlexPHorta commented 4 years ago

Got it, merge video and audio.

cherylli commented 4 years ago

Still working on this. Now successfully download video and audio (adaptive), 2 separate files. However,

  1. The download is super slow
  2. ffmpeg is a binding for python, which means to combine the video and audio, ffmpeg has to be installed on the machine as well. For us its ok but if we ever need to distribute the software, will this be an issue? I would like some discussion on this. If its not ideal. We will have to only support progressive video download.

Can anyone try this and see if its super slow please?

>>> from pytube import YouTube
>>> yt = YouTube('https://www.youtube.com/watch?v=9bZkp7q19f0')
>>> stream = yt.streams.get_by_itag('137')
>>> stream.download()
chonix commented 4 years ago

Would it be a good idea to have it as a feature (adaptive downloads) if the ffmpeg binary is present? It can be part of the config file (put the full path if already in your system) or place the binary in the util/ffmpeg folder within the code? (or similar) I mean, capability to do will be present, and it will be enabled if the set conditions is true

cherylli commented 4 years ago

That's actually a good idea. Is there a way to just python to detect it or more like a user setting?

chonix commented 4 years ago

Im thinking we can do a path scan or rely on the which command... something maybe among the lines of this: https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python (most voted answer)