diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c
index 46c16346..6ac46cc1 100644
--- a/src/modules/avformat/producer_avformat.c
+++ b/src/modules/avformat/producer_avformat.c
@@ -68,6 +68,12 @@
 #define IMAGE_ALIGN (1)
 #define VFR_THRESHOLD (3) // The minimum number of video frames with differing durations to be considered VFR.
 
+#ifndef HAVE_ATOMIC_INT_FAST64
+#  if !#defined(__arm__) && !#defined(__mips__) && !defined(__sh__)
+#    define HAVE_ATOMIC_INT_FAST64 1
+#  endif
+#endif
+
 struct producer_avformat_s
 {
 	mlt_producer parent;
@@ -84,10 +90,15 @@ struct producer_avformat_s
 	int audio_index;
 	int video_index;
 	int64_t first_pts;
+#if defined(HAVE_ATOMIC_INT_FAST64) && (HAVE_ATOMIC_INT_FAST64 != 0)
 	atomic_int_fast64_t last_position;
+	atomic_int_fast64_t current_position;
+#else
+	int64_t last_position;
+	int64_t current_position;
+#endif
 	int video_seekable;
 	int seekable; /// This one is used for both audio and file level seekability.
-	atomic_int_fast64_t current_position;
 	mlt_position nonseek_position;
 	atomic_int top_field_first;
 	uint8_t *audio_buffer[ MAX_AUDIO_STREAMS ];
