We can play video files directly from the worldwide web with OpenCV using the cv2.VideoCapture() function. OpenCV does not have default sound support as it is a computer vision library. You can manipulate the frames directly from the stream, but if the frame manipulation is too computationally expensive the video will lag.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#! /usr/bin/python
import cv2
vc = cv2.VideoCapture('https://archive.org/download/bliptv-20131014-102441-Brigittedale-WhatToTalkAbout167/bliptv-20131014-102441-Brigittedale-WhatToTalkAbout167.mp4')
c=1
fps = 24
if vc.isOpened():
rval , frame = vc.read()
else:
rval = False
while rval:
rval, frame = vc.read()
cv2.imshow("Result",frame)
cv2.waitKey(1000 / fps);
vc.release()
|