Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: Determining transport stream bitrate.



Aurelian Pop wrote:


This is probably an off topic question, sorry I don't know who else to ask.
Does anyone know how to determine the bitrate of a specific PID in a Transport Stream. I have some transport streams that I recorded to disk and now I want to determine the bitrate of the individual PIDs. I know the total bitrate of the stream, and how many bits have occured thus far in both the stream and the PID that I need the bitrate for. I tried this:

bits of PID/(total bits in stream/stream bitrate)

and It doesn't seem to work.


Thanks in advance,
Jens Thomsen



The simples way is to count the number of packets having the desired PID, then
multiply this number with 188*8. The result represents the number of bits you
have in the stream defined by your PID. Then just divide that number with the
duration in seconds of your transport stream. That's it.

Another way is to look for the PCR values in the adaptation fields and do the
same calculation taking as reference the PCR. This is more precise, but maybe a
little bit more complicated.


Aurelian





I guess I should have been a little more clear. I would like to know the bitrate of certain PIDs
as I see them in the TS. The idea is that I could hook this program up to a live broadcast feed
and collect bitrate statistics real time. Collecting real time stats is probably easier to do,
because then all I have to do is this:

t1 = get current time (ns)
read packet(s)
t2 = get current time
numbits = (number of packets read * 188) * 8
bitrate = numbits/t2-t1

However in a prerecorded stream I don't have that luxury. As I indicated in my last message
This sohuld work:

bits of PID/(total bits in stream/stream bitrate)

because (correct me if I'm wrong):

(total bits in stream/stream bitrate) = number of seconds in TS thus far

So I want to figure out one algorithm that will work on live **and** prerecorded
Transport Streams.


Jens





--
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index