[FFmpeg-user] UVC Interlaced Video

Andrew Randrianasulu randrianasulu at gmail.com
Sun Nov 12 20:00:59 EET 2023


сб, 11 нояб. 2023 г., 13:05 Zdravko Ćirić <zdravkociric88 at gmail.com>:

> Hello all,
>
> I'm trying to combine an alternating fields interlaced video stream from an
> UVC video device. The device is an analog (CVBS) to digital converter that
> supports Interlaced video through usage of the FID flag in the UVC data
> headers. USB Video Class documentation explanation "One field per sample:
> Each sample contains only one field and the FID bit is used to indicate
> whether a given video sample contains a top field or a bottom field".
> Stream frame size is 720x288pix at 50fps and the output video should be
> "combed" and result in a 720x576pix video at 25fps.
>
> I tried weave and tinterlace filters but it works on random as ffmpeg seems
> to miss the data regarding the field polarity.
>
> Could ffmpeg make use of this flag so that i can join two fields in one
> frame in correct order?
>

good question.

I looked into source and there seems to be some support for reading
interlace and esp. top field first signal in there?


if (fmt.fmt.pix.field == V4L2_FIELD_INTERLACED) {
        av_log(ctx, AV_LOG_DEBUG,
               "The V4L2 driver is using the interlaced mode\n");
        s->interlaced = 1;


but also

static int first_field(const struct video_data *s)
{
    int res;
    v4l2_std_id std;

    res = v4l2_ioctl(s->fd, VIDIOC_G_STD, &std);
    if (res < 0)
        return 0;
    if (std & V4L2_STD_NTSC)
        return 0;

    return 1;
}


does this mean this function always return "not a top field" if format ==
NTSC?

due to this chunk below ..
=====
if ((res = mmap_init(ctx)) ||
        (res = mmap_start(ctx)) < 0)
            goto fail;

    s->top_field_first = first_field(s);

    st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
    st->codecpar->codec_id = codec_id;
=====


src is

ffmpeg-6.1/libavdevice/v4l2.c

>
>
> Thank you in advance
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list