[FFmpeg-trac] #5092(avcodec:new): Field order wrong for DV HD
FFmpeg
trac at avcodec.org
Mon Dec 19 15:04:47 EET 2016
#5092: Field order wrong for DV HD
------------------------------------+-----------------------------------
Reporter: Dan203 | Owner:
Type: defect | Status: new
Priority: normal | Component: avcodec
Version: git-master | Resolution:
Keywords: dvvideo | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+-----------------------------------
Comment (by Aleksandr_Slobodeniuk):
Replying to [comment:9 cehoyos]:
> How did you test this?
> I ask because FFmpeg correctly shows tff here on the console and
correctly uses tff when using a deinterlacer (tested with yadif).
By watching
{{{
AVFrame->interlaced_frame
}}}
and
{{{
AVFrame->top_field_first
}}}
in the debugger, and watching how they're filling in libavcodec/dvdec.c :
{{{
/* Determine the codec's sample_aspect ratio from the packet */
vsc_pack = buf + 80 * 5 + 48 + 5;
if (*vsc_pack == dv_video_control) {
apt = buf[4] & 0x07;
is16_9 = (vsc_pack[2] & 0x07) == 0x02 ||
(!apt && (vsc_pack[2] & 0x07) == 0x07);
ff_set_sar(avctx, s->sys->sar[is16_9]);
}
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
frame->interlaced_frame = 1;
frame->top_field_first = 0;
/* Determine the codec's field order from the packet */
if ( *vsc_pack == dv_video_control ) {
frame->top_field_first = !(vsc_pack[3] & 0x40);
}
}}}
The situation is strange, because SMPTE 370m and 314m tells about bit
(vsc_pack[3] & 0x40), that:
{{{
FS: First/second field flag
FS indicates a field which is delivered during the field one period.
0 = Field 2 is delivered; 1 = Field 1 is delivered.
FF FS Output field
1 1 Field 1 and field 2 are output in this order (1,2 sequence)
1 0 Field 2 and field 1 are output in this order (2,1 sequence)
0 1 Field 1 is output twice
0 0 Field 2 is output twice
}}}
same for both 1080 system and 720 system.
This is actually not what ffmpeg does:
{{{
frame->top_field_first = !(vsc_pack[3] & 0x40);
}}}
but this code works correctly for dv sd files.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/5092#comment:11>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list