filesink provides empty file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

filesink provides empty file

android6011
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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: filesink provides empty file

Sudarshan Bisht
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 <[hidden email]> 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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Regards,

Sudarshan Bisht

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: filesink provides empty file

android6011
thank you very much. I had read about the pads but you help put it into context for what I was doing and I was able to get things rolling.

On Mon, Aug 15, 2011 at 12:04 PM, Sudarshan Bisht <[hidden email]> wrote:
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 <[hidden email]> 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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Regards,

Sudarshan Bisht

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel