Getting broadcast statistics from a broadcast

This forum is about all development around libVLC.
MarkFitz76
New Cone
New Cone
Posts: 2
Joined: 29 Sep 2021 17:22

Getting broadcast statistics from a broadcast

Postby MarkFitz76 » 29 Sep 2021 17:33

Hello,

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)
The server:

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)
Basically, I need to be able to get the Media() object that could result from adding a broadcast, in order to invoke vlc.libvlc_media_get_stats(Media, stats), but have no idea how to do so.

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

MarkFitz76
New Cone
New Cone
Posts: 2
Joined: 29 Sep 2021 17:22

Re: Getting broadcast statistics from a broadcast

Postby MarkFitz76 » 30 Sep 2021 12:46

Just to update this, I have attempted to broadcast a video using the vlcj tool. Whenever succesfully connecting a client to a server using either rtp or http, the broadcast statistics remain 0, even as the other statistics for it update. I think this is a bug

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: Getting broadcast statistics from a broadcast

Postby unidan » 04 Oct 2021 15:22

Hi, you stumble upon https://code.videolan.org/videolan/vlc/-/issues/17888

Unfortunately, it's a bit hard to fix right now. :/


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 16 guests