v4l2 to h264

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

v4l2 to h264

sdyarnell
I am going to create an app that streams video over Bluetooth. I was trying to figure out gstreamer, and have the following code. It just creates a pipeline that saves the file into an mp4 file. This does save a file, but the application techniquelly never exits. It just says "Running..." forever. 

Either way, my intention is to somehow throw in an appsink for the source so that I can take the encoded stream and send it over Bluetooth from the application. I have not found a good example to do this. I can hand all the Bluetooth programming, I am just new to gstreamer. 

Any help is appreciated on getting the appsink concept rolling.

MY CODE:

#include <gst/gst.h>
#include <glib.h>


int
main (int   argc,
      char *argv[]){

GMainLoop *loop;

/* Initialisation */
gst_init (&argc, &argv);

loop = g_main_loop_new (NULL, FALSE);

GstElement * pipeline = GST_PIPELINE(gst_parse_launch("v4l2src num-buffers=50 ! queue ! "
"x264enc ! mp4mux ! filesink location=fromFile.mp4", 
  NULL));


gst_element_set_state (pipeline, GST_STATE_PLAYING);

/* Iterate */
g_print ("Running...\n");
g_main_loop_run (loop);


/* Out of the main loop, clean up nicely */
g_print ("Returned, stopping playback\n");
gst_element_set_state (pipeline, GST_STATE_NULL);

g_print ("Deleting pipeline\n");
gst_object_unref (GST_OBJECT (pipeline));

}




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