Skip to content

Commit

Permalink
fix avfilter changes color if format is rgb(a)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Jan 3, 2025
1 parent 2b9f250 commit 32abe16
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/modules/avformat/filter_avfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,22 +815,26 @@ static int filter_get_image(mlt_frame frame,
// ? AVCOL_RANGE_JPEG
// : AVCOL_RANGE_MPEG;

switch (mlt_properties_get_int(frame_properties, "colorspace")) {
case 240:
pdata->avinframe->colorspace = AVCOL_SPC_SMPTE240M;
break;
case 601:
pdata->avinframe->colorspace = AVCOL_SPC_BT470BG;
break;
case 709:
pdata->avinframe->colorspace = AVCOL_SPC_BT709;
break;
case 2020:
pdata->avinframe->colorspace = AVCOL_SPC_BT2020_NCL;
break;
case 2021:
pdata->avinframe->colorspace = AVCOL_SPC_BT2020_CL;
break;
if (*format == mlt_image_rgb || *format == mlt_image_rgba) {
pdata->avinframe->colorspace = AVCOL_SPC_RGB;
} else {
switch (mlt_properties_get_int(frame_properties, "colorspace")) {
case 240:
pdata->avinframe->colorspace = AVCOL_SPC_SMPTE240M;
break;
case 601:
pdata->avinframe->colorspace = AVCOL_SPC_BT470BG;
break;
case 709:
pdata->avinframe->colorspace = AVCOL_SPC_BT709;
break;
case 2020:
pdata->avinframe->colorspace = AVCOL_SPC_BT2020_NCL;
break;
case 2021:
pdata->avinframe->colorspace = AVCOL_SPC_BT2020_CL;
break;
}
}

ret = av_frame_get_buffer(pdata->avinframe, 1);
Expand Down

0 comments on commit 32abe16

Please sign in to comment.