demux/remux pipeline hangs when audio is added

Robert Krakora rob.krakora at messagenetsystems.com
Wed Oct 2 15:44:44 PDT 2013


Good.


On Wed, Oct 2, 2013 at 5:16 PM, Carah Smith <carah29ingress at gmail.com>wrote:

> I got it working in the code now. Thank you both for your help! Below is
> the working code in case anyone is curious or still struggling with this
> issue. All error checking has been removed for conciseness. I didn't
> include the helper functions or structure because they did not change all
> that much.
>
> int
> main(int argc, char **argv)
> {
>     GstElement *source;
>     GstElement *pipeline;
>     GstElement *sink;
>     GstElement *mux;
>     GstElement *x264_enc;
>     GstElement *a_convert;
>     GstElement *v_convert;
>     GstElement *aac_enc;
>     struct custom_data data;
>     GstElement *v_queue;
>     GstElement *a_queue;
>     GstBus     *bus;
>     GstMessage *msg;
>     gboolean terminate = FALSE;
>
>     gst_init (&argc, &argv);
>
>     source    = gst_element_factory_make("uridecodebin", "URI_decoder");
>     v_convert = gst_element_factory_make("videoconvert",
> "video_converter");
>     v_queue   = gst_element_factory_make("queue", "v_queue");
>     a_queue   = gst_element_factory_make("queue", "a_queue");
>     x264_enc  = gst_element_factory_make("x264enc", "h264_encoder");
>     a_convert = gst_element_factory_make("audioconvert",
> "audio_converter");
>     aac_enc   = gst_element_factory_make("faac", "aac_encoder");
>     mux       = gst_element_factory_make("mpegtsmux", "muxer");
>     sink      = gst_element_factory_make("hlssink", "hls_sink");
>
>     data.video = v_queue;
>     data.audio = a_queue;
>
>     pipeline = gst_pipeline_new("test-pipeline");
>
>     g_object_set(G_OBJECT(source), "uri", "file:///stream_1.ts", NULL);
>
>     gst_bin_add_many(GST_BIN(pipeline),
>                      source, v_queue, a_queue, x264_enc,
>                      v_convert, aac_enc, a_convert, mux, sink,
>                      NULL);
>
>     gst_element_link_many(a_queue, a_convert, aac_enc, NULL);
>     gst_element_link_many(v_queue, v_convert, x264_enc, NULL);
>     gst_element_link(mux, sink);
>
>     link_to_multiplexer(x264_enc, mux);
>     link_to_multiplexer(aac_enc, mux);
>
>     g_signal_connect(source, "pad-added", G_CALLBACK(on_pad_added), &data);
>
>     gst_element_set_state(pipeline, GST_STATE_PLAYING);
>
>     bus = gst_element_get_bus(pipeline);
>     do
>     {
>         msg = gst_bus_timed_pop(bus, 0);
>
>         if (msg != NULL)
>         {
>             switch (GST_MESSAGE_TYPE(msg))
>             {
>                 case GST_MESSAGE_ERROR:
>                     terminate = TRUE;
>                     break;
>                 case GST_MESSAGE_EOS:
>                     g_print("End-Of-Stream reached.\n");
>                     terminate = TRUE;
>                     break;
>                 case GST_MESSAGE_STATE_CHANGED:
>                     if (GST_MESSAGE_SRC(msg) == GST_OBJECT(pipeline))
>                     {
>                         GstState old_state, new_state, pending_state;
>
>                         gst_message_parse_state_changed(msg, &old_state,
> &new_state, &pending_state);
>                         g_print("Pipeline state changed from %s to %s:\n",
>                         gst_element_state_get_name(old_state),
> gst_element_state_get_name(new_state));
>                     }
>                     break;
>                 default:
>                 break;
>             }
>             gst_message_unref(msg);
>         }
>     } while (!terminate);
>
>     gst_object_unref(bus);
>     gst_element_set_state(pipeline, GST_STATE_NULL);
>     gst_object_unref(pipeline);
>
>     return 0;
> }
>
>
> On Wed, Oct 2, 2013 at 2:50 PM, Carah Smith <carah29ingress at gmail.com>wrote:
>
>> Ok, this worked for me as well. I am going to try and put this exactly
>> into my code.
>>
>>
>> On Wed, Oct 2, 2013 at 2:41 PM, Robert Krakora <
>> rob.krakora at messagenetsystems.com> wrote:
>>
>>> This works...xviddec and xvidenc are not ported to GStreamer 1.0...
>>>
>>> DevKrakora MessageNet # gst-launch-1.0 uridecodebin
>>> uri=file:///home/silentm/MessageNet/bbb24p_00.ts name=bin ! queue !
>>> videoconvert ! x264enc ! mpegtsmux name=mux ! hlssink bin. ! queue !
>>> audioconvert ! faac ! mux.
>>>  Setting pipeline to PAUSED ...
>>> Pipeline is PREROLLING ...
>>> Redistribute latency...
>>> Redistribute latency...
>>> Pipeline is PREROLLED ...
>>> Setting pipeline to PLAYING ...
>>> New clock: GstSystemClock
>>>
>>>
>>>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>


-- 

Rob Krakora,
Senior Software Engineer

MessageNet Systems
101 E Carmel Dr, Suite 105
Carmel, IN 46032

MessageNetSystems.com<http://www.messagenetcommunicationsystems.com/?utm_source=email+signature&utm_medium=email&utm_campaign=email+signature+to+homepage>
Rob.Krakora at MessageNetSystems.com <rob.krakora at messagenetsystems.com>
P: 317.566.1677, 212
F: 317.663.0808

For the latest news, information, and blogs, please be sure to visit,
follow, and like us...

<http://www.messagenetcommunicationsystems.com/get-the-message-out-blog/?utm_source=email+signature&utm_medium=email&utm_campaign=gmail+signature+to+blog>
   <http://www.youtube.com/user/MessageNetConnection/feed>
<http://www.linkedin.com/company/messagenet-systems>
   <http://twitter.com/MessageNet>  <http://www.facebook.com/MessageNetsystems>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131002/3a170c3f/attachment.html>


More information about the gstreamer-devel mailing list