0

I tried using How to to play videos from the web using Opencv and python and Is it possible to stream video from https:// (e.g. YouTube) into python with OpenCV? But didnt work

This below worked

os.system('mpv some_url') 

This uses mpv to play video from url but I want to use youtube-dl to do this. I know mpv uses YouTube-dl to play the video from url but when using yt-dl it only downloads the video.

I want to watch video without downloading (like mpv).Also open to use other modules. No vlc or mpv(as I have reasons not to use them) .

Here's my ytdl code which downloads the video

from __future__ import unicode_literals
import youtube_dl

ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc'])
Devil Ishere
  • 185
  • 1
  • 13
  • Does this answer your question? https://www.geeksforgeeks.org/playing-youtube-video-using-python/ – HerrAlvé Mar 07 '22 at 13:04
  • `No vlc or mpv(as I have reasons not to use them)` – Devil Ishere Mar 07 '22 at 13:16
  • Please clarify (to yourself at least) what you mean by "downloading". I guess you mean "saving to disk as a file". Streaming video, reading webpages, are actually downloading: they pull bytes through the internet into your pc, and someone pays for that. It seems better to save as a file, so you can watch, listen, or read again later without having to pull them thru the internet again. (This doesn't answer your question, just mentioned it in case the clarification might help.) – j77h Nov 09 '22 at 10:02

0 Answers0