diff --git a/libavformat/rtmpcrypt.c b/libavformat/rtmpcrypt.c
index c41ae4308f..253b8ca2ce 100644
--- a/libavformat/rtmpcrypt.c
+++ b/libavformat/rtmpcrypt.c
@@ -301,7 +301,7 @@ static int rtmpe_write(URLContext *h, const uint8_t *buf, int size)
 
     if (rt->handshaked) {
         /* encrypt data to send to the server */
-        av_rc4_crypt(&rt->key_out, buf, buf, size, NULL, 1);
+        av_rc4_crypt(&rt->key_out, (uint8_t *)buf, buf, size, NULL, 1);
     }
 
     if ((ret = ffurl_write(rt->stream, buf, size)) < 0)