[FFmpeg-devel] [PATCH] add top video filter
Mark Himsley
mark at mdsh.com
Mon Mar 28 23:56:24 CEST 2011
On 28/03/11 22:17, Thomas Worth wrote:
> 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.
Thank you - from your input I think fieldorder might be the right name.
fieldswap sound's like it will always swap, where as fieldorder sounds
like it will output the order you specify.
What I want to be able to do to leave this filter in the chain always,
no matter what the input source, with the knowledge that if I must
include "fieldorder=1" when I'm outputting IMX-30 and "fieldorder=0"
when I'm outputting DV (to take two examples of typical output 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.
>
> 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.
I have to admit that I tend to add "format=yuv422p,top=1".
That's because strangely, to my brain, I found that if:
my source file is yuv420p (DV);
my filter is just "top=1";
my destination file is yuv422p (IMX-30);
then the scale filters that were inserted automatically converted the
video to rgb24 for my "top" filter. That's not nice to my studio levels.
I was wondered if I have done something wrong in query_formats(), but I
hadn't quite plucked up the courage to ask something so simple.
Thank you for your feedback.
--
Mark
More information about the ffmpeg-devel
mailing list