Mailing List Archive

Finding out the length (in min) of saved encoder (MP2) file?
Since my knowledge of the details of the MP2 stream produced by a caputure card
(+ ivtv) driver is rather vague so before I start to immerse myself in standards
documents I was wondering if there is some "shortcut" to find out the overall
length (in min or sec) for a saved MP2 file from the capture card without having
to write a (semi-) complete MP2 decoder onseself?

I'm thinking of using the libmpeg2 but before I start analysing the headers and
example programs (there is no documentation) I thought I would ask.

It doesn't have ot be precise on the second; +/- 1 min accuracy is good enough
for my purposes.

/Johan


_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: Finding out the length (in min) of saved encoder (MP2) file? [ In reply to ]
On Tue, 2010-02-23 at 14:55 +0100, Johan Persson wrote:
> Since my knowledge of the details of the MP2 stream produced by a caputure card
> (+ ivtv) driver is rather vague so before I start to immerse myself in standards
> documents I was wondering if there is some "shortcut" to find out the overall
> length (in min or sec) for a saved MP2 file from the capture card without having
> to write a (semi-) complete MP2 decoder onseself?
>
> I'm thinking of using the libmpeg2 but before I start analysing the headers and
> example programs (there is no documentation) I thought I would ask.

In the ivtv-utils source, there is a ps-analyzer utility which dumps out
a lot of information (e.g. timestamps of every frame), but at the end
you get this:

Statistics:

video frames: 554
audio frames: 436
private packets: 554
total time: 18.35 seconds


> It doesn't have ot be precise on the second; +/- 1 min accuracy is good enough
> for my purposes.

A fellow on the linux-media list just provided a patch to correct some
time reference decoding problems in ps-analyzer, but I have not checked
it in yet.

Check the output of the current ps-analyzer against known sample mpegs
that you have timed yourself.

Regards,
Andy

> /Johan



_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: Finding out the length (in min) of saved encoder (MP2) file? [ In reply to ]
Hi,

Am 23.02.2010 15:41, schrieb Andy Walls:
> On Tue, 2010-02-23 at 14:55 +0100, Johan Persson wrote:
>> Since my knowledge of the details of the MP2 stream produced by a caputure card
>> (+ ivtv) driver is rather vague so before I start to immerse myself in standards
>> documents I was wondering if there is some "shortcut" to find out the overall
>> length (in min or sec) for a saved MP2 file from the capture card without having
>> to write a (semi-) complete MP2 decoder onseself?
>>
>> I'm thinking of using the libmpeg2 but before I start analysing the headers and
>> example programs (there is no documentation) I thought I would ask.
>
> In the ivtv-utils source, there is a ps-analyzer utility which dumps out
> a lot of information (e.g. timestamps of every frame), but at the end
> you get this:
>
> Statistics:
>
> video frames: 554
> audio frames: 436
> private packets: 554
> total time: 18.35 seconds
>
>
>> It doesn't have ot be precise on the second; +/- 1 min accuracy is good enough
>> for my purposes.
>
> A fellow on the linux-media list just provided a patch to correct some
> time reference decoding problems in ps-analyzer, but I have not checked
> it in yet.

You find the patch here:
http://www.spinics.net/lists/linux-media/msg15744.html

Regards,
Lars.

>
> Check the output of the current ps-analyzer against known sample mpegs
> that you have timed yourself.
>
> Regards,
> Andy
>
>> /Johan
>
>
>
> _______________________________________________
> ivtv-users mailing list
> ivtv-users@ivtvdriver.org
> http://ivtvdriver.org/mailman/listinfo/ivtv-users
>

_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: Finding out the length (in min) of saved encoder (MP2)file? [ In reply to ]
----- Original Message -----
From: "Johan Persson" <johanp@aditus.nu>


> Since my knowledge of the details of the MP2 stream produced by a caputure
card
> (+ ivtv) driver is rather vague so before I start to immerse myself in
standards
> documents I was wondering if there is some "shortcut" to find out the
overall
> length (in min or sec) for a saved MP2 file from the capture card without
having
> to write a (semi-) complete MP2 decoder onseself?

http://mediainfo.sourceforge.net/


_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users
Re: Finding out the length (in min) of saved encoder (MP2) file? [ In reply to ]
Thanks for the replies,

I should probably have made it clear that I'm going to do this programatically,
i.e. I need to include it with some c-code with a unix daemon (tvpvrd).

The rationale for wanting this is that one of the functionalities of the daemon
is transcoding and since the daemon collects statistics about how long time it
takes to do transcoding with diffrent profiles I want to give the user an
estimate (based on past history) how long it will (roughly) take to encode a
certain video given it's length (in time) and the current load on the server.

I guess I could do (for example) a popen() and execute the 'ps-analyzer' (thanks
for the tip!) but that would then require an end user to have that installed in
order to get this functionality so that is a dependency I would rather avoid.

So It looks like I should review the internals of ps-analyze and try to copy the
parts of the analysis that collects the different frames and calculates the
overall length ... the kind of code I would have hoped not to have to write :-)

Cheers
Johan



_______________________________________________
ivtv-users mailing list
ivtv-users@ivtvdriver.org
http://ivtvdriver.org/mailman/listinfo/ivtv-users