diff --git a/record/ffemu.c b/record/ffemu.c index 3e9477e3b7..62bdc2be3f 100644 --- a/record/ffemu.c +++ b/record/ffemu.c @@ -158,15 +158,23 @@ static bool ffemu_init_audio(struct ff_audio_info *audio, struct ffemu_params *p static bool ffemu_init_video(struct ff_video_info *video, const struct ffemu_params *param) { AVCodec *codec = NULL; + if (g_settings.video.h264_record) { codec = avcodec_find_encoder_by_name("libx264rgb"); // Older versions of FFmpeg have RGB encoding in libx264. if (!codec) codec = avcodec_find_encoder_by_name("libx264"); + + video->pix_fmt = PIX_FMT_BGR24; + video->scaler.out_fmt = SCALER_FMT_BGR24; } else + { codec = avcodec_find_encoder_by_name("ffv1"); + video->pix_fmt = PIX_FMT_RGB32; + video->scaler.out_fmt = SCALER_FMT_ARGB8888; + } if (!codec) return false; @@ -194,17 +202,6 @@ static bool ffemu_init_video(struct ff_video_info *video, const struct ffemu_par return false; } - if (g_settings.video.h264_record) - { - video->pix_fmt = PIX_FMT_BGR24; - video->scaler.out_fmt = SCALER_FMT_BGR24; - } - else - { - video->pix_fmt = PIX_FMT_RGB32; - video->scaler.out_fmt = SCALER_FMT_ARGB8888; - } - #ifdef HAVE_FFMPEG_ALLOC_CONTEXT3 video->codec = avcodec_alloc_context3(codec); #else