[Live-devel] Http/Mjpeg to Rtsp/Mpeg4 video transcoding latency
Steven Yang
steven at avd.com.au
Sun Oct 21 03:57:06 PDT 2012
Hi
Im currently working on a OSX project to transcode Mjpeg from IP camera to RTSP mpeg4 with libavcodec
The Stream from camera is 1280x960 at 4fps.
I implemented the subclass of FrameSource and use MPEG4DescreteVideoFramer and feed FramerSource
Mjpeg streaming and encoding is done in separate thread and the output AVPackets are stored in a que
FramedSource::doGetNextFrame check if there is any packet in the que and deliver it, otherwise schedule a delayed call on FramedSource::doGetNextFrameStatic to do frame checking again.
the program works but got serious latency problem (3~12 seconds ), seen from FFplay it complains 100+ RTP packet lost.
1.For comparision I tried ffserver+ffmpeg the latency is ~1seconds. FFplay complains RTP lost too but much less 1~2 packet lost.
2. In my implementation, I can confirm the mjpeg receiving/decoding and mpeg4 encoding too less than 100ms for each frame.
3. I notice doNextFrame often couldn't get data and issue a delayed retry, the problem is it is called repeatedly more than 20 times per seconds since I use 0ms delay, wondering this could be the problem? I did tried 100ms but seems doesn't really help... Is it possible doGetNextFrame is called too frequently?
Is there any other reason can cause the problem?
PS: I'm running EVERYTHING on a MacBook Pro with 2.4Ghz CPU and 8GB ram.
Thanks!
Regards
Steven
Sent from my iPhone
More information about the live-devel
mailing list