Hi all...
I'm very new to GStreamer, I've gone through the manual but I still needed a fair amount of assistance.... I'm sorry this email is a bit long, but I have a LOT of confusion going on and would greatly appreciate any help I can get. I have this gst-launch-1.0 command. ========================================================== gst-launch-1.0 v4l2src device=/dev/video13 do-timestamp=true ! video/x- raw, format=YUY2, width=640, height=480, framerate=30/1 ! autovideoconvert ! vaapih264enc ! rtph264pay ! udpsink host=192.168.1.2 port=5600 ========================================================== I'm wanting to duplicate this command line into a C++ application using these elements/settings I started to try and pick out the various elements. The ones I came up with are (which I could be SO COMPLETELY WRONG). Are these the actual elements I would want to try and create in a C++ app??? * v4l2src * autovideoconvert * vaapih264enc * rtph264pay * udpsink On my system, I get errors for autovideoconvert, vaapih264enc. WARNING: erroneous pipeline: no element "autovideoconvert" This warning is what I get from the command line when I run the gst- launch command. I'm not exactly sure why vaapih264enc is not working but I suspect the same. I only know this because in my app, I check to see if each element was created successfully. If not I print out an error. The other elements seem to generate ok. I noticed that autovideoconvert is classified in the "bad" category, if I wanted to replace it with something else, is there a way to make an educated guess at another element? what is rtph264pay. I did a search on it. I found the manual page for it but there is no description. Also, if I look at v4l2src, I see that there is "device=/dev/video13". Is that a property that I would set on my v4l2src element? What about video/x-raw, format=YUY2, width=640, height=480, framerate=30/1 Is that a set of properties? If so, what element do they belong on? _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
You don't have to read the whole manual but examining this code will give you a great amount of idea about the framework and how to write basic applications with it.
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-helloworld.html You can use videoconvert instead of autovideoconvert. Video4Linux mounts different sources to different points, generally starting from /dev/video0. And in your case you are telling the v4l2src to use the source at /dev/video13. I am not 100% sure but if you don't set that property, the element is supposed to search for valid sources on your system and use the first one it finds. |
This post was updated on .
I've made SOME headway
Again, i'm trying to recreate this command line app in C/C++ gst-launch-1.0 v4l2src device=/dev/video13 do-timestamp=true ! video/x-raw, format=YUY2, width=640, height=480, framerate=30/1 ! autovideoconvert ! vaapih264enc ! rtph264pay ! udpsink host=192.168.1.2 port=5600 I've setup all my elements, however, I'm getting an internal data flow error and I'm not sure why. Any help will be AWESOME!!! Thanks
|
On Wed, 2016-11-09 at 20:31 -0800, rick b wrote:
Hi Rick, > I've setup all my elements, however, I'm getting an internal data > flow error and I'm not sure why. Any help will be AWESOME!!! What kind of flow error are you getting? (not-linked, not-negotiated, etc.) Could you paste the whole error message including the 'debug' detail string? Does this pipeline work for you as is in gst-launch-1.0? Use videoconvert instead of autovideoconvert, as mentioned already. I see you do that in your code, but you don't actually link the videoconvert element with anything else, so it's just going to sit there unused. You can also use pipeline=gst_parse_launch("...", ...) to create a simple pipeline from parse-launch syntax. 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 |
Hi Tim, I had thought about just using the gst-launch command inside my source code. And I have, it works. The problem is, I came into a situation where I needed the main app loop. I had asked about how to get the main app loop and was told that the gst-launch command does not generate a loop.
So, I'm back to trying to do this. I went back and re-added the videovert element. Still not working. I reran and added --gst-debug-level=3 I get a bunch of vaapi errors and warnings. I wanted to capture these out to a file but myExe --gst-debug-level=3 > myErrorFile.txt However, NONE of the gstreamer debug output got put into that file. I'm sure it's my lack of Linux skills that's the problem. Is there a linux command command that I can run that will output all the --gst-debug-level output into a file? |
Here is debug level 3. I realize that I need to configure vaapi, but... TO be honest, being so new to GStreamer, I'm not sure exactly what that would look like/how to do it.
|
This post was updated on .
I pulled out a couple of things that I though might be helpful
|
In reply to this post by rick b
I'm not sure I understand where you're coming from with this question.
I'll try answer the easy one first. It's possible the reason you don't see the GST debug stuff is because it's being sent to standard error and ">" redirects standard output. If you want to capture both of these, you can use something like "myProg >someFile 2>&1" which also directs stderr (2) to the same place as stdout (1). In terms of getting the "main loop", GStreamer itself does not provide this functionality. If you want to have messages delivered to a loop, you need to create one yourself (via gtk or glib) and then notify Gstreamer elements to post messages to it. By way of example, my current program calls a sequence: gst_init(argc, argv); GstElement *playbin = gst_parse_launch("<vide stream>", 0); gst_element_set_state(playbin, GST_STATE_PLAYING); to actually kick off a video stream. However, it also has: GstMainContext *context = g_main_context_new() g_main_context_push_thread_default(context); GMainLoop *mainLoop = g_main_loop_new(context, FALSE); : g_main_loop_run(m_mainLoop); to kick of a GLib message pump. In terms of connecting GStreamer signals to the message pump, you can use something like: GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(playbin)); gst_bus_add_signal_watch(bus); g_signal_connect(bus, "message::state-changed", (GCallback)StateChangedCb, NULL); and that particular signal should be delivered to your callback function: gboolean StateChangedCb(GstBus *bus, GstMessage *msg, gpointer data) { // bus is the bus (obviously). // msg is the constructed message which you can use to get extra details. // data is the pointer specified in the signal connect call above (NULL) // in this case but can be used to deliver specific detail). } Hope that helps and, as always, any corrections by those more adept in GStreamer are welcome. Al. -----Original Message----- From: gstreamer-devel [mailto:[hidden email]] On Behalf Of rick b Sent: Friday, 11 November 2016 1:53 AM To: [hidden email] Subject: Re: Turning this gst-launch-1.0 command into a C++ app? Hi Tim, I had thought about just using the gst-launch command inside my source code. And I have, it works. The problem is, I came into a situation where I needed the main app loop. I had asked about how to get the main app loop and was told that the gst-launch command does not generate a loop. So, I'm back to trying to do this. I went back and re-added the videovert element. Still not working. I reran and added --gst-debug-level=3 I get a bunch of vaapi errors and warnings. I wanted to capture these out to a file but myExe --gst-debug-level=3 > myErrorFile.txt However, NONE of the gstreamer debug output got put into that file. I'm sure it's my lack of Linux skills that's the problem. Is there a linux command command that I can run that will output all the --gst-debug-level output into a file? -- View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Turning-this-gst-launch-1-0-command-into-a-C-app-tp4680502p4680600.html Sent from the GStreamer-devel mailing list archive at Nabble.com. _______________________________________________ gstreamer-devel mailing list [hidden email] https://linkprotect.cudasvc.com/url?a=https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel&c=E,1,uWtP-yYHCisOwUjYc860aQSeo3hJkessKmXDFwkGPDp6rjubOmZgHFEaZKDyx4bI1zkab5HRIa6DQig6RubJP1DYbF3MZwmRgWDv6F-4&typo=1 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Must remember to insert more blank lines in the next post, it's conflated my code with my text. In both the first and third code segments, the text at the end of the final line ("to actually kick off ..." and "and that particular signal ...") is not actually part of the code, it's a continuation of the descriptive text surrounding it.
In addition, the " g_main_loop_run(m_mainLoop);" line should be using "mainLoop" - I'd removed the "m_" from all variables except this one. Cheers once again, Al. -----Original Message----- From: gstreamer-devel [mailto:[hidden email]] On Behalf Of Allan Chandler Sent: Friday, 11 November 2016 9:53 AM To: [hidden email] Subject: RE: Turning this gst-launch-1.0 command into a C++ app? I'm not sure I understand where you're coming from with this question. I'll try answer the easy one first. It's possible the reason you don't see the GST debug stuff is because it's being sent to standard error and ">" redirects standard output. If you want to capture both of these, you can use something like "myProg >someFile 2>&1" which also directs stderr (2) to the same place as stdout (1). In terms of getting the "main loop", GStreamer itself does not provide this functionality. If you want to have messages delivered to a loop, you need to create one yourself (via gtk or glib) and then notify Gstreamer elements to post messages to it. By way of example, my current program calls a sequence: gst_init(argc, argv); GstElement *playbin = gst_parse_launch("<vide stream>", 0); gst_element_set_state(playbin, GST_STATE_PLAYING); to actually kick off a video stream. However, it also has: GstMainContext *context = g_main_context_new() g_main_context_push_thread_default(context); GMainLoop *mainLoop = g_main_loop_new(context, FALSE); : g_main_loop_run(m_mainLoop); to kick of a GLib message pump. In terms of connecting GStreamer signals to the message pump, you can use something like: GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(playbin)); gst_bus_add_signal_watch(bus); g_signal_connect(bus, "message::state-changed", (GCallback)StateChangedCb, NULL); and that particular signal should be delivered to your callback function: gboolean StateChangedCb(GstBus *bus, GstMessage *msg, gpointer data) { // bus is the bus (obviously). // msg is the constructed message which you can use to get extra details. // data is the pointer specified in the signal connect call above (NULL) // in this case but can be used to deliver specific detail). } Hope that helps and, as always, any corrections by those more adept in GStreamer are welcome. Al. -----Original Message----- From: gstreamer-devel [mailto:[hidden email]] On Behalf Of rick b Sent: Friday, 11 November 2016 1:53 AM To: [hidden email] Subject: Re: Turning this gst-launch-1.0 command into a C++ app? Hi Tim, I had thought about just using the gst-launch command inside my source code. And I have, it works. The problem is, I came into a situation where I needed the main app loop. I had asked about how to get the main app loop and was told that the gst-launch command does not generate a loop. So, I'm back to trying to do this. I went back and re-added the videovert element. Still not working. I reran and added --gst-debug-level=3 I get a bunch of vaapi errors and warnings. I wanted to capture these out to a file but myExe --gst-debug-level=3 > myErrorFile.txt However, NONE of the gstreamer debug output got put into that file. I'm sure it's my lack of Linux skills that's the problem. Is there a linux command command that I can run that will output all the --gst-debug-level output into a file? -- View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Turning-this-gst-launch-1-0-command-into-a-C-app-tp4680502p4680600.html Sent from the GStreamer-devel mailing list archive at Nabble.com. _______________________________________________ gstreamer-devel mailing list [hidden email] https://linkprotect.cudasvc.com/url?a=https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel&c=E,1,uWtP-yYHCisOwUjYc860aQSeo3hJkessKmXDFwkGPDp6rjubOmZgHFEaZKDyx4bI1zkab5HRIa6DQig6RubJP1DYbF3MZwmRgWDv6F-4&typo=1 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |