one more, i can play the VOD stream using my RTSP program, but i can’t skip to cerain frame or time, but i can do it via VLC example
----------
this command works
vlc.exe --rate=1.0 --start-time=72000 “rtsp://user:password@10.xx.xx.xx:554/vod/983A2D61-8915-4840-BC71-23B418D0AD69”
--------
my RTSP program don’t work
import cv2
# Open a video capture object
cap = cv2.VideoCapture(‘tsp://user:password@10.xx.xx.xx:554/vod/983A2D61-8915-4840-BC71-23B418D0AD69’)
# Check if the video stream is opened successfully
if not cap.isOpened():
print("Error: Could not open video stream.")
exit()
# List of known property IDs and their descriptions
property_names = {
cv2.CAP\_PROP\_POS\_MSEC: 'Current position in milliseconds',
cv2.CAP\_PROP\_POS\_FRAMES: '0-based index of the next frame to be captured or decoded',
cv2.CAP\_PROP\_POS\_AVI\_RATIO: 'Relative position in the video file (0.0 to 1.0)',
cv2.CAP\_PROP\_FRAME\_WIDTH: 'Width of frames in the video stream',
cv2.CAP\_PROP\_FRAME\_HEIGHT: 'Height of frames in the video stream',
cv2.CAP\_PROP\_FPS: 'Frames per second (FPS) of the video stream',
cv2.CAP\_PROP\_FRAME\_COUNT: 'Total number of frames in the video stream',
cv2.CAP\_PROP\_FOURCC: 'FourCC code of the codec used in the video stream',
cv2.CAP\_PROP\_BRIGHTNESS: 'Brightness setting (for cameras)',
cv2.CAP\_PROP\_CONTRAST: 'Contrast setting (for cameras)',
cv2.CAP\_PROP\_SATURATION: 'Saturation setting (for cameras)',
# Add more properties as needed
}
# Iterate through the property IDs and print their values
for prop_id, prop_description in property_names.items():
prop\_value = cap.get(prop\_id)
print(f"{prop\_description} ({prop\_id}): {prop\_value}")
[#Get](javascript:void(0); “#Get”) the total frames
total_frames = cap.get(cv2.CAP_PROP_FRAME_COUNT)
fps = cap.get(cv2.CAP_PROP_FPS)
seconds_to_go_back = 60*60*24
frame_offset = fps*seconds_to_go_back
print(frame_offset)
start_frame_for_Video = total_frames-frame_offset
print(start_frame_for_Video)
initial_read = True
while True:
# Read a frame from the video stream
ret, frame = cap.read()
if not ret:
print("Error: Could not read frame.")
break
# Do something with the frame, e.g., display it
cv2.imshow('Video Stream', frame)
# Break the loop if the 'q' key is pressed
if cv2.waitKey(1) & 0xFF == ord('q'):
break
if initial\_read:
# Set the frame position using the CAP\_PROP\_POS\_FRAMES property
print(cap.get(cv2.CAP\_PROP\_POS\_FRAMES))
cap.set(cv2.CAP\_PROP\_POS\_FRAMES, int(frame\_offset))
print(cap.get(cv2.CAP\_PROP\_POS\_FRAMES))
initial\_read = False
# Release the video capture object and close any OpenCV windows
cap.release()
cv2.destroyAllWindows()
-- the program always starts from first frame in the vod recording