summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_enc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-09-14 16:46:47 +0200
committerAnton Khirnov <anton@khirnov.net>2023-09-18 17:15:53 +0200
commit43a0004b5c23dd8258cfe723a5c4e9fd9ee8f5ef (patch)
tree2b377c4dc97cca45b2a6c6946e632a63b397b447 /fftools/ffmpeg_enc.c
parent74b643a51e05ee816b810b86974f675eb46ab2cf (diff)
fftools/ffmpeg_enc: apply -top to individual encoded frames
Fixes #9339.
Diffstat (limited to 'fftools/ffmpeg_enc.c')
-rw-r--r--fftools/ffmpeg_enc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index e878eb02b4..902ba3c37a 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -1156,6 +1156,11 @@ static int do_video_out(OutputFile *of, OutputStream *ost, AVFrame *frame)
in_picture->quality = enc->global_quality;
in_picture->pict_type = forced_kf_apply(ost, &ost->kf, enc->time_base, in_picture, i);
+ if (ost->top_field_first >= 0) {
+ in_picture->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
+ in_picture->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * (!!ost->top_field_first);
+ }
+
ret = submit_encode_frame(of, ost, in_picture);
if (ret == AVERROR_EOF)
break;