Play video stored in python web

Asked

Viewed 1,412 times

1

Imagine that I have video in a directory of a site and not in a tag , example: www.site.com/video.mp4, I can play this video using python + Tkinter ?

1 answer

1

In python, Voce can play videos with Opencv. I never used to play videos stored remotely, but if you can, just download the video (within the app itself) to the location of the application and run it, below an example of documentation:

# Playing Video from file 

import numpy as np
import cv2

cap = cv2.VideoCapture('vtest.avi')

while(cap.isOpened()):
    ret, frame = cap.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

If the video is on a network service, we have the livestreamer which is a lib (CLI) that allows you to capture streams from services like youtube, Dailymotion, etc, and vc can run on a VLC player or developed by vc.

  • No, my answer is for you to play videos via python, as Tkinter is native to python just you do the necessary adaptation.

  • Maybe I’ll fit a new question after my answer: "How to use Opencv with Tkinter?" But that does not invalidate my answer, quite the contrary, it is not?

  • By the way, you even have an answer to this question ("How to use Opencv with Tkinter?") in Stoen, see the answer here.

  • Do you agree? @nbro

  • I apologize to the author of the question @Caymmy, for having responded here in the comments as if he were the author of the mistaken comment.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.