问题描述
我正在尝试测量通过网络播放视频时所需带宽的变化。为此,我需要绘制视频期间随时播放视频所需的带宽图表。
I am trying to measure the variation in the bandwidth required when a video is played over the network. For this purpose, i need to make a graph of the bandwidth required to play the video continuously at any time during the video.
我尝试使用gstreamer处理视频,但是它给了我已解码[未编码]视频的比特率,该比特率或多或少是恒定的。
I tried processing the video with gstreamer but it gives me the bit rate of the decoded[not encoded] video which is more or less constant.
有没有一种方法可以获取一段时间内视频的编码比特率?
Is there a way to get the encoded bit rate of a video over time?
推荐答案
由于我在这里没有答案,因此我将发布自己找到的解决方案,以便对他人有所帮助。
Since i got no answers here, i will post the solution that i found for myself so that it may help others.
向vlc媒体播放器公开python api。它们还提供MediaStats类,该类可用于确定视频统计信息。
Vlc python bindings expose a python api to the vlc media player. They also provide a MediaStats class that can be used to determine video statistics.
class MediaStats(_Cstruct):
_fields_ = [
('read_bytes', ctypes.c_int ),
('input_bitrate', ctypes.c_float),
('demux_read_bytes', ctypes.c_int ),
('demux_bitrate', ctypes.c_float),
('demux_corrupted', ctypes.c_int ),
('demux_discontinuity', ctypes.c_int ),
('decoded_video', ctypes.c_int ),
('decoded_audio', ctypes.c_int ),
('displayed_pictures', ctypes.c_int ),
('lost_pictures', ctypes.c_int ),
('played_abuffers', ctypes.c_int ),
('lost_abuffers', ctypes.c_int ),
('sent_packets', ctypes.c_int ),
('sent_bytes', ctypes.c_int ),
('send_bitrate', ctypes.c_float),
]
这篇关于绘制视频的编码比特率与播放位置的关系图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!