From a42c6aa1f63115ec1851868c5390039ffd55d089 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 3 Jul 2020 03:50:12 -0700 Subject: [PATCH] FFmpeg: Use range coder for FFV1 to reduce output size --- CHANGES | 1 + src/feature/ffmpeg/ffmpeg-encoder.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGES b/CHANGES index 6d6daa436..3e11a0ec4 100644 --- a/CHANGES +++ b/CHANGES @@ -41,6 +41,7 @@ Other fixes: Misc: - Debugger: Keep track of global cycle count - FFmpeg: Add looping option for GIF/APNG + - FFmpeg: Use range coder for FFV1 to reduce output size - Qt: Renderer can be changed while a game is running - Qt: Add hex index to palette view - Qt: Add transformation matrix info to sprite view diff --git a/src/feature/ffmpeg/ffmpeg-encoder.c b/src/feature/ffmpeg/ffmpeg-encoder.c index ca6272f4f..b47fca6aa 100644 --- a/src/feature/ffmpeg/ffmpeg-encoder.c +++ b/src/feature/ffmpeg/ffmpeg-encoder.c @@ -383,6 +383,11 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) { // QuickTime and a few other things require YUV420 encoder->video->pix_fmt = AV_PIX_FMT_YUV420P; } +#if LIBAVCODEC_VERSION_MAJOR >= 57 + if (encoder->video->codec->id == AV_CODEC_ID_FFV1) { + av_opt_set(encoder->video->priv_data, "coder", "range_tab", 0); + } +#endif if (strcmp(vcodec->name, "libx264") == 0) { // Try to adaptively figure out when you can use a slower encoder