diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index 6bc8f7f1..58441825 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -51,6 +51,7 @@
 #ifdef HAVE_DV
 #include "libdv.h"
 #endif
+#include "lcms2.h"
 #include "libmjpeg.h"
 #include "mainerror.h"
 #include "mwindow.h"
@@ -1734,6 +1735,28 @@ int FFVideoConvert::convert_picture_vframe(VFrame *frame, AVFrame *ip, AVFrame *
 			vid->ffmpeg->fmt_ctx->url);
 		return -1;
 	}
+	
+	const AVFrameSideData *sd;
+	cmsHPROFILE profile, profile1;
+	cmsContext cms_ctx;
+	cmsHTRANSFORM hTransform;
+
+	sd = av_frame_get_side_data(ip, AV_FRAME_DATA_ICC_PROFILE);
+	profile = cmsOpenProfileFromMemTHR(cms_ctx, sd->data, sd->size);
+	profile1 = cmsOpenProfileFromFile("/usr/share/apps/digikam/profiles/srgb-d65.icm", "r");
+	
+	hTransform = cmsCreateTransform(profile,
+                                TYPE_RGBA_8,
+                                profile1,
+                                TYPE_RGBA_8,
+                                INTENT_PERCEPTUAL, 0);
+
+	//printf ("cmodel: %i \n", cmodel);
+	if (cmodel == BC_RGBA8888) {
+	cmsDoTransform(hTransform, ip->data, ipic->data, ipic->linesize[0] * ipic->height);
+	printf("cms! \n");
+	}
+
 	return 0;
 }
 
@@ -1863,6 +1886,8 @@ int FFVideoConvert::convert_vframe_picture(VFrame *frame, AVFrame *op, AVFrame *
 		ff_err(ret, "FFVideoConvert::convert_frame_picture: sws_scale() failed\n");
 		return -1;
 	}
+	
+
 	return 0;
 }
 
