mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
vd_lavc: add an option to explicitly workaround x264 4:4:4 bug
Technically, the user could just use --vd-lavc-o with the same result. But I find it better to make this an explicit option, so we can document the ups and downs, and also avoid setting it for non-h264.
This commit is contained in:
parent
f6a582e0b2
commit
d480b1261b
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user