[FFmpeg-devel] [PATCH] add top video filter
Mark Himsley
mark at mdsh.com
Mon Mar 28 21:35:19 CEST 2011
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 :-)
> off topic a bit:
> also theres another way to convert between top & bottom field first
> and that is to combine 2 fields from 2 seperate frames
Yes indeed. Removing the very first field and the very last field from a
clip will also swap the fields of the whole clip. But the down sides are
that you've lost a whole frame off the clip's duration and, more
importantly, video cuts which were on frame boundaries are now in the
middle of frames - making re-editing much more difficult.
Back on topic...
> [...]
>> +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.
[...]
--
Mark
More information about the ffmpeg-devel
mailing list