multifilesink keyframe capture 10 seconds delay

alex liu alexstreaming2015 at gmail.com
Wed Dec 9 13:22:42 PST 2015


Hi everyone,

    I am trying to capture snapshots from a live streaming source and store
them in jpeg files on android devices. I tried the pipeline below with
"multifilesink".

    udpsrc->rtph264depay->avdec_h264->videoconvert->jpegenc->multifilesink

    I set up the multifilesink properties

    g_object_set(G_OBJECT(filesink), "post-messages",TRUE, NULL);
    g_object_set(G_OBJECT(filesink), "max-files",1, NULL);
    g_object_set(G_OBJECT(filesink),
"next-file",GST_MULTI_FILE_SINK_NEXT_KEY_FRAME, NULL);

    so that when a keyframe comes in, the multfilesink posts a message.

    However, no matter how I set up the keyframe interval in my source
(which is 2 seconds now), I always had a delay of 10 seconds before the
keyframe was written to the file.

    I looked at how multifilesink is implemented in gstmultifilesink.c and
found the 10 seconds delay is hard coded:

    case GST_MULTI_FILE_SINK_NEXT_KEY_FRAME:	
      if (multifilesink->next_segment == GST_CLOCK_TIME_NONE) {
        if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) {
          multifilesink->next_segment = GST_BUFFER_TIMESTAMP (buffer) +
              10 * GST_SECOND;
        }
      }
      if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) &&
          GST_BUFFER_TIMESTAMP (buffer) >= multifilesink->next_segment &&
          !GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
        if (multifilesink->file)
          gst_multi_file_sink_close_file (multifilesink, buffer);
        multifilesink->next_segment += 10 * GST_SECOND;
      }

    I would like to change this to 2 seconds for instance but I don't know
how I can change the source code and then build the gstreamer library for
Android. I am new to gstreamer. Could any one point me to the right
direction? Or if there is a better approach to take snapshots than what I
present? 

Thank you

Alex


    

   

    



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/multifilesink-keyframe-capture-10-seconds-delay-tp4674844.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list