Last Updated : 11 Aug, 2025
Playing a video in reverse is useful for analyzing motion backwards, creating special effects or debugging frame sequences. With OpenCV in Python, frames can be read, stored and displayed in reverse order, enabling offline analysis, reverse playback and creative motion effects.
ObjectiveWe will take a video as input and play it in reverse by:
import cv2
cap = cv2.VideoCapture("video_file_location")
frames, cnt = [], 0
# Capture frames
while True:
ret, frame = cap.read()
if not ret: break
cv2.imwrite(f"frame{cnt}.jpg", frame)
frames.append(frame)
cnt += 1
cap.release()
# Play forward
for f in frames:
cv2.imshow("Frame", f)
if cv2.waitKey(25) & 0xFF == ord("q"): break
# Play reverse
for f in reversed(frames):
cv2.imshow("Frame", f)
if cv2.waitKey(25) & 0xFF == ord("q"): break
cv2.destroyAllWindows()
Output:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4