[Libav-user] DV50 to M2V Artefacts (Color Ranges)

Gavin Smith gcs584 at yahoo.com
Thu May 18 23:45:10 EEST 2017

I am decoding the first frame of a DV video (PAL) and then encoding it repeatedly back again into M2V wrapped in MpegTS (ignoring audio).  I notice that the encoded frame has some interesting artefacts which I had originally put down to difference in color primaries, but I'm not so sure anymore.

The original clip is available online: 

I've captured some images from my application:
Decoded: http://imgur.com/a/V083K
Encoded: http://imgur.com/a/zgj4I

>From the above images, we can see that the dumped decoded frame looks okay.  The error occurs once it goes into the encoder.

A few questions:

1. The color characteristics of the DV's AVCodecContext and AVFrame are not explicitly set; they are all 'not specified'.  I fear I may be using the wrong color ranges. Is the 'not specified' in the data structures expected?  Is that common for the other decoders too? Is this considered a bug?  I've tried explicitly setting these properties in the AVFrame to the M2V encoder, but I may be using incorrect values. Nonetheless, I suspect the source clip is BT.601 625.

2. Using previous experience, do you know what the discrepancy in colors may be a symptom of?  It's quite interesting how the yellow bar shadows all the way down to the bottom of the encoded image but not in the decoded image.

3. The AVFrame of the decoded material indicates that the top_field_first = 0 and the field_order is BB.  I would expect top_field_first to be '1' and the field_order to be TT for PAL.  I do know that DV video is a bit quirky though. Any further explanation would be much appreciated.

4. Out of interest, can I use SWScale to convert the color primaries/ranges?

On a side note, the output/encoded image is being streamed to VLC to make observation easier (but I don't think this has any bearing on the output).



More information about the Libav-user mailing list