filesink provides empty file

android6011 android6011 at gmail.com
Mon Aug 15 09:27:23 PDT 2011


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;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110815/229d0355/attachment.html>


More information about the gstreamer-devel mailing list