summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/options.rst12
-rw-r--r--video/decode/vd_lavc.c5
2 files changed, 17 insertions, 0 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index e76f5a115a..baf8f3a6d5 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -1159,6 +1159,18 @@ Video
on the machine and use that, up to the maximum of 16. You can set more than
16 threads manually.
+``--vd-lavc-assume-old-x264=<yes|no>``
+ Assume the video was encoded by an old, buggy x264 version (default: no).
+ Normally, this is autodetected by libavcodec. But if the bitstream contains
+ no x264 version info (or it was somehow skipped), and the stream was in fact
+ encoded by an old x264 version (build 150 or earlier), and if the stream
+ uses ``4:4:4`` chroma, then libavcodec will by default show corrupted video.
+ This option sets the libavcodec ``x264_build`` option to ``150``, which
+ means that if the stream contains no version info, or was not encoded by
+ x264 at all, it assumes it was encoded by the old version. Enabling this
+ option is pretty safe if you want your broken files to work, but in theory
+ this can break on streams not encoded by x264, or if a stream encoded by a
+ newer x264 version contains no version info.
Audio
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 29bf3ec56f..0f31de9f02 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -80,6 +80,7 @@ struct vd_lavc_params {
int framedrop;
int threads;
int bitexact;
+ int old_x264;
int check_hw_profile;
int software_fallback;
char **avopts;
@@ -109,6 +110,7 @@ const struct m_sub_options vd_lavc_conf = {
OPT_DISCARD("framedrop", framedrop, 0),
OPT_INT("threads", threads, M_OPT_MIN, .min = 0),
OPT_FLAG("bitexact", bitexact, 0),
+ OPT_FLAG("assume-old-x264", old_x264, 0),
OPT_FLAG("check-hw-profile", check_hw_profile, 0),
OPT_CHOICE_OR_INT("software-fallback", software_fallback, 0, 1, INT_MAX,
({"no", INT_MAX}, {"yes", 1})),
@@ -647,6 +649,9 @@ static void init_avctx(struct dec_video *vd)
avctx->skip_idct = lavc_param->skip_idct;
avctx->skip_frame = lavc_param->skip_frame;
+ if (lavc_codec->id == AV_CODEC_ID_H264 && lavc_param->old_x264)
+ av_opt_set(avctx, "x264_build", "150", AV_OPT_SEARCH_CHILDREN);
+
mp_set_avopts(vd->log, avctx, lavc_param->avopts);
// Do this after the above avopt handling in case it changes values