[FFmpeg-devel] [PATCH] avformat/avienc: fix fields-per-frame value for interlaced video streams

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Nov 23 00:52:40 EET 2017


2017-11-22 16:41 GMT+01:00 Tobias Rapp <t.rapp at noa-archive.com>:
> Writes one set of field framing information for progressive streams and
> two sets for interlaced streams. Fixes ticket #6383.
>
> Unfortunately the OpenDML v1.02 document is not very specific what value
> to use for start_line when frame data is not coming from a capturing
> device, so this is just using 0/1 depending on the field order as a
> best-effort guess.

I believe your approach is sane but the only available examples
may indicate that it should be set to something like height / 2 ;-(

> +            int num, den, fields, i;
>              av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
> +            if (par->field_order == AV_FIELD_TT || par->field_order == AV_FIELD_BB ||
> +                par->field_order == AV_FIELD_TB || par->field_order == AV_FIELD_BT) {
> +                fields = 2; // interlaced
> +            } else {
> +                fields = 1; // progressive

fields = 1 + field_order == TT || field_order == BB etc.;

> +            for (i = 0; i < fields; i++) {
> +                int start_line;
> +                if (par->field_order == AV_FIELD_TT || par->field_order == AV_FIELD_TB) {
> +                    start_line = (i == 0) ? 0 : 1;
> +                } else if (par->field_order == AV_FIELD_BB || par->field_order == AV_FIELD_BT) {
> +                    start_line = (i == 0) ? 1 : 0;

start_line = fields * (i ^ (par->field_order == AV_FIELD_BB ||
par->field_order == AV_FIELD_BT));

Which are imo less ugly.

Carl Eugen


More information about the ffmpeg-devel mailing list