ffmpegcolor-spaceinterlacing

Swscale color space convert interlaced frames?


I am writing an application that exports video that I have captured (PAL SDI). The original color space is uyvy (4:2:2). When I convert the frames with swscale to 4:2:0 and encode with avcodec I get color bleeding between the fields. I suspect this is from swscale not being aware of the frame being interlaced. Here is an example of a part of a bob-deinterlaced frame from my exported video showing one of the fields:

color bleeding between fields

As you can see, the color bleeds from the other field. How do I keep this from happening? I have looked at the library and tried to find anything in swscale that tells it to respect the fields, but I haven't found anything.

I store each field in seperate buffers, so I can process the fields individually before hand if that would help.

Thankful for any help on this!

Regards Carl

Edit: Basically, what I want is to output PAL DV. I suspect swscale is able to somehow produce this type of interlaced 420, since ffmpeg (the application) can handle this (I think).


Solution

  • The answer is to do two swscale operations, one for each field. You can trick swscale to use the same buffer by specifying half the height with double the stride, and then offsetting the second operation by one line.

    I finally got the answer from the libav-user list. Example code can be found in MPlayer/libmpcodecs/vf_scale.c and libavfilter/vf_scale.c