videos with highest resolution cannot be played by vlc player
See original GitHub issueI really like VLC player because it has slow motion, and it is very simple so getting videos to work with VLC player using pytube is a must. In any case, I noticed that the following syntax does not get the stream with the best resolution:
yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download( save_path)
So I came up with the following:
`mp4files = yt.streams.filter(subtype=‘mp4’).all()
dct = {}
for f, stream in enumerate(mp4files):
res = stream.fmt_profile['resolution']
if res:
num = int(res[:-1])
dct.setdefault(num, []).append(f)
highest = max(dct.keys())
stream_num = dct[highest][0]
mp4files[stream_num].download(save_path)`
However, the video downloaded by this code can be played by itunes and quicktime but not vlc player. What happens with the VLC player is that the video name will appear in its library but when you click on it nothing happens. When you download a stream which has 360p it can be played by the VLC player. The only differences between the two streams is that the 1080p stream has the following properties:
mp4files[1].is_progressive = False mp4files[1].codecs = [‘avc1.640028’] mp4files[1].fmt_profile[‘resolution’] = ‘1080p’ mp4files[0].is_progressive = True mp4files[0].fmt_profile[‘resolution’] = ‘360p’ mp4files[0].codecs = [‘avc1.640028’, ‘mp4a.40.2’]
Also, is this a github bug? When I put backticks around the above code it gets cut-off like so:
mp4files[1].is_progressive = False mp4files[1].codecs = ['avc1.640028'] mp4files[1].fmt_profile['resolution'] = '1080p' mp4files[0].is_progressive = True mp4files[0].fmt_profile['resolution'] = '360p' mp4files[0].codecs = ['avc1.640028', 'mp4a.40.2']
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Actually the video with 1080 resolution does not have audio.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.