diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a0a79c..3990ae1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Stream mapping for cases where the video stream is not the first stream in the input file (#1217). +- The encoder using the wrong color space for the output video. ## [6.1.0] - 2024-11-04 diff --git a/src/encoder.cpp b/src/encoder.cpp index ad93ac6..44bc272 100644 --- a/src/encoder.cpp +++ b/src/encoder.cpp @@ -73,6 +73,13 @@ int init_encoder( codec_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio; codec_ctx->bit_rate = encoder_config->bit_rate; + // Set the color properties + codec_ctx->color_range = dec_ctx->color_range; + codec_ctx->color_primaries = dec_ctx->color_primaries; + codec_ctx->color_trc = dec_ctx->color_trc; + codec_ctx->colorspace = dec_ctx->colorspace; + codec_ctx->chroma_sample_location = dec_ctx->chroma_sample_location; + // Set the pixel format if (encoder_config->pix_fmt != AV_PIX_FMT_NONE) { // Use the specified pixel format