[FFmpeg-devel] 4:2:0 DV25 file wrongly identified as 4:1:1

Niobos niobos
Fri Sep 3 14:06:13 CEST 2010


I'm trying to pin down an issue we're having decoding a DV25 stream. The
problem seems to be that ffmpeg (libavcodec to be more precise) thinks
the content is in SMPTE314M 4:1:1 format, while it actually is in
IEC61834 4:2:0 format. I'm not sure that ffmpeg is wrong; the file does
look fishy too...

First some context from the libavcodec's point of view:

The corresponding if-statement seems to be located here:
   /* 576i50 25Mbps 4:1:1 is a special case */
   if (dsf == 1 && stype == 0 && frame[5] & 0x07) {
       return &dv_profiles[2];
Especially the last condition checking frame[5]'s lower 3 bits.

This line dates back from commit
69afa85bf7cb5e3491efdd088d7b5067a2858d6d, but the logic is much older. I
traced it back through GIT (sorry, I'm a little more familiar with GIT
than with SVN): (recent to old)
* 69afa85bf7cb5e3491efdd088d7b5067a2858d6d
* fe4d60d52c7ba06b5d035db6660820dc07c45272
* ba65fac202644cce948a7f11bd27759499213d1c
* 691af50dbdf7262aa732b1a2eab42fb2f6873316

During the beginning of its lifetime, it was commented as "APT flag",
but that comment was lost on the last commit (69afa).

The DV-stream contains the following Application ID fields:
APT=0b000 AP1=0b001 AP2=0b001 AP3=0b001

SMPTE314M states that four 0b000 values indicate IEC parameters (4:2:0,
correct in this case); while four 0b001 values indicate SMPTE parameters
(4:1:1, incorrect in this case). Clearly, this file conforms to none of
these defined sets.

The reason why I'm raising this issue here (as well as with the tool
that produced the file), is that a simple fix (attached) will:
* make ffmpeg work for our production system
* conform to the original comment (which is now lost) by checking the
APT flag instead of the AP1 flag.

Obviously, this change may break DV decoding if the current behaviour is
desired. I'm no expert on the DV format, comments and insights are welcome.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dv25-wrongly-identified-as-411.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100903/6ec4efac/attachment.txt>

More information about the ffmpeg-devel mailing list