Unable to read get right video streaming values when using Python VLC C-Type bindings
Posted: 09 Aug 2017 07:34
I am trying to achieve following.
1) I have an apple HLS media server installed in remote server
2) On another server I am using Python VLC as my client and trying to do a video streaming.
3) Streaming works fine. But while streaming I am not able to get media values like "Bit rate", "frame rate (fps)", get_stats etc. It is returning zero/wrong values.
Any help will be appreciated. I am sharing the code below.
Output
1) I have an apple HLS media server installed in remote server
2) On another server I am using Python VLC as my client and trying to do a video streaming.
3) Streaming works fine. But while streaming I am not able to get media values like "Bit rate", "frame rate (fps)", get_stats etc. It is returning zero/wrong values.
Any help will be appreciated. I am sharing the code below.
Code: Select all
def videoStream(mediaDir):
Instance = vlc.Instance("--no-video")
player = Instance.media_player_new()
#URL=("https://192.168.106.16/mediaContent/" + mediaDir + "/mediaFilePlaylist.m3u8")
URL=("http://192.168.106.16/mediaContent/" + mediaDir + "/sample.mp4")
#media = Instance.media_new('http://192.168.106.16/mediaContent/media-1/mediaFilePlaylist.m3u8')
media = Instance.media_new(URL)
media.get_mrl()
player.set_media(media)
player.play()
time.sleep(10)
status=player.is_playing()
while status==1:
print('State: %s' % player.get_state())
#print('media: %s' % bytes_to_str(media.get_mrl()))
#print('Current time: %s/%s' % (player.get_time(), media.get_duration()))
print('Rate: %s' % player.get_rate())
print('FPS: %s' % player.get_fps())
#print('Video Statistics: %s' % media.get_stats())
#print player.get_position()
#print player.get_time()
#print media.get_stats(vlc.mediaStats)
time.sleep(5)
Code: Select all
State: State.Playing Rate: 1.0 FPS: 0.0