diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 2abf99ed93..13f8cf20ef 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -28,6 +28,7 @@ Interface changes --- mpv 0.38.0 --- - add `begin-vo-dragging` command + - add `--deinterlace-field-parity` option - add `--volume-gain`, `--volume-gain-min`, and `--volume-gain-max` options - add `current-gpu-context` property - add `--secondary-sub-ass-override` option diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 178b739c8d..6a09cf3884 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -1676,6 +1676,17 @@ Video inserted deinterlacing filters, and that this will make video look worse if it's not actually interlaced. +``--deinterlace-field-parity=`` + Specify the field parity/order when deinterlacing(default: auto) + Each frame of an interlaced video is divided into two fields, which are + then separately transmitted. Top field represents even lines while bottom + field represents odd lines. When deinterlacing the deinterlacer needs to + know the correct temporal order of the fields else the video will appear + jittery. + + ``auto`` will automatically try to detect the field order of the video, + ``tff`` forces top field first while ``bff`` forces bottom field first. + ``--frames=`` Play/convert only first ```` video frames, then quit. diff --git a/options/options.c b/options/options.c index 3675d5734d..796a6c668b 100644 --- a/options/options.c +++ b/options/options.c @@ -42,6 +42,7 @@ #include "input/event.h" #include "stream/stream.h" #include "video/csputils.h" +#include "video/filter/refqueue.h" #include "video/hwdec.h" #include "video/image_writer.h" #include "sub/osd.h" @@ -440,9 +441,16 @@ const struct m_sub_options filter_conf = { .opts = (const struct m_option[]){ {"deinterlace", OPT_CHOICE(deinterlace, {"no", 0}, {"yes", 1}, {"auto", -1})}, + {"deinterlace-field-parity", OPT_CHOICE(field_parity, + {"tff", MP_FIELD_PARITY_TFF}, + {"bff", MP_FIELD_PARITY_BFF}, + {"auto", MP_FIELD_PARITY_AUTO})}, {0} }, .size = sizeof(OPT_BASE_STRUCT), + .defaults = &(const struct filter_opts){ + .field_parity = MP_FIELD_PARITY_AUTO, + }, .change_flags = UPDATE_IMGPAR, }; diff --git a/options/options.h b/options/options.h index 9dce3f609c..1b7c3e3583 100644 --- a/options/options.h +++ b/options/options.h @@ -399,6 +399,7 @@ struct dvd_opts { struct filter_opts { int deinterlace; + int field_parity; }; extern const struct m_sub_options vo_sub_opts; diff --git a/video/filter/refqueue.h b/video/filter/refqueue.h index 0a8ace0031..9d47ee87fb 100644 --- a/video/filter/refqueue.h +++ b/video/filter/refqueue.h @@ -29,6 +29,10 @@ enum { MP_MODE_INTERLACED_ONLY = (1 << 2), // only deinterlace marked frames }; +#define MP_FIELD_PARITY_AUTO -1 +#define MP_FIELD_PARITY_TFF 0 +#define MP_FIELD_PARITY_BFF 1 + void mp_refqueue_set_mode(struct mp_refqueue *q, int flags); bool mp_refqueue_should_deint(struct mp_refqueue *q); bool mp_refqueue_is_top_field(struct mp_refqueue *q);