Using
ffmpeg_streaming
module in Python web project with Flask, I try to set up video streaming from online camera into local file. My purpose is saving input stream that comes as HLS-compatible data. To implement this property, I've inserted some code accessible by this
link
import ffmpeg_streaming
from ffmpeg_streaming import Formats, Bitrate, Representation, Size
from flask import render_template, Flask, send_from_directory, abort, json, Response
import sys
app = Flask(__name__)
video = ffmpeg_streaming.input('http://wmccpinetop.axiscam.net/mjpg/video.mjpg')
_480p = Representation(Size(854, 480), Bitrate(750 * 1024, 192 * 1024))
hls_stream = video.hls(Formats.h264(), hls_list_size = 10, hls_time = 5)
hls_stream.representations(_480p)
hls_stream.output('/var/media/hls_outputs.m3u8')
It works as expected, i.e. video stream gets written into local file, then I can see what camera shot somewhere far from there...But an only problem arises here which I can't manage: once playback starts, the video is being displayed utterly fast. Nearly 2 minutes period covered by camera (I can see how long real time was over due to camera-embedded timer option) has duration of 5 seconds when playing back. So, how do I want to enable video speed just as it fits into real-world timing? My OS is Ubuntu 18.04 LTS and I open file with preinstalled `Videos` app to watch content.
What I have tried:
I've tested this program with various
hls_list_size
and
hls_time
params as well, but the problem seems as if having nothing to do with them. In Internet, there is no information how to deal with that immediately in Python code also.