<div dir="ltr"><div><div><div>Hi,<br></div>I've been trying to use  gst_element_seek_simple() to move around in a video file.   I'm using gstreamer 1.8.2 on Windows 7 and 10 with  Visual Studio 2010.<br><br>I'm building the pipeline using gst_parse_launch ().<br><br>            gchar location[] = "C:\\temp\\test.h264";<br>            <br>            CustomData customdata;<br>            memset(&customdata, 0, sizeof(customdata));<br>    <br>            gst_init(NULL, NULL);<br>            gst_debug_set_threshold_from_string("video*:6", TRUE);<br>    <br>            GError *error = NULL;<br>            GstElement *pipeline = gst_parse_launch("filesrc name=src ! decodebin name=dec ! videoconvert name=conv ! autovideosink name=sink", &error);<br>    <br>            customdata.pipeline = pipeline;<br>    <br>            // set file<br>            GstElement *src = gst_bin_get_by_name(GST_BIN(pipeline), "src");<br>            g_object_set(src, "location", location, NULL);<br>            <br>            // <br>            GstElement *dec = gst_bin_get_by_name(GST_BIN(pipeline), "dec");<br>            if (dec) <br>            {<br>                g_signal_connect(dec, "pad-added", G_CALLBACK(cb_newpad), (gpointer)&customdata);<br>            }<br>    <br>            GstElement *conv = gst_bin_get_by_name(GST_BIN(pipeline), "conv");<br>            customdata.conv = conv;<br>    <br>            GstElement *sink = gst_bin_get_by_name(GST_BIN(pipeline), "sink");<br>            GstCaps *appsink_caps = gst_caps_from_string(APPSINK_CAPS);<br>            g_object_set(G_OBJECT(sink), "caps", appsink_caps, NULL);<br>            gst_caps_unref(appsink_caps);<br>    <br>            GstAppSink *appsink = (GstAppSink *)sink;<br>            gst_app_sink_set_max_buffers(appsink, 300); // limit number of buffers queued<br>            gst_app_sink_set_drop(appsink, true); <br>            GstStateChangeReturn ret = gst_element_set_state(pipeline, GST_STATE_PAUSED);<br>            GThread *main_loop_thread = g_thread_new("main_loop_thread", &thread_func_main_loop_run, (gpointer)&customdata);<br><br>I'm able to see video frames with this.  I have some code that lets me step through the video using gst_event_new_step().<br><br>I'm able to seek using GST_FORMAT_TIME and gst_element_seek_simple()<br>The following code returns true and I can see the video change to a new frame.<br>                success = gst_element_seek_simple(GST_FORMAT_TIME,<br>                                                  format,<br>                                                  (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SNAP_NEAREST),<br>                                                  position);<br><br><br>Switching to GST_FORMAT_BYTES, gst_element_seek_simple returns false <br><br>                success = gst_element_seek_simple(GST_FORMAT_BYTES,<br>                                                  format,<br>                                                  (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SNAP_NEAREST),<br>                                                  position);<br><br><br>debug output says there's a problem with converting <br><br>    0:03:40.267769863  4668 00000000035CD1E0 DEBUG           videodecoder gstvideodecoder.c:1671:gst_video_decoder_src_event:<avdec_h264-0> received event 51201, seek<br>    0:03:40.269860528  4668 00000000035CD1E0 DEBUG           videodecoder gstvideodecoder.c:1572:gst_video_decoder_src_event_default:<avdec_h264-0> received event 51201, seek<br>    0:03:40.272414995  4668 00000000035CD1E0 DEBUG           videodecoder gstvideodecoder.c:1812:gst_video_decoder_src_query:<avdec_h264-0> received query 20483, convert<br>    0:03:40.307895856  4668 00000000035CD1E0 LOG             videodecoder gstvideodecoder.c:1685:gst_video_decoder_src_query_default:<avdec_h264-0> handling query: convert query: 00000000035B3DD0, GstQueryConvert, src_format=(GstFormat)GST_FORMAT_BYTES, src_value=(gint64)713509, dest_format=(GstFormat)GST_FORMAT_TIME, dest_value=(gint64)-1;<br>    0:03:40.318774662  4668 00000000035CD1E0 DEBUG           videodecoder gstvideodecoder.c:1751:gst_video_decoder_src_query_default:<avdec_h264-0> convert query<br>    0:03:40.321472536  4668 00000000035CD1E0 ERROR           videodecoder gstvideodecoder.c:1797:gst_video_decoder_src_query_default:<avdec_h264-0> query failed<br>    0:03:40.353767622  4668 00000000035CD1E0 DEBUG           videodecoder gstvideodecoder.c:1656:gst_video_decoder_src_event_default:<avdec_h264-0> could not convert format<br><br><br>I'm new to gstreamer and I'm not sure what this means.  Presumably the byte format has to be changed into a time in the video.  Is there something I should be doing to make this conversion happen?    Trying to convert using gst_element_query_convert() gets me the same error message.      <br><br></div>Thanks,<br><br></div>Greg<br><div><div><div><div><br> <br><br></div></div></div></div></div>