avfilter/idet: add current frame classification to metadata
Fixes ticket 3832 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
2847843868
commit
ae6118de19
@ -5577,9 +5577,17 @@ Detect video interlacing type.
|
|||||||
This filter tries to detect if the input is interlaced or progressive,
|
This filter tries to detect if the input is interlaced or progressive,
|
||||||
top or bottom field first.
|
top or bottom field first.
|
||||||
|
|
||||||
|
Single frame detection considers only immediately adjacent frames when classifying each frame.
|
||||||
|
Multiple frame detection incorporates the classification history of previous frames.
|
||||||
|
|
||||||
The filter will log these metadata values:
|
The filter will log these metadata values:
|
||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
|
@item single.current_frame
|
||||||
|
Detected type of current frame using single-frame detection. One of:
|
||||||
|
``tff'' (top field first), ``bff'' (bottom field first),
|
||||||
|
``progressive'', or ``undetermined''
|
||||||
|
|
||||||
@item single.tff
|
@item single.tff
|
||||||
Cumulative number of frames detected as top field first using single-frame detection.
|
Cumulative number of frames detected as top field first using single-frame detection.
|
||||||
|
|
||||||
@ -5589,6 +5597,11 @@ Cumulative number of frames detected as top field first using multiple-frame det
|
|||||||
@item single.bff
|
@item single.bff
|
||||||
Cumulative number of frames detected as bottom field first using single-frame detection.
|
Cumulative number of frames detected as bottom field first using single-frame detection.
|
||||||
|
|
||||||
|
@item multiple.current_frame
|
||||||
|
Detected type of current frame using multiple-frame detection. One of:
|
||||||
|
``tff'' (top field first), ``bff'' (bottom field first),
|
||||||
|
``progressive'', or ``undetermined''
|
||||||
|
|
||||||
@item multiple.bff
|
@item multiple.bff
|
||||||
Cumulative number of frames detected as bottom field first using multiple-frame detection.
|
Cumulative number of frames detected as bottom field first using multiple-frame detection.
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ AVFILTER_DEFINE_CLASS(idet);
|
|||||||
static const char *type2str(Type type)
|
static const char *type2str(Type type)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case TFF : return "Top Field First ";
|
case TFF : return "tff";
|
||||||
case BFF : return "Bottom Field First";
|
case BFF : return "bff";
|
||||||
case PROGRESSIVE : return "Progressive ";
|
case PROGRESSIVE : return "progressive";
|
||||||
case UNDETERMINED : return "Undetermined ";
|
case UNDETERMINED : return "undetermined";
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -149,13 +149,15 @@ static void filter(AVFilterContext *ctx)
|
|||||||
idet->prestat [ type] ++;
|
idet->prestat [ type] ++;
|
||||||
idet->poststat[idet->last_type] ++;
|
idet->poststat[idet->last_type] ++;
|
||||||
|
|
||||||
av_log(ctx, AV_LOG_DEBUG, "Single frame:%s, Multi frame:%s\n", type2str(type), type2str(idet->last_type));
|
av_log(ctx, AV_LOG_DEBUG, "Single frame:%12s, Multi frame:%12s\n", type2str(type), type2str(idet->last_type));
|
||||||
|
|
||||||
|
av_dict_set (metadata, "lavfi.idet.single.current_frame", type2str(type), 0);
|
||||||
av_dict_set_int(metadata, "lavfi.idet.single.tff", idet->prestat[TFF], 0);
|
av_dict_set_int(metadata, "lavfi.idet.single.tff", idet->prestat[TFF], 0);
|
||||||
av_dict_set_int(metadata, "lavfi.idet.single.bff", idet->prestat[BFF], 0);
|
av_dict_set_int(metadata, "lavfi.idet.single.bff", idet->prestat[BFF], 0);
|
||||||
av_dict_set_int(metadata, "lavfi.idet.single.progressive", idet->prestat[PROGRESSIVE], 0);
|
av_dict_set_int(metadata, "lavfi.idet.single.progressive", idet->prestat[PROGRESSIVE], 0);
|
||||||
av_dict_set_int(metadata, "lavfi.idet.single.undetermined", idet->prestat[UNDETERMINED], 0);
|
av_dict_set_int(metadata, "lavfi.idet.single.undetermined", idet->prestat[UNDETERMINED], 0);
|
||||||
|
|
||||||
|
av_dict_set (metadata, "lavfi.idet.multiple.current_frame", type2str(idet->last_type), 0);
|
||||||
av_dict_set_int(metadata, "lavfi.idet.multiple.tff", idet->poststat[TFF], 0);
|
av_dict_set_int(metadata, "lavfi.idet.multiple.tff", idet->poststat[TFF], 0);
|
||||||
av_dict_set_int(metadata, "lavfi.idet.multiple.bff", idet->poststat[BFF], 0);
|
av_dict_set_int(metadata, "lavfi.idet.multiple.bff", idet->poststat[BFF], 0);
|
||||||
av_dict_set_int(metadata, "lavfi.idet.multiple.progressive", idet->poststat[PROGRESSIVE], 0);
|
av_dict_set_int(metadata, "lavfi.idet.multiple.progressive", idet->poststat[PROGRESSIVE], 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user