filesink provides empty file
Sudarshan Bisht
bisht.sudarshan at gmail.com
Mon Aug 15 10:04:28 PDT 2011
In your application rtph264depay and mpegtsmux can not be linked
automatically because muxers have got "request pads", for more information
about "request pads" and how you link them with normal pads, have a look
at following link;
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-pads.html
On Mon, Aug 15, 2011 at 7:27 PM, android6011 <android6011 at gmail.com> wrote:
> Hello everyone, I am trying to replicate the following "gst-launch rtspsrc
> location=rtsp://10.10.10.3:554 ! rtph264depay ! mpegtsmux ! filesink
> location=out.ts" .
>
> This line works in producing video output but when the following code is
> used the output file is always 0 in size. Any pointers on why this might be
> happening would be appreciated
>
> #include <stdio.h>
> #include <gst/gst.h>
>
> int main (int argc, char *argv[])
> {
> printf("STARTING %d \n",1);
> //Init
> gst_init (&argc, &argv);
> //Get Ready
> GstPipeline *pipeline = GST_PIPELINE(gst_pipeline_new("pipeline"));
> printf("Created Pipeline\n");
> //Prep Source
> GstElement *source = gst_element_factory_make("rtspsrc","source");
> g_object_set(G_OBJECT(source),"location","rtsp://10.10.10.3:554",NULL);
> printf("Created SRC\n");
> //Prep Decode
> GstElement *demux =gst_element_factory_make("rtph264depay","demux");
> printf("Created Demux\n");
> //Prep Encode
> GstElement *mux = gst_element_factory_make("mpegtsmux","mux");
> printf("Created Mux\n");
> //prep output
> GstElement *dest = gst_element_factory_make("filesink","dest");
> g_object_set(G_OBJECT(dest),"location","output.ts",NULL);
> printf("Created Output\n");
> //Link
> gst_element_link_many(source,demux,mux,dest,NULL);
> printf("Done Linking\n");
> //Add
> gst_bin_add_many(GST_BIN(pipeline),source,demux,mux,dest,NULL);
> printf("Added Elements To Pipe\n");
> gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
> printf("CSet State\n");
> GMainLoop *loop = g_main_loop_new(NULL,FALSE);
> printf("Starting Loop...\n");
> g_main_loop_run(loop);
>
>
>
> printf("done\n");
> return 0;
> }
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
--
Regards,
Sudarshan Bisht
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110815/ff4fc871/attachment-0001.htm>
More information about the gstreamer-devel
mailing list