Simple example of a video filter

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Simple example of a video filter

Brian Michalk
I've been looking through the sources for a simple element that I can
use as a basis for a filter that I want to write.
I don't have much experience in video streams, so I'm intimidated at all
of the plumbing needed to implement a lot of the functions of a normal
element.  Functions like seeking, resetting, etc.  I've looked at the
Pango text overlay, and the Theora encoder, as well as a few others.  
When I get into the video chains and such, I get lost in the amount of
detail.

I have also created a new node with the boilerplate, and compiled it,
and verified that it runs in the pipeline, but then am lost in finding a
good example on how to get from there to modification of the video stream.

I would like to start simple.  Not so simple from boilerplate, and not
so complicated as the two I mentioned above.  I figure a good start
would be to modify a video stream.  For an I420 stream, I want to
increment each pixel of the Y plane.  Once I get to that point, I know I
can get the rest of the filter implemented.

Is there any documentation, or simple app notes closer to what I am
looking for?

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Simple example of a video filter

Tim-Philipp Müller-2
On Tue, 2011-02-01 at 14:37 -0600, Brian Michalk wrote:

> I've been looking through the sources for a simple element that I can
> use as a basis for a filter that I want to write.
> I don't have much experience in video streams, so I'm intimidated at all
> of the plumbing needed to implement a lot of the functions of a normal
> element.  Functions like seeking, resetting, etc.  I've looked at the
> Pango text overlay, and the Theora encoder, as well as a few others.  
> When I get into the video chains and such, I get lost in the amount of
> detail.
>
> I have also created a new node with the boilerplate, and compiled it,
> and verified that it runs in the pipeline, but then am lost in finding a
> good example on how to get from there to modification of the video stream.
>
> I would like to start simple.  Not so simple from boilerplate, and not
> so complicated as the two I mentioned above.  I figure a good start
> would be to modify a video stream.  For an I420 stream, I want to
> increment each pixel of the Y plane.  Once I get to that point, I know I
> can get the rest of the filter implemented.
>
> Is there any documentation, or simple app notes closer to what I am
> looking for?

There's a GstVideoFilter base class in libgstvideo in gst-plugins-base.

A very simple element that supports I420 is the navigationtest element
in gst-plugins-good/gst/debug/. (Though it's not exactly tutorial
material, it should be easy enough to follow if you just ignore all the
navigation event handling.)

There are also numerous video effect plugins in -bad such as
coloreffects or geometrictransform.

Cheers
 -Tim


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Simple example of a video filter

Aki Suihkonen
In reply to this post by Brian Michalk
Hi,

The effectv filters in gst-plugins good may form the starting
point you need; Even though they don't implement anything
particularly advanced, such as dealing with different
input/output rates, different input/output formats or frame sizes,
they still contain a rather big amount of interfaces and glue
to the gstreamer infrastructure.

You would basically have to locate the function
xxxx_transform( GstBaseTransform *trans, GstBuffer *in, GstBuffer *out)
{
  GST_OBJECT_LOCK(object)

  GST_OBJECT_UNLOCK(object)
}

and write your transform function inbetween the LOCK/UNLOCK statements.
such as
for (i=0;i<number_of_y_pixels;i++) *dst++=*src++ + 1;

(or + 0x40 to actually see a difference)

The extra stuff is basically there to parse the caps / mimetypes
and get the necessary formats/widths/heights in order to know
how many bytes to process.

> I've been looking through the sources for a simple element that I can
> use as a basis for a filter that I want to write.
> I don't have much experience in video streams, so I'm intimidated at all
> of the plumbing needed to implement a lot of the functions of a normal
> element.  Functions like seeking, resetting, etc.  I've looked at the
> Pango text overlay, and the Theora encoder, as well as a few others.
> When I get into the video chains and such, I get lost in the amount of
> detail.
>
> I have also created a new node with the boilerplate, and compiled it,
> and verified that it runs in the pipeline, but then am lost in finding a
> good example on how to get from there to modification of the video stream.
>
> I would like to start simple.  Not so simple from boilerplate, and not
> so complicated as the two I mentioned above.  I figure a good start
> would be to modify a video stream.  For an I420 stream, I want to
> increment each pixel of the Y plane.  Once I get to that point, I know I
> can get the rest of the filter implemented.
>
> Is there any documentation, or simple app notes closer to what I am
> looking for?
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better
> price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>



------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Simple example of a video filter

Brian Michalk


On 02/02/2011 12:58 AM, Aki Suihkonen wrote:

> Hi,
>
> The effectv filters in gst-plugins good may form the starting
> point you need; Even though they don't implement anything
> particularly advanced, such as dealing with different
> input/output rates, different input/output formats or frame sizes,
> they still contain a rather big amount of interfaces and glue
> to the gstreamer infrastructure.
>
> You would basically have to locate the function
> xxxx_transform( GstBaseTransform *trans, GstBuffer *in, GstBuffer *out)
> {
>    GST_OBJECT_LOCK(object)
>
>    GST_OBJECT_UNLOCK(object)
> }
>
> and write your transform function inbetween the LOCK/UNLOCK statements.
> such as
> for (i=0;i<number_of_y_pixels;i++) *dst++=*src++ + 1;
>
> (or + 0x40 to actually see a difference)
>
> The extra stuff is basically there to parse the caps / mimetypes
> and get the necessary formats/widths/heights in order to know
> how many bytes to process.
>
Thanks.  That helped a lot.

Now, I am having problems with unresolved symbols.

I am referencing some functions in video.c, but when I run gst-launch,
it says those symbols are missing.  I can comment out the functions, and
my element behaves just fine.

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Simple example of a video filter

Tim-Philipp Müller-2
On Wed, 2011-02-02 at 17:09 -0600, Brian Michalk wrote:

> Thanks.  That helped a lot.
>
> Now, I am having problems with unresolved symbols.
>
> I am referencing some functions in video.c, but when I run gst-launch,
> it says those symbols are missing.  I can comment out the functions, and
> my element behaves just fine.

Sounds like you need to link against libgstvideo-0.10.

(pkg-config --libs gstreamer-video-0.10  should give you the right
linker flags.)

 Cheers
  -Tim


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Simple example of a video filter

Stefan Sauer
In reply to this post by Aki Suihkonen
Am 02.02.2011 08:58, schrieb Aki Suihkonen:

> Hi,
>
> The effectv filters in gst-plugins good may form the starting
> point you need; Even though they don't implement anything
> particularly advanced, such as dealing with different
> input/output rates, different input/output formats or frame sizes,
> they still contain a rather big amount of interfaces and glue
> to the gstreamer infrastructure.
>
> You would basically have to locate the function
> xxxx_transform( GstBaseTransform *trans, GstBuffer *in, GstBuffer *out)
> {
>   GST_OBJECT_LOCK(object)
>
>   GST_OBJECT_UNLOCK(object)
> }
>

The log is not needed in many cases. Some plugins use it to protect property
changes, if I recall right.

Stefan

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel