Explorar o código

obs-ffmpeg: Tell FFmpeg that BGRA uses alpha

Prevents alpha from getting dropped with custom encoders.

(cherry picked from commit 3462ea3fdac41b2d544bc9403edac0820d42e911)
jpark37 %!s(int64=2) %!d(string=hai) anos
pai
achega
43086717c4
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      plugins/obs-ffmpeg/obs-ffmpeg-output.c

+ 3 - 1
plugins/obs-ffmpeg/obs-ffmpeg-output.c

@@ -241,8 +241,10 @@ static bool create_video_stream(struct ffmpeg_data *data)
 
 	closest_format = data->config.format;
 	if (data->vcodec->pix_fmts) {
+		const int has_alpha = closest_format == AV_PIX_FMT_BGRA;
 		closest_format = avcodec_find_best_pix_fmt_of_list(
-			data->vcodec->pix_fmts, data->config.format, 0, NULL);
+			data->vcodec->pix_fmts, closest_format, has_alpha,
+			NULL);
 	}
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)