I am attempting to get the statistics from a broadcast using the python-vlc wrapper. I am currently able to establish a broadcast and connect a client to the broadcast, as well as get all of the relevant statistics from that client. However, I am not able to do so for the server which is broadcasting. I was wondering if anyone had a solution as to how to achieve this?
For reference, I shall post my code below.
The client:
Code: Select all
import vlc
import time
# url = "http://localhost:8080"
url = "rtp://239.0.0.1:5004"
Instance = vlc.Instance()
player = Instance.media_player_new()
Media = Instance.media_new(url)
Media.get_mrl()
player.set_media(Media)
player.play()
stats = vlc.MediaStats()
while True:
did_stats_update = vlc.libvlc_media_get_stats(Media, stats)
if did_stats_update:
updated_stats = get_all_media_stats(stats) #Just a function which maps all the stats into a dictionary
print(updated_stats)
time.sleep(0.2)
Code: Select all
import vlc
import time
mrl = "titled_tuesday.mp4"
broadcast_name = "Test1"
output_psz = "#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:rtp{dst=239.0.0.1,port=5004,mux=ts,sap,name=Test}"
Instance = vlc.Instance()
Instance.vlm_add_broadcast(broadcast_name, mrl, output_psz, 0, [], True, True)
broadcast = Instance.vlm_play_media(broadcast_name)
while True:
time.sleep(0.2)
Any help would be appreciated.
EDIT: In particular, I'm interested in extracting the "send_bitrate", "sent_bytes" and "sent_packets" values from the server