| English | Korean | Chinese | Japanese |
APIs: playback
Get a Recorded Image
You can obtain a recorded image by specifying the channel number, sub-stream index, and time information.
The default sub-stream index is 0, which represents the primary stream.
🛠️ (frame_image, frame_info) = get_image(ch_no, year, month, day, hour, minute, second, sub_idx=idx)
↩️ frame_image: A numpy array representing the video image.
· For the pixel format "BGR", the image shape is (height, width, 3).
↩️ frame_info: A dictionary containing information about the video image.
· frame_info['timestamp']: Unix timestamp.
· frame_info['timestamp_msec']: Timestamp in milliseconds.
· frame_info['message']: Error message.
You can also change the video output settings using the following APIs:
🛠️ set_image_size(width, height): Set the output video size. (Default: original video size)
🛠️ set_pixel_format("PIXEL_FORMAT"): Set the output video format. Choose from "RGB" / "BGR" / "0RGB" / "0BGR". (Default: "RGB")
playback = vmspy.playback()
if not playback.init(address, port, access_id, access_pw):
print(playback.get_error())
playback.set_image_size(720, 480)
playback.set_pixel_format("BGR")
(frame_image, frame_info) = playback.get_image(1, 2025, 4, 17, 5, 24, 30)
Get a Series of Recorded Images
You can obtain a series of recorded images by specifying the channel number, start time, and interval in seconds.
The interval is set to zero (0) for full-frame mode.
🛠️ ret = start(ch_no, year, month, day, hour, minute, second, interval=sec, sub_idx=idx)
↩️ ret: True on success, False on failure.
Once started, you can receive a series of frames at the specified intervals:
🛠️ (frame_image, frame_info) = get_frame()
↩️ frame_image: A numpy array representing the video image.
· For the pixel format "BGR", the image shape is (height, width, 3).
↩️ frame_info: A dictionary containing information about the video image.
· frame_info['timestamp']: Unix timestamp.
· frame_info['timestamp_msec']: Timestamp in milliseconds.
· frame_info['message']: Error message.
playback.set_image_size(720, 480)
playback.set_pixel_format("BGR")
playback.start(1, 2025, 4, 17, 5, 24, 30, interval=10) # every 10 seconds
while True:
(frame_image, frame_info) = playback.get_frame()
if frame_image.size == 0:
print(frame_info['message'])
break
# Do analysis
playback.stop()
Get an Archived File Image
You can obtain an archived file image by specifying the file ID and time information.
The file ID and timestamp can be obtained using the `utils.get_file_list()` function.
🛠️ (frame_image, frame_info) = get_file_image(file_id, timestamp)
↩️ frame_image: A numpy array representing the video image.
· For the pixel format "BGR", the image shape is (height, width, 3).
↩️ frame_info: A dictionary containing information about the video image.
· frame_info['timestamp']: Unix timestamp.
· frame_info['timestamp_msec']: Timestamp in milliseconds.
· frame_info['message']: Error message.
You can also change the video output settings as described above.
playback = vmspy.playback()
if not playback.init(address, port, access_id, access_pw):
print(playback.get_error())
playback.set_image_size(720, 480)
playback.set_pixel_format("BGR")
(frame_image, frame_info) = playback.get_file_image(29513186, 1770790997)
Get a Series of Archived File Images
You can obtain a series of archived file images by specifying the file ID, time information, and interval in seconds.
The file ID and timestamp can be obtained using the `utils.get_file_list()` function.
Set the interval to zero (0) for full-frame mode.
🛠️ ret = start_file(file_id, timestamp, interval=sec)
↩️ ret: True on success, False on failure.
Once started, you can receive a series of frames at the specified intervals:
🛠️ (frame_image, frame_info) = get_frame()
↩️ frame_image: A numpy array representing the video image.
· For the pixel format "BGR", the image shape is (height, width, 3).
↩️ frame_info: A dictionary containing information about the video image.
· frame_info['timestamp']: Unix timestamp.
· frame_info['timestamp_msec']: Timestamp in milliseconds.
· frame_info['message']: Error message.
playback.set_image_size(720, 480)
playback.set_pixel_format("BGR")
playback.start_file(29513186, 1770790997, interval=10) # every 10 seconds
while True:
(frame_image, frame_info) = playback.get_frame()
if frame_image.size == 0:
print(frame_info['message'])
break
# Do analysis
playback.stop()


