v4l2 to h264

Shawn Yarnell sdyarnell at gmail.com
Tue Nov 22 10:21:03 PST 2011


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));

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111122/6f62436c/attachment.html>


More information about the gstreamer-devel mailing list