gstreamer Python and cairooverlay
Roy Wiggins
roywig at gmail.com
Sun Jan 6 18:43:18 PST 2013
Aha, there we go. I'd had a feeling it was the quotes, but thought the
escaped single quotes would do it. Thanks a lot- it looks like it should
work great for my application.
I'm sure I'll figure it out eventually, but is there an easy way to convert
screen locations relative to the containing window to locations relative to
the video? (0,0) always lives at the upper-left-hand corner of the video,
but that moves around if the window aspect ratio changes, and then there's
the dimensions of the video, too.
Olivier Aubert-2 wrote
> Indeed, it does not work when passing the data directly in single quotes
> in gst_parse_launch. It is because of quote handling which, in the
> command line, is in part handled by the shell and hides this issue (I
> guess).
>
> If you change your python into
> pipeline = gst.parse_launch('''videotestsrc ! ffmpegcolorspace !
> rsvgoverlay data="
> <svg>
> <circle cx='100' cy='100' r='50'
> fill='red' />
> </svg>
> " ! ffmpegcolorspace ! autovideosink''')
>
> (note the "double quote" to pass the parameter value) it works. The same
> goes for filename: it works from python as well as from the command
> line, if you use either no quote or double quotes to pass the parameter.
>
> However, from my experience in my own python-based app (www.advene.org),
> it is more convenient to pass the SVG value after pipeline
> initialization, especially if you want to dynamically modify the
> overlayed graphics:
>
> import gst
>
> pipeline = gst.parse_launch('''videotestsrc ! ffmpegcolorspace !
> rsvgoverlay name=overlay ! ffmpegcolorspace ! autovideosink''')
>
> pipeline.set_state(gst.STATE_PLAYING)
>
> overlay = pipeline.get_by_name('overlay')
>
> overlay.props.data = "
> <svg>
> <circle cx='100' cy='100' r='50'
> fill='red' />
> </svg>
> "
>
> # And if you need to clear the overlay after some time :
> overlay.props.data = None
>
> Best regards,
> Olivier
>
>
> On Sat, 2013-01-05 at 22:26 -0800, Roy Wiggins wrote:
>> I can't get a single svg element to show up using the python bindings :(
>>
>> The command line
>>
>> gst-launch-0.10 -v videotestsrc ! ffmpegcolorspace ! rsvgoverlay data =
>> '
> <svg>
> <circle cx="100" cy="100" r="50" fill="red" />
> </svg>
> ' !
>> ffmpegcolorspace ! autovideosink
>>
>> works as expected. I tried doing the same thing in Python, and while it
>> doesn't error, it also doesn't display the overlay (though the
>> videotestsrc
>> does show up):
>>
>> pipeline = gst.parse_launch('videotestsrc ! ffmpegcolorspace !
>> rsvgoverlay
>> data = \'
> <svg>
> <circle cx="100" cy="100" r="50" fill="red" />
> </svg>
> \' !
>> ffmpegcolorspace ! autovideosink')
>>
>> I also tried building the pipeline by creating each pad in turn and
>> linking
>> them, but that didn't work either; neither does using an svg file which
>> works just find at the command line.
>>
>>
>> Olivier Aubert-2 wrote
>> > Hello
>> >
>> > Given your requirements, did you give the rsvgoverlay element a try? It
>> > is cross-platform, and allows you to overlay arbitrary SVG graphics on
>> > top of the video. You do not have to write any cairo code, just
>> generate
>> > on-the-fly SVG code and feed it to the element.
>> >
>> > Olivier
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://gstreamer-devel.966125.n4.nabble.com/gstreamer-Python-and-cairooverlay-tp4655321p4657757.html
>> Sent from the GStreamer-devel mailing list archive at Nabble.com.
>> _______________________________________________
>> gstreamer-devel mailing list
>>
> gstreamer-devel at .freedesktop
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at .freedesktop
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/gstreamer-Python-and-cairooverlay-tp4655321p4657768.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list