1

我試圖測量通過網絡播放視頻時所需的帶寬變化。爲此,我需要製作視頻過程中隨時播放視頻所需的帶寬圖。視頻編碼比特率與播放位置的繪製圖

我試着用gstreamer處理視頻,但它給了我大致恆定的解碼[未編碼]視頻的比特率。

有沒有辦法獲得視頻編碼比特率隨着時間的推移?

回答

1

因爲我在這裏沒有答案,所以我會發布我自己找到的解決方案,以便它可以幫助他人。

Vlc python bindings向vlc媒體播放器公開python api。他們還提供可用於確定視頻統計信息的MediaStats類。

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), 
]