Failure X264 in gstreamer-1.10.4

gagankumarnigam gagankumarnigam at bel.co.in
Mon Feb 12 09:48:43 UTC 2018


Hi All,

I am using gstreamer-1.10.4 on rhel-7.1 with 
gst-plugins-good-1.10.4
gst-plugins-ugly-1.10.4
gstreamer1-libav-1.2.4-4.el7.x86_64
x264-libs-0.148-11.20160614gita5e06b9.el7.x86_64

and compiled the tutorial.c programme with this command 

#include <gst/gst.h>
#include <glib.h>
#include <stdio.h>
#include <glib-object.h>

static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data)
{
       GMainLoop *loop = (GMainLoop *) data;
       switch (GST_MESSAGE_TYPE (msg))
       {
         case GST_MESSAGE_EOS:
             g_print ("End of stream\n");
             g_main_loop_quit (loop);
             break;
         case GST_MESSAGE_ERROR:
         {
             gchar *debug;
             GError *error;
             gst_message_parse_error (msg, &error, &debug);
             g_free (debug);
             g_printerr ("Error: %s\n", error->message);
             g_error_free (error);
             g_main_loop_quit (loop);
             break;
         }
         default: break;
         }
    return TRUE;
 }
int main (int argc, char *argv[])
{
   GMainLoop *loop;
   GstElement *pipeline, *source, *filter, *vrate, *encoder, *conv, *sink;
   GstBus *bus;
   GstCaps *filtercaps; 
   gint width, height, num, denom;
   const GstStructure *str;
   /* Initialisation */
   gst_init (&argc, &argv);
   loop = g_main_loop_new (NULL, FALSE);
   /* Create gstreamer elements */
   pipeline = gst_pipeline_new ("video-player");
	g_assert(pipeline);
   source = gst_element_factory_make ("v4l2src", "file-source");
   g_assert(source);
   vrate = gst_element_factory_make ("videorate", "video-rate");
	g_assert(vrate);
   filter = gst_element_factory_make ("capsfilter", "filter");
g_assert(filter);
  encoder = gst_element_factory_make ("x264","encoder");
   g_assert(encoder);
   sink = gst_element_factory_make ("udpsink","audio-output");
	g_assert(sink);
   pipeline = gst_parse_launch("v4l2src device=/dev/video0 !
xvimagesink",NULL);

   if (!pipeline || !source || !filter || !vrate ||  !encoder || !sink)
   {
     g_printerr ("One element could not be created. Exiting.\n");
     return -1;
   }
   filtercaps = gst_caps_new_simple ("video/x-raw-yuv","width", G_TYPE_INT,
640,"height", G_TYPE_INT, 480,"framerate", GST_TYPE_FRACTION, 30, 1, NULL);
   g_object_set (G_OBJECT (filter), "caps", filtercaps, NULL);
   gst_caps_unref (filtercaps);
   g_object_set (G_OBJECT (encoder), "bitrate" , 384 ,  NULL);
   //g_object_set (G_OBJECT (sink), "host" , argv[1] ,  NULL);
  // g_object_set (G_OBJECT (sink), "host" , "192.168.3.204" ,  NULL);
   g_object_set (G_OBJECT (sink), "host" , "127.0.0.1" ,  NULL);
   g_object_set (G_OBJECT (sink), "port" , 8999 ,  NULL);
   g_object_set (G_OBJECT (sink), "async" , FALSE ,  NULL);

   bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
   gst_bus_add_watch (bus, bus_call, loop);
   gst_object_unref (bus);   
   gst_bin_add_many (GST_BIN (pipeline), source, vrate, filter,  encoder,
sink, NULL);

   gst_element_link_many (source, vrate, filter,  encoder,  sink, NULL);

   g_print ("Now playing: \n");

   gst_element_set_state (pipeline, GST_STATE_PLAYING);
      gst_caps_set_simple (filtercaps, "width", G_TYPE_INT, 352, "height",
G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 15, 1, NULL);    
    
     gst_element_set_state (pipeline, GST_STATE_PLAYING);
    }
   g_print ("Running...\n");
   g_main_loop_run (loop);
    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));
   return 0;
}

g++ tutorial1.c -o tutorial1 `pkg-config --cflags --libs gtk+-2.0 
gstreamer-1.0 gstreamer-video-1.0`

it compiled successfully .But executing the ./tutorial1 fails on x264enc.
however, x264 is available on the path
/usr/lib64/lib/gstreamer-1.0/libgstx264.so and  which is linked witk
PKG_CONFIG_PATH

Can any body tell me what is the problem here??









--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list