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

Mark Himsley mark at mdsh.com
Mon Mar 28 23:36:47 CEST 2011


On 28/03/11 21:43, Michael Niedermayer wrote:
> On Mon, Mar 28, 2011 at 08:35:19PM +0100, Mark Himsley 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.
>>
>> But it's only a name, so it's not something I'm going to stress about :-)
>
> same here i dont mind the name, but ill send the users to you if they
> are confused :)

Now that *is* a good point!

Considering your and Thomas' input, perhaps fieldorder would be better. 
(it isn't necessarily field swap because the filter will do nothing it 
the fields are already correct)

[...]

>>>> +static int query_formats(AVFilterContext *ctx)
>>>> +{
>>>> +    enum PixelFormat pix_fmts[] = {
>>>> +        PIX_FMT_YUV444P,  PIX_FMT_YUV422P,
>>>> +        PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
>>>> +        PIX_FMT_RGB24,    PIX_FMT_BGR24,
>>>> +        PIX_FMT_ARGB,     PIX_FMT_ABGR,
>>>> +        PIX_FMT_RGBA,     PIX_FMT_BGRA,
>>>> +        PIX_FMT_NONE
>>>> +    };
>>>
>>> i think the filter could easily be made to support more formats
>>
>> 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.
>>
>
>> But, yes, you're right that this might not be a complete list of formats
>> that can be supported by this filter.
>
> yes, thats what ive meant, there is 15/16/48 bit rgb at least missing

I'll look into this for my next attempt.

-- 
Mark


More information about the ffmpeg-devel mailing list