Frame by frame stepping question

Fuerntratt, Hermann hermann.fuerntratt at joanneum.at
Fri Apr 6 13:20:00 UTC 2018


I try to understand how frame-wise stepping could work, but I can't figure it out properly.
Maybe some wise man/woman can shed more light on my problem.

I use lib version 1.10.3 on Windows 8.1 (VS2013) to create a pipeline in my C++ app that looks like
filesrc location=d:/testvideo.mp4 ! decodebin ! videoconvert ! autovideosink name=video-sink
which plays a video containing 300 frames with 30 fps.

In my code, I set the pipeline into PLAY mode, check if the pipeline is prerolled, and then I call

if(this->syncmode == SyncMode::type::AsFastAsPossible)
{
    cout << "Start single step events" << endl;
    if(this->singlestepsink == nullptr)
    {
        this->singlestepsink = (GstElement*)gst_bin_get_by_name((GstBin*)this->pipeline, "video-sink");
        if(this->singlestepsink == nullptr)
        {
            this->singlestepsink == this->pipeline;
        }
    }
    gst_element_send_event(this->singlestepsink, gst_event_new_step(GST_FORMAT_BUFFERS, 1, this->rate, TRUE, FALSE));
}

In my event message loop I check, if the step has been completed and trigger the next step if possible:

case GST_MESSAGE_STEP_DONE:
{
    gdouble rate;
    GstFormat format;
    guint64 amount, duration;
    gboolean flush, intermediate, eos;

    gst_message_parse_step_done(message, &format, &amount, &rate, &flush, &intermediate, &duration, &eos);

    if(this->isopen && this->syncmode == SyncMode::type::AsFastAsPossible && !eos)
    {
        cout << "Send next step event, framecounter =  "<< ++framecounter << endl;
        if(this->singlestepsink != nullptr)
        {
            gst_element_send_event(this->singlestepsink, gst_event_new_step(GST_FORMAT_BUFFERS, 1, this->rate, TRUE, FALSE));
        }
    }
}
break;

In general, it works, but the number of frames that are handled are not always 300.
So the pipeline drops frames, e.g. with this pipeline:
filesrc location=d:/testvideo.mp4 ! decodebin ! videoconvert ! fakesink name=video-sink

only 16 of the 300 frames are done.
The number of stepped frames is also rate-dependent
if this->rate is 1.0 then only 200 frames of the 300 are done.
if this->rate is 10.0 then all 300 frames are done.

So can someone please tell me, what's required to reliably step through all frames?

Cheers,
Hermann

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180406/01e736c3/attachment.html>


More information about the gstreamer-devel mailing list