[Live-devel] Mpeg1or2 Stream very jittery

Priya Raghavendra Priya_Raghavendra at mindtree.com
Wed Feb 9 02:20:54 PST 2011


Hi,

In our application we are receiving a live stream, doing a ffmpeg decode, doing some overlay on the video and then encoding it as a mpeg2 stream.
After this we are streaming the video using live.
The problem is that the video when viewed in VLC is very jittery.

So I analyzed the packets in wire shark and observed that the time stamp of each of the UDP packets is not in sequence.

Ex. Timestamp: 1487557790 - Frame n
      Timestamp: 1487554190 - Frame n + 1

For the next frame the timestamp will not be in sequence.

[cid:image001.jpg at 01CBC871.2288C740]

Why are the time stamps not in sequence when the packets are received?
I have observed that on the sending side, for every frame the fPresentationTime is in the correct sequence.
The code snippet from where I am reading the queue and updating the presentation time is given below.

 void LiveInputSource:: incomingDataHandler1()
{
    int ret;
    if (!isCurrentlyAwaitingData()) return ;

    ret = readData();
    if (ret < 0 )
    {
        handleClosure (this);
    }
    else if (ret == 0 )
    {
        int uSecsToDelay = 50000 ;
        nextTask() = envir().taskScheduler().scheduleDelayedTask (uSecsToDelay, (TaskFunc*)incomingDataHandler, this);
    }
    else {
        nextTask() = envir().taskScheduler().scheduleDelayedTask (0, (TaskFunc*)afterGetting, this);
    }
}

int LiveInputVideoSource:: readData()
{
    /* Get frame from queue */
    queue_get (frame, &frame_len);
    if (frame_len == 0)
    {
        return 0;
    }

    /* Copy frame to fTo */
    memcpy (fTo, frame, frame_len);
    fFrameSize = frame_len;

    gettimeofday (&fPresentationTime);
    return 1;
}

?       For MPEG2 we are using this class MPEG1or2VideoStreamDiscreteFramer.
So when I see this code I observe that a lot of manipulation is done to the presentation time. So is it possible that the time stamp values are getting jumbled here?
void MPEG1or2VideoStreamDiscreteFramer
::afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes,
                     struct timeval presentationTime,
                     unsigned durationInMicroseconds)

Thanks in Advance.

Regards,
Priya

________________________________

http://www.mindtree.com/email/disclaimer.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20110209/fab03bff/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 31597 bytes
Desc: image001.jpg
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20110209/fab03bff/attachment-0001.jpg>


More information about the live-devel mailing list