From 3e75dae3dce0fdae8e7ea0edc73ddd20a5e0e7d4 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 18 Sep 2018 14:24:22 -0700 Subject: [PATCH] FFmpeg: Support lossless VP9 encoding --- CHANGES | 1 + src/feature/ffmpeg/ffmpeg-encoder.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index e0f784b9a..57090240b 100644 --- a/CHANGES +++ b/CHANGES @@ -89,6 +89,7 @@ Misc: - Wii: Move audio handling to callbacks (fixes mgba.io/i/803) - Qt: Clean up FPS target UI (fixes mgba.io/i/436) - Core: Remove broken option for whether rewinding restores save games + - FFmpeg: Support lossless VP9 encoding 0.6.3: (2017-04-14) Bugfixes: diff --git a/src/feature/ffmpeg/ffmpeg-encoder.c b/src/feature/ffmpeg/ffmpeg-encoder.c index acf21dd8c..c1c6439b4 100644 --- a/src/feature/ffmpeg/ffmpeg-encoder.c +++ b/src/feature/ffmpeg/ffmpeg-encoder.c @@ -334,6 +334,10 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) { encoder->video->pix_fmt = AV_PIX_FMT_YUV444P; } } + if (strcmp(vcodec->name, "libvpx-vp9") == 0 && encoder->videoBitrate == 0) { + av_opt_set(encoder->video->priv_data, "lossless", "1", 0); + encoder->video->pix_fmt = AV_PIX_FMT_YUV444P; + } avcodec_open2(encoder->video, vcodec, 0); #if LIBAVCODEC_VERSION_MAJOR >= 55