diff --git a/libavutil/log.c b/libavutil/log.c
index 29ad2d0c280302a1d75ebbb7f874a10a9cf09efa..cde7c12e4db2262452e0996f72fa67587cf8ba58 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -224,7 +224,8 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
         is_atty = isatty(2) ? 1 : -1;
 #endif
 
-    if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev) && *line){
+    if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev) &&
+        *line && line[strlen(line) - 1] != '\r'){
         count++;
         if (is_atty == 1)
             fprintf(stderr, "    Last message repeated %d times\r", count);