Bitrate of a stream

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bitrate of a stream

SR.OR4CL3
Hi, a need get a bitrate of a stream, i'm use the below code

import gst

host="127.0.0.1"
port=1234
p = "videotestsrc ! rtpvrawpay ! udpsink host=%s port=%s" %(host, port)

pipeline = gst.parse_launch(p)
udpsink = pipeline.get_by_name("udpsink0")

def print_stats():
    data = udpsink.emit("get_stats", host, port)
    stats = "bytes_sent: %s, packets_sent: %s, connect_time: %s"
%(data[0], data[1], data[2])
    print stats
    return True

import gobject
gobject.timeout_add_seconds(1, print_stats)

pipeline.set_state(gst.STATE_PLAYING)

import gtk
gtk.main()

But, he don't give me a bitrate, someone could help me ? ?????



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Bitrate of a stream

Nicolas Dufresne-5
Le mercredi 13 décembre 2017 à 04:27 -0700, SR.OR4CL3 a écrit :

> Hi, a need get a bitrate of a stream, i'm use the below code
>
> import gst
>
> host="127.0.0.1"
> port=1234
> p = "videotestsrc ! rtpvrawpay ! udpsink host=%s port=%s" %(host,
> port)
>
> pipeline = gst.parse_launch(p)
> udpsink = pipeline.get_by_name("udpsink0")
>
> def print_stats():
>     data = udpsink.emit("get_stats", host, port)
It's named "get-stats", I'm surprise it didn't abort.

>     stats = "bytes_sent: %s, packets_sent: %s, connect_time: %s"
> %(data[0], data[1], data[2])

I don't think you can read a GstStructure like this.

>     print stats
>     return True
>
> import gobject
> gobject.timeout_add_seconds(1, print_stats)
>
> pipeline.set_state(gst.STATE_PLAYING)
>
> import gtk
> gtk.main()
>
> But, he don't give me a bitrate, someone could help me ? ?????
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bitrate of a stream

Arjen Veenhuizen
I see that you are using gstreamer 0.10 which is really ancient. consider
switching to 1.x as soon as possible.

In 0.10 it indeed was called "get_stats" and you used this snippet as a
basis:
https://lists.freedesktop.org/archives/gstreamer-devel/2009-October/024209.html 

To get the bitrate, you should do the calculation yourself based on total
bytes sent and the time that has passed. AFAIK it is not included in the
"stats" emitted by udpsink





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel