Hi,
the following is the code which i am trying to run (removed callback method before posting) I get this error when I try to run this code. assertion failed: (gst_element_link_filtered (audioconvert1, audioresample,caps)) I am confused between caps and capsfilter as you can see in my code I am using both of them #define GLIB_DISABLE_DEPRECATION_WARNINGS #include <gst/gst.h> #include <string.h> #include <math.h> static GMainLoop *loop; //GstElement *play; GstElement *pipeline; GstElement *filesrc, *decodebin, *cutter, *valve, *audioconvert0, *audioconvert1, *audioresample, *capsfilter, *multifilesink; gboolean above = FALSE; guint64 maxaudioduration = 3 * GST_SECOND; int isSpeaking =1; int main (int argc, char *argv[]) { GstBus *bus; GstCaps *caps; /* gstreamer */ gst_init (&argc, &argv); /* create pipeline */ pipeline = gst_pipeline_new (NULL); /* we need to run a GLib main loop to get the messages */ loop = g_main_loop_new (NULL, FALSE); filesrc = gst_element_factory_make ("filesrc", "filesrc"); g_object_set (G_OBJECT(filesrc), "location", "./videos/audiosilence.mp4", NULL); g_assert (filesrc); decodebin = gst_element_factory_make ("decodebin", "decodebin"); g_assert (decodebin); cutter = gst_element_factory_make ("cutter", "cutter"); g_object_set (G_OBJECT(cutter), "threshold-dB", -39.0, NULL); g_object_set (G_OBJECT(cutter), "run-length", 400000000, NULL); g_assert (cutter); /*TODO t.*/ valve = gst_element_factory_make ("valve", "valve"); g_assert (valve); audioconvert0 = gst_element_factory_make ("audioconvert", "audioconvert0"); g_assert (audioconvert0); audioconvert1 = gst_element_factory_make ("audioconvert", "audioconvert1"); g_assert (audioconvert1); audioresample = gst_element_factory_make ("audioresample", "audioresample"); g_assert (audioresample); caps = gst_caps_from_string("audio/x-raw, format=int, rate=16000, channels=1"); g_assert (caps!=NULL); capsfilter = gst_element_factory_make("capsfilter", "capsfilter"); g_object_set (capsfilter, "caps", caps, NULL); g_assert (capsfilter); multifilesink = gst_element_factory_make ("multifilesink", "multifilesink"); g_object_set (G_OBJECT(multifilesink), "location", "./audio/user%02d.pcm", NULL); g_object_set (G_OBJECT(multifilesink), "next-file", 2, NULL); g_assert (multifilesink); /* This is what I want to do */ /* play = gst_parse_launch("-v -m -t filesrc location=./videos/audio.webm ! decodebin ! cutter threshold-dB=-39 !tee name=t ! queue ! fakesink t. ! queue ! valve name=valve ! audioconvert! audioresample ! audio/x-raw, rate=16000, channels=1 ! multifilesink location=./multifilesink/cutter%02d.pcm next-file=2", NULL); g_assert (play);*/ /* BIN ADD MANY */ gst_bin_add_many(GST_BIN (pipeline),filesrc, decodebin, audioconvert0, cutter, valve, audioconvert1, audioresample, capsfilter, multifilesink, NULL); /* Link Many */ g_assert(gst_element_link_filtered (audioconvert1, audioresample,caps)); gst_caps_unref(caps); g_assert(gst_element_link_many (filesrc, audioconvert0, cutter, valve, audioconvert1, audioresample, multifilesink, NULL)); bus = gst_pipeline_get_bus (pipeline); gst_bus_add_watch (bus, my_bus_callback, NULL); gst_element_set_state (pipeline, GST_STATE_READY); gst_element_set_state (pipeline, GST_STATE_PLAYING); g_main_loop_run (loop); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (pipeline)); gst_object_unref (bus); gst_object_unref (GST_OBJECT (filesrc)); gst_object_unref (GST_OBJECT (decodebin)); gst_object_unref (GST_OBJECT (cutter)); gst_object_unref (GST_OBJECT (valve)); gst_object_unref (GST_OBJECT (audioconvert0)); gst_object_unref (GST_OBJECT (audioconvert1)); gst_object_unref (GST_OBJECT (audioresample)); gst_object_unref (GST_OBJECT (multifilesink)); g_main_loop_unref (loop); return 0; } |
On Fri, 2016-03-04 at 05:15 -0800, Sagar wrote:
Hi, > caps = gst_caps_from_string("audio/x-raw, format=int, rate=16000, > channels=1"); This ("int") is not a known/valid raw audio format. Should be something like S16LE or similar, check the output of gst-inspect-1.0 audioconvert Cheers -Tim -- Tim Müller, Centricular Ltd - http://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |