diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 37e77d1..8ef362e 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -129,10 +129,10 @@ typedef struct ColorSpaceContext {
     ColorSpaceDSPContext dsp;
 
     enum Colorspace user_all;
-    enum AVColorSpace in_csp, out_csp, user_csp;
-    enum AVColorRange in_rng, out_rng, user_rng;
-    enum AVColorTransferCharacteristic in_trc, out_trc, user_trc;
-    enum AVColorPrimaries in_prm, out_prm, user_prm;
+    enum AVColorSpace in_csp, out_csp, user_csp, user_icsp;
+    enum AVColorRange in_rng, out_rng, user_rng, user_irng;
+    enum AVColorTransferCharacteristic in_trc, out_trc, user_trc, user_itrc;
+    enum AVColorPrimaries in_prm, out_prm, user_prm, user_iprm;
     enum AVPixelFormat in_format, user_format;
     int fast_mode;
     enum DitherMode dither;
@@ -581,6 +581,8 @@ static int create_filtergraph(AVFilterContext *ctx,
 
     if (!s->out_primaries || !s->in_primaries) {
         s->in_prm = in->color_primaries;
+        if (s->user_iprm != AVCOL_PRI_UNSPECIFIED)
+            s->in_prm = s->user_iprm;
         s->in_primaries = get_color_primaries(s->in_prm);
         if (!s->in_primaries) {
             av_log(ctx, AV_LOG_ERROR,
@@ -638,6 +640,8 @@ static int create_filtergraph(AVFilterContext *ctx,
     if (!s->in_txchr) {
         av_freep(&s->lin_lut);
         s->in_trc = in->color_trc;
+        if (s->user_itrc != AVCOL_TRC_UNSPECIFIED)
+            s->in_trc = s->user_itrc;
         s->in_txchr = get_transfer_characteristics(s->in_trc);
         if (!s->in_txchr) {
             av_log(ctx, AV_LOG_ERROR,
@@ -680,7 +684,11 @@ static int create_filtergraph(AVFilterContext *ctx,
 
     if (!s->in_lumacoef) {
         s->in_csp = in->colorspace;
+        if (s->user_icsp != AVCOL_SPC_UNSPECIFIED)
+            s->in_csp = s->user_icsp;
         s->in_rng = in->color_range;
+        if (s->user_irng != AVCOL_RANGE_UNSPECIFIED)
+            s->in_rng = s->user_irng;
         s->in_lumacoef = get_luma_coefficients(s->in_csp);
         if (!s->in_lumacoef) {
             av_log(ctx, AV_LOG_ERROR,
@@ -1014,6 +1022,9 @@ static const AVOption colorspace_options[] = {
     { "space",      "Output colorspace",
       OFFSET(user_csp),   AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED },
       AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
+    { "ispace",     "Input colorspace",
+      OFFSET(user_icsp),  AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED },
+      AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
     ENUM("bt709",       AVCOL_SPC_BT709,       "csp"),
     ENUM("fcc",         AVCOL_SPC_FCC,         "csp"),
     ENUM("bt470bg",     AVCOL_SPC_BT470BG,     "csp"),
@@ -1024,12 +1035,18 @@ static const AVOption colorspace_options[] = {
     { "range",      "Output color range",
       OFFSET(user_rng),   AV_OPT_TYPE_INT, { .i64 = AVCOL_RANGE_UNSPECIFIED },
       AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, "rng" },
+    { "irange",     "Input color range",
+      OFFSET(user_irng),  AV_OPT_TYPE_INT, { .i64 = AVCOL_RANGE_UNSPECIFIED },
+      AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, "rng" },
     ENUM("mpeg",        AVCOL_RANGE_MPEG,      "rng"),
     ENUM("jpeg",        AVCOL_RANGE_JPEG,      "rng"),
 
     { "primaries",  "Output color primaries",
       OFFSET(user_prm),   AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED },
       AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "prm" },
+    { "iprimaries", "Input color primaries",
+      OFFSET(user_iprm),  AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED },
+      AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "prm" },
     ENUM("bt709",        AVCOL_PRI_BT709,      "prm"),
     ENUM("bt470m",       AVCOL_PRI_BT470M,     "prm"),
     ENUM("bt470bg",      AVCOL_PRI_BT470BG,    "prm"),
@@ -1040,6 +1057,9 @@ static const AVOption colorspace_options[] = {
     { "trc",        "Output transfer characteristics",
       OFFSET(user_trc),   AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED },
       AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, "trc" },
+    { "itrc",       "Input transfer characteristics",
+      OFFSET(user_itrc),  AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED },
+      AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, "trc" },
     ENUM("bt709",        AVCOL_TRC_BT709,        "trc"),
     ENUM("gamma22",      AVCOL_TRC_GAMMA22,      "trc"),
     ENUM("gamma28",      AVCOL_TRC_GAMMA28,      "trc"),
