[FFmpeg-devel] [PATCH] add top video filter

Thomas Worth dev at rarevision.com
Mon Mar 28 23:17:30 CEST 2011


On Mon, Mar 28, 2011 at 12:35 PM, Mark Himsley <mark at mdsh.com> wrote:
> On 28/03/2011 19:39, Michael Niedermayer wrote:
>> On Mon, Mar 28, 2011 at 02:47:20PM +0100, Mark Himsley wrote:
>>> Dear developers,
>>>
>>> Converting to and from interlaced PAL DV files, with their
>>> bottom-field-first interlace field order, can be a pain. Converting tff
>>> files to DV results in tff DV files, which are hard to work with in
>>> editing software.
>>>
>>> The attached filter can:
>>>
>>> Convert field order by either moving all of the lines in the picture up
>>> by 1 line (bff to tff conversion) or down by 1 line (tff to bff
>>> conversion). The remaining line, the bottom line in bff to tff
>>> transforms or the top line in tff to bff transforms, is filled by
>>> copying the closest line in that field.
>>>
>>> Previous to this filter I have used a filter chain like this to do bff
>>> to tff conversion.
>>>
>>> format=yuv422p,crop=720:575:0:1,pad=720:576:0:0:black
>>>
>>> but that chain does not fill the remaining line.
>>>
>>> --
>>> Mark
>>
>>>  doc/filters.texi         |   29 +++++++
>>>  libavfilter/Makefile     |    1
>>>  libavfilter/allfilters.c |    1
>>>  libavfilter/vf_top.c     |  184 +++++++++++++++++++++++++++++++++++++++++++++++
>>
>> i think vshift or vmove or something like that is a better name
>
> I chose the filter name 'top' to match the -top command. I'm not keen on
> vshift or vmove because, in my mind, they don't describe the purpose of
> the filter - to change between top and bottom field first.

This should be called "fieldswap" or something very obvious. I can't
think of any other reason to shift the frame up or down by one pixel.


> It won't currently support formats with half-vertical resolution chroma.
> I think it's beyond my mathematical capabilities to move that chroma up
> of down by half a line.
>
> Or perhaps this filter should leave the half-vertical resolution chroma
> where it is... I think some experiments need to be done with chroma-key
> recorded on DV and converted to IMX-30, for instance.

Does the filter apply after swscale? If so, you can use swscale to
make the chroma full-raster on the Y axis and then do the field shift.


More information about the ffmpeg-devel mailing list