error 'not-linked' for appsrc
Gary Metalle
Gary.Metalle at rvl.co.uk
Thu Jul 16 17:27:50 UTC 2020
Hi
I'm trying to set-up a video encoder pipeline using an appsrc to squirt in raw video from my app and then extract the encoded frames from an appsink:
appsrc -> rawvideoparse -> x264enc -> appsink
I've attached a log of everything of interest (sorry for the formatting, it wasn't taken from a terminal window and has the escape chars in. Sublime has a nice syntax plugin for displaying it but for some reason you can't copy it grrr).
The last few lines of the log are pasted below and below that is a snippet from the source code configuring the pipeline.
It feels like it's a caps issue but I can't see anything too obvious. I have tried without the rawvideoparse element as well and it makes no difference.
I have followed the same code pattern as the basic-tutorial-8.c<https://gstreamer.freedesktop.org/documentation/tutorials/basic/short-cutting-the-pipeline.html?gi-language=c> example for the most part but it's an audio example, not video.
As a test I removed the appsrc and replaced it with a videotestsrc and that worked fine so I'm happy with the appsink.
Any suggestions would be gratefully received.
Gary.
0:00:08.016851745 [334m 8181[00m 0x7fff6c007ad0 [32;01mFIXME [00m [00;04m default gstutils.c:3981:gst_pad_create_stream_id_internal:<video_source:src>[00m Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:08.016924133 [334m 8181[00m 0x7fff6c007ad0 [36mINFO [00m [00;01;31;41m GST_PADS gstpad.c:4232:gst_pad_peer_query:<video_source:src>[00m pad has no peer
0:00:08.016991764 [334m 8181[00m 0x7fff6c007ad0 [36mINFO [00m [00;01;34m GST_EVENT gstevent.c:814:gst_event_new_caps:[00m creating caps event video/x-raw, format=(string)I420, framerate=(fraction)15/1, pixel-aspect-ratio=(fraction)1/1, width=(int)352, height=(int)288
0:00:08.017022797 [334m 8181[00m 0x7fff6c007ad0 [36mINFO [00m [00;01;34m GST_EVENT gstevent.c:895:gst_event_new_segment:[00m creating segment event default segment start=0, offset=0, stop=-1, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0, base=0, position 0, duration -1
0:00:08.017057838 [334m 8181[00m 0x7fff6c007ad0 [36mINFO [00m [00m basesrc gstbasesrc.c:2945:gst_base_src_loop:<video_source>[00m marking pending DISCONT
0:00:08.017280495 [334m 8181[00m 0x7fff6c007ad0 [36mINFO [00m [00m basesrc gstbasesrc.c:2965:gst_base_src_loop:<video_source>[00m pausing after gst_pad_push() = not-linked
0:00:08.017364757 [334m 8181[00m 0x7fff6c007ad0 [33;01mWARN [00m [00m basesrc gstbasesrc.c:3055:gst_base_src_loop:<video_source>[00m error: Internal data stream error.
0:00:08.017432686 [334m 8181[00m 0x7fff6c007ad0 [33;01mWARN [00m [00m basesrc gstbasesrc.c:3055:gst_base_src_loop:<video_source>[00m error: streaming stopped, reason not-linked (-1)
0:00:08.017486608 [334m 8181[00m 0x7fff6c007ad0 [36mINFO [00m [00;01;31;47m GST_ERROR_SYSTEM gstelement.c:2145:gst_element_message_full_with_details:<video_source>[00m posting message: Internal data stream error.
[31mgst_video: Error: 1(Operation not permitted) message=Internal data stream error.
[;m[31mgst_video: Debug: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:video-encoder-pipeline/GstAppSrc:video_source:
streaming stopped, reason not-linked (-1)
st->streamer.source = gst_element_factory_make("appsrc", "video_source");
st->streamer.parser = gst_element_factory_make("rawvideoparse", "video_parser");
st->streamer.encoder = gst_element_factory_make(st->streamer.element, "video_encoder");
st->streamer.sink = gst_element_factory_make("appsink", "video_sink");
st->streamer.pipeline = gst_pipeline_new("video-encoder-pipeline");
if (!st->streamer.source || !st->streamer.parser || !st->streamer.encoder || !st->streamer.sink || !st->streamer.pipeline) {
warning("gst_video: unable to create one or more of the pipeline elements for the video encoder.\n");
err = EPROTO;
return err;
}
/* Configure appsource */
//gst_video_info_set_interlaced_format(&info, GST_VIDEO_FORMAT_I420, GST_VIDEO_INTERLACED_MODE_INTERLEAVED, size->w, size->h);
//video_caps = gst_video_info_to_caps(&info);
video_caps = gst_caps_new_simple ("video/x-raw",
"format", G_TYPE_STRING, "I420",
"framerate", GST_TYPE_FRACTION, st->encoder.fps, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
"width", G_TYPE_INT, size->w,
"height", G_TYPE_INT, size->h,
NULL);
g_object_set(st->streamer.source, "caps", video_caps, "format", GST_FORMAT_DEFAULT, NULL);
gst_app_src_set_callbacks(GST_APP_SRC(st->streamer.source), &(st->streamer.appsrcCallbacks),
st, (GDestroyNotify)appsrc_destroy_notify_cb);
/* Configure encoder */
// TODO: not hardcode this but do it by parsing options and checking if an actual property
g_object_set(st->streamer.encoder, "byte-stream", TRUE, "rc-lookahead", 0, "tune", 4, "speed-preset", 1, "sync-lookahead", 0, "bitrate", st->encoder.bitrate / 1000, NULL);
/* Configure appsink. */
g_object_set(st->streamer.sink, "caps", video_caps, NULL);
gst_app_sink_set_callbacks(GST_APP_SINK(st->streamer.sink), &(st->streamer.appsinkCallbacks),
st, (GDestroyNotify)appsink_destroy_notify_cb);
gst_caps_unref(video_caps);
/* Link everything up inside our pipeline */
gst_bin_add_many(GST_BIN(st->streamer.pipeline), st->streamer.source, st->streamer.parser, st->streamer.encoder, st->streamer.sink, NULL);
/* Bus watch */
bus = gst_pipeline_get_bus(GST_PIPELINE(st->streamer.pipeline));
gst_bus_set_sync_handler(bus, (GstBusSyncHandler)bus_sync_handler_cb,
st, (GDestroyNotify)bus_destroy_notify_cb);
gst_object_unref(GST_OBJECT(bus));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200716/1423e824/attachment-0001.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gst.txt
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200716/1423e824/attachment-0001.txt>
More information about the gstreamer-devel
mailing list