[FFmpeg-devel] [RFC] Interlaced material, pix_fmt change, auto-inserted scaler

Mark Himsley mark at mdsh.com
Tue Jul 26 10:49:09 CEST 2011


On 26/07/11 01:11, Michael Niedermayer wrote:
> On Mon, Jul 25, 2011 at 06:12:25PM +0100, Mark Himsley wrote:
>> Sorry for a very long rational for a very short patch.
>>
>> Cutting to the chase: What do you think of the attached patch?
>>
>>
>> Basically: I have been getting some strange colour artefacts when I
>> convert from yuv420p to yuv422p on interlaced material.
>>
>> Here is a demonstration clip:
>> http://commondatastorage.googleapis.com/himslm01/976_0003_01.AVI
>>
>> The clip is an original DV25 clip created in a camera. The important
>> part is the first 200 frames where there is a whip-pan across a bright
>> green light switch.
>>
>> If I convert that clip to a 422 format, I've chosen DV50 for ease of
>> this demonstration but I have also created IMX30 MPEG 2 video and it
>> shows the same issue I'm trying to describe:
>>
>> ffmpeg -loglevel debug -i 976_0003_01.AVI -vcodec dvvideo -pix_fmt
>> yuv422p -acodec pcm_s16le 976_0003_01.DV50.avi
>>
>> (full output of that command is below)
>>
>> If I look at the 422 output at field rate (for instance in a video
>> editor) then I can see that something is wrong with the chroma.
>>
>> I think I can also demonstrate that using FFmpeg by using the yadif
>> video filter on the original 420 and the new 422 copy:
>>
>> ffmpeg -loglevel debug -i 976_0003_01.DV50.avi -vframes 200 -vf yadif=1
>> -r 50 -f image2 422%04d.png
>>
>> frame 122 is a good one to compare,
>>
>> png taken from original footage:
>> http://commondatastorage.googleapis.com/himslm01/orig0122.png
>>
>> png taken from conversion to 422:
>> http://commondatastorage.googleapis.com/himslm01/4220122.png
>>
>> You can see the big difference.
>>
>>
>> But I noticed that if I specifically add an interlaced aware scale in
>> the video filter, the chroma is correct.
>>
>> ffmpeg -loglevel debug -i 976_0003_01.AVI -vcodec dvvideo -pix_fmt
>> yuv422p -acodec pcm_s16le -vf scale=0:0:interl=-1 976_0003_01.DV50-vf.avi
>>
>>
>> The attached patch makes scale default to being interlaced aware. Is
>> that a bad thing?
>>
>>
>> If you feel this patch will be ok I'll send it again along with updated
>> documentation with no training white space.
>
> it should be ok
>
> [...]

Two patches attached.

ffmpeg-scale-default-interlaced-aware.diff: make scale filter default to 
interlaced aware scaling & format changing dependent on source frames 
interlaced flag

ffmpeg-scale-default-interlaced-aware-format.diff: reformat to usual 
coding standards

-- 
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-scale-default-interlaced-aware.diff
Type: text/x-patch
Size: 1722 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110726/19303835/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-scale-default-interlaced-aware-format.diff
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110726/19303835/attachment-0001.bin>


More information about the ffmpeg-devel mailing list