Opened 3 years ago
Closed 3 years ago
#9459 closed defect (fixed)
w3fdif inserting extraneous frame (at beginning?) when selective deinterlacing all-progressive input
Reported by: | Tim | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | |
Cc: | Tim | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
ffmpeg -i sample.mkv -vcodec prores -vf yadif=deint=interlaced -y yadif.mkv
frame= 34 fps=0.0 q=-0.0 Lsize= 144kB time=00:00:01.38 bitrate= 850.5kbits/s speed=31.6x
ffmpeg -i sample.mkv -vcodec prores -vf w3fdif=deint=interlaced -y w3fdif.mkv
frame= 35 fps=0.0 q=-0.0 Lsize= 148kB time=00:00:01.38 bitrate= 875.4kbits/s speed=33.3x
mkvinfo -v w3fdif.mkv | grep timestamp
| + Cluster timestamp: 00:00:00.000000000 | + Simple block: key, track number 1, 1 frame(s), timestamp 00:00:00.000000000 | + Cluster timestamp: 00:00:00.017000000 | + Simple block: key, track number 1, 1 frame(s), timestamp 00:00:00.017000000 <-- extra frame here??? | + Cluster timestamp: 00:00:00.050000000 | + Simple block: key, track number 1, 1 frame(s), timestamp 00:00:00.050000000
mkvinfo -v yadif.mkv | grep timestamp
| + Cluster timestamp: 00:00:00.000000000 | + Simple block: key, track number 1, 1 frame(s), timestamp 00:00:00.000000000 | + Cluster timestamp: 00:00:00.050000000 | + Simple block: key, track number 1, 1 frame(s), timestamp 00:00:00.050000000
Attachments (1)
Change History (3)
by , 3 years ago
Attachment: | sample.mkv added |
---|
comment:1 by , 3 years ago
Looking at yadif_common.c and checking for behavior differences, I notice ff_yadif_filter_frame() returns before the call to ff_filter_frame() when !yadif->prev, whereas filter_frame() checks for !s->prev but later (so in case of selective deinterlacing, ff_filter_frame() is called even when !s->prev)…
I guess the following might be a possible solution, but this is pure guesswork:
diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c index c2ea76dfa3..41a45ea06c 100644 --- a/libavfilter/vf_w3fdif.c +++ b/libavfilter/vf_w3fdif.c @@ -526,6 +526,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) return AVERROR(ENOMEM); } + if (!s->prev) + return 0; + if ((s->deint && !s->cur->interlaced_frame) || ctx->is_disabled) { AVFrame *out = av_frame_clone(s->cur); if (!out) @@ -537,9 +540,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) return ff_filter_frame(ctx->outputs[0], out); } - if (!s->prev) - return 0; - ret = filter(ctx, 0); if (ret < 0 || s->mode == 0) return ret;
comment:2 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
All-progressive sample