[Live-devel] FramedFilter Performance & Questions
Julian Lamberty
julian.lamberty at mytum.de
Sat Jun 23 12:27:03 PDT 2007
Hi!
I've implemented a FramedFilter subclass that transcoders video from
MPEG-2 to MPEG-4 using the libavcodec library.
Therefore I use a live-"chain" that looks like:
MPEG1or2VideoRTPSource -> Transcoder (my class) ->
MPEG4VideoStreamDiscreteFramer -> MPEG4ESVideoRTPSink
The Transcoder's structure is:
//Begin Code
doGetNextFrame()
{
gettimeofday(begin_frame, NULL);
fInputSource->getNextFrame(..., afterGettingFrame, ...);
}
afterGettingFrame(void* clientData, unsigned numBytesRead, ...)
{
Transcoder* transcoder = (Transcoder*)clientData;
transcoder->afterGettingFrame1(numBytesRead, ...);
}
afterGettingFrame1(unsigned numBytesRead, ...)
{
size = numBytesRead;
while(size > 0)
{
gettimeofday(&begin_decoding_slice, NULL);
dec_bytes = decode();
size -= dec_bytes;
gettimeofday(&end_decoding_slice, NULL);
decoding_frame_time += decoding_slice_time;
if(got_frame)
{
decoding_frame_time = 0;
gettimeofday(&begin_encoding_frame, NULL);
enc_bytes = encode();
gettimeofday(&end_encoding_frame, NULL);
memcpy(fTo, outbuf, ...);
frame_ready = true;
}
}
if(!frame_ready)
{
fInputSource->getNextFrame(..., afterGettingFrame, ...);
}
else
{
frame_ready = false;
afterGetting(this);
gettimeofday(&end_frame, NULL);
}
}
//End Code
From the timevals inserted I calculate decoding, encoding and total
frame processing time.
While decoding takes between 3ms and 10ms per frame and encoding takes
between 8ms and 15ms per frame, the total processing time is sometimes
greater than 50ms and exceeds the sum of decoding and encoding time by
more than 15ms or even more.
This seems to be quite much just for fetching new data from the
source... where could this come from? With more than 40ms average
processing time the Transcoder loses the ability to do his work in
real-time.
Another question: Can I use a MPEG1or2VideoStreamFramer after the
MPEG1or2VideoRTPSource, so that I can pass complete frames into the
decoder instead of chunks?
Thanks
Julian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5198 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.live555.com/pipermail/live-devel/attachments/20070623/10a3d675/attachment.bin
More information about the live-devel
mailing list