diff --git a/libavcore/parseutils.c b/libavcore/parseutils.c
index 1267369b766ccf8c36350115573e0208212ec8d8..e7d992c529a042a2d66cf3cc841e23d4a88b74df 100644
--- a/libavcore/parseutils.c
+++ b/libavcore/parseutils.c
@@ -107,7 +107,7 @@ int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
         frame_height = strtol(p, &p, 10);
     }
     if (frame_width <= 0 || frame_height <= 0)
-        return -1;
+        return AVERROR(EINVAL);
     *width_ptr  = frame_width;
     *height_ptr = frame_height;
     return 0;
@@ -145,6 +145,6 @@ int av_parse_video_rate(AVRational *frame_rate, const char *arg)
         frame_rate->num = time_base.num;
     }
     if (frame_rate->num <= 0 || frame_rate->den <= 0)
-        return -1;
+        return AVERROR(EINVAL);
     return 0;
 }