Hi Edward,<br> Thanks for the quick reply. It has been most informative. A couple questions if I may. For the video rescale/capsfilter part, what is this doing and how should it look in the pipeline? The input videos are all 240x240 px with a goal output frame size of 720x480px.<br>
<br> For a very raw test, I am using this to build my pipeline:<br><br> GstPipeline *pipeline = GST_PIPELINE(gst_pipeline_new("pipeline"));<br> <br> GstCaps *caps = gst_caps_from_string("video/x-raw-yuv;video/x-raw-rgb");<br>
<br> // Create our composition<br> GstElement *comp = gst_element_factory_make("gnlcomposition", "composition");<br> g_object_set(G_OBJECT(comp), "caps", caps, NULL);<br> <br>
GstElement *src1 = gst_element_factory_make("gnlfilesource", "source1");<br> g_object_set(G_OBJECT(src1), "location", "loop1.mp4", <br> "start", 0,<br>
"duration", 30 * GST_SECOND,<br> "media-start", 0,<br> "media-duration", 30 * GST_SECOND,<br> "priority", 1,<br> "caps", caps,<br>
NULL);<br> <br> GstElement *src2 = gst_element_factory_make("gnlfilesource", "source2");<br> g_object_set(G_OBJECT(src2), "location", "loop2.mp4", <br> "start", 0,<br>
"duration", 30 * GST_SECOND,<br> "media-start", 0,<br> "media-duration", 30 * GST_SECOND,<br> "priority", 2,<br> "caps", caps,<br>
NULL);<br> <br> GstElement *oper = gst_element_factory_make("gnloperation", NULL);<br> g_object_set(G_OBJECT(oper), "caps", caps, "expandable", TRUE, NULL);<br> <br>
GstElement *mixer = gst_element_factory_make("videomixer", NULL);<br> gst_bin_add(GST_BIN(oper), mixer);<br> <br> // listen for the input priority change signal<br> // to update the video mixer pad<br>
g_object_connect(oper, "signal::input-priority-changed", onPriorityChange, mixer, NULL );<br> <br> // add the sources to the composition<br> gst_bin_add(GST_BIN(comp), src1);<br> gst_bin_add(GST_BIN(comp), src2);<br>
gst_bin_add(GST_BIN(comp), oper);<br> <br> // build the output stream<br> GstElement *color = gst_element_factory_make("ffmpegcolorspace", "colorspace");<br> <br> GstElement *identity = gst_element_factory_make("identity", "ident");<br>
g_object_set(identity, "single-segment", TRUE, NULL);<br> <br> GstElement *enc = gst_element_factory_make("ffenc_mpeg1video", "encoder");<br> GstElement *mux = gst_element_factory_make("ffmux_mpeg", "mux");<br>
GstElement *queue = gst_element_factory_make("queue", "queue");<br> <br> GstElement *sink = gst_element_factory_make("filesink", "sink");<br> g_object_set(sink, "location", "output.mpg", NULL);<br>
<br> gst_bin_add_many(GST_BIN(pipeline), comp, color, identity, enc, mux, queue, sink, NULL);<br> <br> /*<br> g_object_connect (comp, "signal::pad-added",<br> onPad, mixer, NULL);<br>
*/<br> <br> gst_element_link_many(mixer, queue, color, identity, enc, mux, sink, NULL);<br><br><br>It seems to link up fine, but fails to stream as it gets stuck in the paused state. I've tried adding queues all around, but no luck. Here is the debug output:<br>
<br>** Message: Creating run loop...<br>** Message: Building pipeline...<br>** Message: Attaching to bus...<br>** Message: Setting state to PLAYING...<br>0:00:00.141504000 [334m91821[00m 0x100609d30 [33;01mWARN [00m [00;01;34m gnlsource gnlsource.c:545:gnl_source_change_state:<source2>[00m Couldn't find a valid source pad<br>
0:00:00.162296000 [334m91821[00m 0x100609d30 [33;01mWARN [00m [00;01;35m GST_SCHEDULING gstpad.c:4692:gst_pad_get_range:<source:src>[00m getrange failed unexpected<br>0:00:00.191513000 [334m91821[00m 0x100609d30 [33;01mWARN [00m [00;01;34m gnlsource gnlsource.c:545:gnl_source_change_state:<source1>[00m Couldn't find a valid source pad<br>
0:00:00.199956000 [334m91821[00m 0x100686b10 [33;01mWARN [00m [00m qtdemux qtdemux.c:5801:qtdemux_parse_trak:<qtdemux0>[00m unknown version 00000000<br>0:00:00.200693000 [334m91821[00m 0x100609d30 [33;01mWARN [00m [00;01;35m GST_SCHEDULING gstpad.c:4692:gst_pad_get_range:<source:src>[00m getrange failed unexpected<br>
0:00:00.210835000 [334m91821[00m 0x10064f030 [33;01mWARN [00m [00m qtdemux qtdemux.c:5801:qtdemux_parse_trak:<qtdemux1>[00m unknown version 00000000<br>0:00:00.244706000 [334m91821[00m 0x101879f60 [33;01mWARN [00m [00;01;34m gnlsource gnlsource.c:221:element_pad_added_cb:<source2>[00m We already have (pending) ghost-ed a valid source pad (ghostpad:'':'', pendingblock:1<br>
0:00:00.244852000 [334m91821[00m 0x1006501f0 [33;01mWARN [00m [00;01;34m gnlsource gnlsource.c:221:element_pad_added_cb:<source1>[00m We already have (pending) ghost-ed a valid source pad (ghostpad:'':'', pendingblock:1<br>
** Message: Priority Changed: composition::gnloperation0->gnloperation0::sink_1(videomixer0::sink_1) - 2<br>** Message: Priority Changed: composition::gnloperation0->gnloperation0::sink_0(videomixer0::sink_0) - 1<br>
<br>I've been battling with this for a bit now, can't seem to make any headway. Any input is, again, much appreciated.<br><br>Best,<br>Tim<br><br><div class="gmail_quote">On Sun, Nov 28, 2010 at 3:58 AM, Edward Hervey <span dir="ltr"><<a href="mailto:bilboed@gmail.com">bilboed@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi,<br>
<div class="im"><br>
On Sat, 2010-11-27 at 13:50 -0500, Timothy Braun wrote:<br>
> Kapil,<br>
> Thanks for the suggestion, but with multifilesrc I would have to<br>
> have the files static with incrementing named files. A single box in<br>
> the 3x2 grid may contain the same file multiple times so I'm afraid it<br>
> won't be the best solution.<br>
><br>
> I guess, ultimately, there's multiple ways to attack this one from<br>
> what I've been able to find. Here are the two that I've been looking<br>
> at, I'm just not sure which is the better solution at this point:<br>
> * A single gnonlin composition with a 4 gnlsources similar in<br>
> setup as the gst-launch text I have below.<br>
<br>
</div> Using one composition would actually be the 'proper' way.<br>
<br>
> * 6 gnonlin compositions, each feeding to a single videomixer<br>
<div><div></div><div class="h5">> which combines them into the final frame.<br>
> * This path I'm currently investigating. I have a test<br>
> written in C, but I'm having some difficulties with<br>
> pad linkage as I still don't have a complete<br>
> understanding of when certain things will exist and<br>
> how to get them.<br>
> * Here's currently whats happening:<br>
> * Create a new pipeline<br>
> * Create a videomixer<br>
> * Create 6 gnonlin compositions each with a<br>
> pad-added signal callback to connect<br>
> gnlcomposition pad to videomixer.<br>
> * ... (this is were it's going wrong)<br>
> * In the pad-added callback I have:<br>
> * static void onPad(GstElement *comp, GstPad<br>
> *pad, GstElement *sink) {<br>
> GstPad *v = gst_element_get_pad(sink,<br>
> "sink");<br>
> gst_pad_link(pad, v);<br>
> gst_object_unref(v);<br>
> }<br>
> * gst_element_get_pad is not returning a pad<br>
> from the video mixer (sink) which leads me to<br>
> believe that I'm either not asking in the<br>
> right manner or the pad doesn't exist. (I'm<br>
> aware that gst_element_get_pad is deprecated,<br>
> I'm just looking to test at the moment)<br>
> * I noticed in one of the repositories under a<br>
> unit test, the videomixer was attached as a<br>
> gnloperation? Is this the better path to<br>
> take?<br>
><br>
> This all leads me to a couple more questions as well:<br>
> * A video mixer pad has xpos and ypos properties. This would<br>
> let me shift the video around without needing a video box<br>
> which I believe may be more efficient?<br>
<br>
</div></div> Yes, it will be more efficient.<br>
<div class="im"><br>
> * If I use the xpos and ypos properties, is the video mixer<br>
> smart enough to change the frame size appropriately or will it<br>
> simply crop the frame to the size of the largest input frame?<br>
> * If so, would it be better to add a videobox to do the<br>
> adjustments for me, or feed in a solid color<br>
> background of the required output size?<br>
<br>
</div> No, it won't change the size, but what you could do is mix the<br>
original sizes with original offsets and then downconvert the video<br>
later.<br>
<br>
Example for one 3x2 segment:<br>
<br>
Create a gnloperation with a videomixer in it with a gnl priority of<br>
0.<br>
Create a gnlfilesource for each clip with increasing priorities (1->6)<br>
going from left-right and then top to bottom:<br>
1 2 3<br>
4 5 6<br>
<br>
Connect to the gnloperation 'input-priority-changed' signal. When your<br>
callback is called, you will know which priority is being connected to<br>
which gnloperation ghostpad. You can get the videomixer sink pad by<br>
using the gst_ghost_pad_get_target() method and then setting the proper<br>
xpos/ypos property on that pad based on the priority of the feed being<br>
provided.<br>
<br>
Set 'video/x-raw-yuv;video/x-raw-rgb' as the caps property on all your<br>
sources.<br>
<br>
Set duration and media-duration of *all* gnlobjects to the same<br>
duration.<br>
If you want to add another segment of 3x2 clips, you'll need to re-add<br>
all those 7 objects with a modified 'start' property.<br>
<br>
First connect your composition to an imagesink to make sure the result<br>
is what you want. When it is, insert a videoscale element followed with<br>
a capsfilter with your target resolution.<br>
<br>
Hope this helps.<br>
<div><div></div><div class="h5"><br>
><br>
> Thanks again for the time. I know there's a lot of questions above,<br>
> but any help of any kind is greatly appreciated.<br>
><br>
> All the best,<br>
> Tim<br>
><br>
><br>
> On Fri, Nov 26, 2010 at 1:04 AM, Kapil Agrawal <<a href="mailto:kapil.agl@gmail.com">kapil.agl@gmail.com</a>><br>
> wrote:<br>
> Just a quick clue that might help, try using multifilesrc ?<br>
><br>
><br>
> On Thu, Nov 25, 2010 at 9:47 PM, Timothy Braun<br>
> <<a href="mailto:braunsquared@gmail.com">braunsquared@gmail.com</a>> wrote:<br>
><br>
><br>
> Hello Everyone,<br>
> I'm fairly new to G-Streamer so any input you can<br>
> provide is much appreciated. I'm working on a project<br>
> where we need to generate a 2 minute video which is a<br>
> composite of a total of 24 input videos. The output<br>
> video will have 4 different 30 second sections, each<br>
> containing a 3x2 grid of the smaller input videos.<br>
> The input videos are all naturally at 240x240 with the<br>
> goal of having a final output frame size of 720x480.<br>
><br>
> Using gst-launch, I've been able to construct a<br>
> sample 30 second clip using a combination of inputs,<br>
> videoboxes and a videomixer. Here is what I've come<br>
> up with so far:<br>
><br>
> videomixer name=mix ! ffmpegcolorspace !<br>
> ffenc_mpeg1video ! ffmux_mpeg name=mux ! queue !<br>
> filesink location=output.mpg<br>
> adder name=adder ! audioconvert ! ffenc_mp2 ! mux.<br>
> filesrc location=loop1.mp4 ! decodebin name=decode1<br>
> decode1. ! videobox border-alpha=0 top=-240 left=0 !<br>
> queue ! mix.<br>
> decode1. ! adder.<br>
> filesrc location=loop2.mp4 ! decodebin name=decode2<br>
> decode2. ! videobox border-alpha=0 top=-240<br>
> left=-240 ! queue ! mix.<br>
> decode2. ! adder.<br>
> filesrc location=loop3.mp4 ! decodebin name=decode3<br>
> decode3. ! videobox border-alpha=0 top=-240<br>
> left=-480 ! queue ! mix.<br>
> decode3. ! adder.<br>
> filesrc location=loop4.mp4 ! decodebin name=decode4<br>
> decode4. ! videobox border-alpha=0 top=0 left=0 !<br>
> queue ! mix.<br>
> decode4. ! adder.<br>
> filesrc location=loop5.mp4 ! decodebin name=decode5<br>
> decode5. ! videobox border-alpha=0 top=0 left=-240 !<br>
> queue ! mix.<br>
> decode5. ! adder.<br>
> filesrc location=loop6.mp4 ! decodebin name=decode6<br>
> decode6. ! videobox border-alpha=0 top=0 left=-480 !<br>
> queue ! mix.<br>
> decode6. ! adder.<br>
><br>
> Now I need to do this 4 times, each time with a<br>
> potentially different video in each box. I've started<br>
> looking into C interfaces as there's other pieces of<br>
> the puzzle which need to be tied into this, and I am<br>
> trying to determine the best way to tackle this. I<br>
> originally was looking at Gnonlin, but the<br>
> documentation is lacking in regards to how<br>
> gnloperations work. I also recently stumbled upon the<br>
> GES library by Edward Hervey, this looks promising as<br>
> well, but I haven't been able to spend much time on<br>
> it.<br>
><br>
> If I go the Gnonlin route, I believe I would need 6<br>
> compositions, one for each box. At the 30 second<br>
> marker, I would swap the filesource to a new one using<br>
> dynamic pads and listening for messages on the<br>
> pipeline bus. Am I far off on this? Any suggestions?<br>
><br>
> As for the GES library, it looks very promising and<br>
> powerful from the little I read on it. Would this be<br>
> the smarter route to take? If so, does anyone have<br>
> any suggestions for how the pipeline would be<br>
> structured?<br>
><br>
> Thank you in advance for your time on this and I<br>
> truly appreciate any information you are willing to<br>
> share with me.<br>
><br>
> Happy Thanksgiving,<br>
> Tim<br>
><br>
><br>
> ------------------------------------------------------------------------------<br>
> Increase Visibility of Your 3D Game App & Earn a<br>
> Chance To Win $500!<br>
> Tap into the largest installed PC base & get more eyes<br>
> on your game by<br>
> optimizing for Intel(R) Graphics Technology. Get<br>
> started today with the<br>
> Intel(R) Software Partner Program. Five $500 cash<br>
> prizes are up for grabs.<br>
> <a href="http://p.sf.net/sfu/intelisp-dev2dev" target="_blank">http://p.sf.net/sfu/intelisp-dev2dev</a><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
><br>
><br>
><br>
><br>
> --<br>
> <a href="http://www.mediamagictechnologies.com" target="_blank">www.mediamagictechnologies.com</a> (Gstreamer, ffmpeg, Red5,<br>
> Streaming)<br>
> twitter handle: @gst_kaps<br>
> <a href="http://www.linkedin.com/in/kapilagrawal" target="_blank">http://www.linkedin.com/in/kapilagrawal</a><br>
><br>
> ------------------------------------------------------------------------------<br>
> Increase Visibility of Your 3D Game App & Earn a Chance To Win<br>
> $500!<br>
> Tap into the largest installed PC base & get more eyes on your<br>
> game by<br>
> optimizing for Intel(R) Graphics Technology. Get started today<br>
> with the<br>
> Intel(R) Software Partner Program. Five $500 cash prizes are<br>
> up for grabs.<br>
> <a href="http://p.sf.net/sfu/intelisp-dev2dev" target="_blank">http://p.sf.net/sfu/intelisp-dev2dev</a><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
><br>
><br>
> ------------------------------------------------------------------------------<br>
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!<br>
> Tap into the largest installed PC base & get more eyes on your game by<br>
> optimizing for Intel(R) Graphics Technology. Get started today with the<br>
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.<br>
> <a href="http://p.sf.net/sfu/intelisp-dev2dev" target="_blank">http://p.sf.net/sfu/intelisp-dev2dev</a><br>
> _______________________________________________ gstreamer-devel mailing list <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
<br>
<br>
<br>
------------------------------------------------------------------------------<br>
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!<br>
Tap into the largest installed PC base & get more eyes on your game by<br>
optimizing for Intel(R) Graphics Technology. Get started today with the<br>
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.<br>
<a href="http://p.sf.net/sfu/intelisp-dev2dev" target="_blank">http://p.sf.net/sfu/intelisp-dev2dev</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br>