[FFmpeg-devel] [PATCH 2/2] ffmpeg: Use the colour properties from the input stream when doing transcode
Haihao Xiang
haihao.xiang at intel.com
Wed May 16 10:19:45 EEST 2018
In lavc/hevec_vaapi, colour properties in AVCodecContext are needed to
write the sequence header
Tested by the command below:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128
-hwaccel_output_format vaapi -i input-with-hdr.mkv -c:v hevc_vaapi
-profile:v main10 output.h265
Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
---
fftools/ffmpeg.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 5a19a09d9a..80b5441f8f 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3298,6 +3298,10 @@ static int init_output_stream_encode(OutputStream *ost)
dec_ctx = ist->dec_ctx;
enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location;
+ enc_ctx->color_range = dec_ctx->color_range;
+ enc_ctx->color_primaries = dec_ctx->color_primaries;
+ enc_ctx->color_trc = dec_ctx->color_trc;
+ enc_ctx->colorspace = dec_ctx->colorspace;
} else {
for (j = 0; j < oc->nb_streams; j++) {
AVStream *st = oc->streams[j];
--
2.14.1
More information about the ffmpeg-devel
mailing list