2

What is the most convenient way to capture a video streamed in the browser with a frame rate around 15? I would like to avoid to capture the raw screen because I should play with x,y, width, height. I would like to have something less manual.

Edit The URL is unavailable, I can only access the player that shows the streaming in the browser.

D.Giunchi
  • 1,794
  • 2
  • 17
  • 22
  • So you want either a program to, given a URL, to either A) download the video or B) Capture frames within the browser window at a specified rate? – pookie Dec 16 '18 at 12:01
  • B) because the video comes from an internal player of the browser when I visit a specific site. The video comes from a streaming and not from a stored video with a link that I can use for downloading it. – D.Giunchi Dec 17 '18 at 13:05

1 Answers1

0

If you want to simply capture a video from a given URL and save it to disk, you can do this:

import urllib2
link_to_movie = 'https://somemovie.com/themovie.mp4'

file_name = 'themovie.mp4' 
response = urllib2.urlopen(link_to_movie)
with open(file_name,'wb') as f:
    f.write(response.read())

Then if you want to set the frame rate for that movie you just downloaded, use FFMPEG:

ffmpeg -y -r 24 -i seeing_noaudio.mp4 seeing.mp4

FFMPEG answer from here: https://stackoverflow.com/a/50673808/596841

pookie
  • 2,890
  • 5
  • 34
  • 70
  • unfortunately I don't have the link of the video. I can see the streaming from an internal player in a specific site. My idea is to capture it but I need to know automatically which part of the screen show the video, without doing it manually every time considering the position of the browser or the zoom factor, or parameters that can affect the capture. – D.Giunchi Dec 17 '18 at 13:08
  • @D.Giunchi Hmm, I'm not sure what you mean by "which part of the screen show the video". You mention position of the browser, so does that mean that the video plays in the browser... and you just want to record it? If so you can use a browser extension (https://www.techrepublic.com/article/how-to-record-your-browser-window-in-google-chrome/). If you do not want to scroll to find the video and hit play on the recorder, then try just download all videos: https://www.makeuseof.com/tag/capture-streaming-video-website-5-tools/ – pookie Dec 17 '18 at 15:44
  • the video is a streaming coming from a live event (can't handle anything a part seeing it)so no file to get. I would like to make some process while capturing it. The video is embedded in a window. Let's say I can code the size (if every time is opened at that specific size), but the position should be calculated considering the position of the element that contains the player. So the sequence of task would be "open the browser at some URL, press a button that starts the streaming, start grabbing in this external window the video showed to the user", do something with the sequence of images. – D.Giunchi Dec 17 '18 at 15:58