I'm trying to use gstreamer to mux data from a hardware MPEG4-ES encoder into an MOV file. My code is based off the hello world program. The code is listed below. When I run this code I get the following error message:<br>
<br>Now playing: 2010_12_17_Good.m4v<br>Running...<br>Error: Could not multiplex stream.<br>Returned, stopping playback<br>Deleting pipeline<br><br>Is there a way to do this?<br><br><br>int<br>main (int argc,<br> char *argv[])<br>
{<br> GMainLoop *loop;<br><br> GstElement *pipeline, *source, *parse, *muxer, *sink;<br> GstBus *bus;<br><br> /* Initialisation */<br> gst_init (&argc, &argv);<br><br> loop = g_main_loop_new (NULL, FALSE);<br>
<br><br> /* Check input arguments */<br> if (argc != 3) {<br> g_printerr ("Usage: %s <input mpeg4-es> <output avi>\n", argv[0]);<br> return -1;<br> }<br><br><br> /* Create gstreamer elements */<br>
pipeline = gst_pipeline_new ("audio-player");<br> source = gst_element_factory_make ("filesrc", "file-source");<br> parse = gst_element_factory_make ("mpeg4videoparse", "mpeg4-parse");<br>
muxer = gst_element_factory_make ("qtmux", "qt-muxer");<br> //decoder = gst_element_factory_make ("vorbisdec", "vorbis-decoder");<br> //conv = gst_element_factory_make ("audioconvert", "converter");<br>
sink = gst_element_factory_make ("filesink", "file-output");<br><br> if (!pipeline || !source || !parse || !muxer || !sink) {<br> g_printerr ("One element could not be created. Exiting.\n");<br>
return -1;<br> }<br><br> /* Set up the pipeline */<br><br> /* we set the input filename to the source element */<br> g_object_set (G_OBJECT (source), "location", argv[1], NULL);<br> g_object_set (G_OBJECT (sink), "location", argv[2], NULL);<br>
<br> /* we add a message handler */<br> bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br> gst_bus_add_watch (bus, bus_call, loop);<br> gst_object_unref (bus);<br><br> /* we add all elements into the pipeline */<br>
/* file-source | ogg-demuxer | vorbis-decoder | converter | alsa-output */<br> gst_bin_add_many (GST_BIN (pipeline),<br> source, parse, muxer, sink, NULL);<br><br> /* we link the elements together */<br>
/* file-source -> ogg-demuxer ~> vorbis-decoder -> converter -> alsa-output */<br> gst_element_link (source, parse);<br> gst_element_link (parse, muxer);<br> gst_element_link (muxer, sink);<br> //g_signal_connect (muxer, "pad-added", G_CALLBACK (on_pad_added), decoder);<br>
<br> /* note that the demuxer will be linked to the decoder dynamically.<br> The reason is that Ogg may contain various streams (for example<br> audio and video). The source pad(s) will be created at run time,<br>
by the demuxer when it detects the amount and nature of streams.<br> Therefore we connect a callback function which will be executed<br> when the "pad-added" is emitted.*/<br><br><br> /* Set the pipeline to "playing" state*/<br>
g_print ("Now playing: %s\n", argv[1]);<br> gst_element_set_state (pipeline, GST_STATE_PLAYING);<br><br><br> /* Iterate */<br> g_print ("Running...\n");<br> g_main_loop_run (loop);<br><br><br> /* Out of the main loop, clean up nicely */<br>
g_print ("Returned, stopping playback\n");<br> gst_element_set_state (pipeline, GST_STATE_NULL);<br><br> g_print ("Deleting pipeline\n");<br> gst_object_unref (GST_OBJECT (pipeline));<br><br> return 0;<br>
}<br><br clear="all"><br>-- <br>Nicholas Butts<br>SENIOR FIRMWARE ENGINEER<br><br>Appareo Systems, LLC<br>1810 NDSU Research Circle N<br>Fargo, ND 58102<br><br>P: (701) 356-2200<br>F: (701) 356-3157<br><br><a href="http://www.appareo.com">http://www.appareo.com</a><br>
<br><a href="mailto:nbutts@appareo.com">nbutts@appareo.com</a><br><br><br><br>NOTICE: This message {including attachments} is covered by the Electronic Communication Privacy Act, 18 U.S.C. sections 2510-2521, is CONFIDENTIAL and may also be protected by ATTORNEY-CLIENT OR OTHER PRIVILEGE. If you believe that it has been sent to you in error, do not read it. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error and then delete it.<br>