diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 3090be72f0..a545947fe9 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -1834,6 +1834,14 @@ Video this can break on streams not encoded by x264, or if a stream encoded by a newer x264 version contains no version info. +``--vd-apply-cropping`` + Certain video codecs support cropping, meaning that only a sub-rectangle of + the decoded frame is intended for display. This option controls how cropping + is handled by libavcodec. Cropping during decoding has certain limitations + with regards to alignment and hardware decoding. If this option is enabled, + decoder will apply the crop. Disabled by default, VO will apply the crop in + a more robust way. + ``--swapchain-depth=`` Allow up to N in-flight frames. This essentially controls the frame latency. Increasing the swapchain depth can improve pipelining and prevent diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 0c87005ddd..54a9975915 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -80,6 +80,7 @@ struct vd_lavc_params { int threads; bool bitexact; bool old_x264; + bool apply_cropping; bool check_hw_profile; int software_fallback; char **avopts; @@ -120,6 +121,7 @@ const struct m_sub_options vd_lavc_conf = { {"vd-lavc-o", OPT_KEYVALUELIST(avopts)}, {"vd-lavc-dr", OPT_CHOICE(dr, {"auto", -1}, {"no", 0}, {"yes", 1})}, + {"vd-apply-cropping", OPT_BOOL(apply_cropping)}, {"hwdec", OPT_STRINGLIST(hwdec_api), .help = hwdec_opt_help, .flags = M_OPT_OPTIONAL_PARAM | UPDATE_HWDEC}, @@ -772,6 +774,7 @@ static void init_avctx(struct mp_filter *vd) avctx->skip_loop_filter = lavc_param->skip_loop_filter; avctx->skip_idct = lavc_param->skip_idct; avctx->skip_frame = lavc_param->skip_frame; + avctx->apply_cropping = lavc_param->apply_cropping; if (lavc_codec->id == AV_CODEC_ID_H264 && lavc_param->old_x264) av_opt_set(avctx, "x264_build", "150", AV_OPT_SEARCH_CHILDREN);