cap = cv2.VideoCapture(RTSP_URL)
now = datetime.datetime.now(pytz.timezone('Asia/Hong_Kong'))
full_file_path = "/tmp/" + ":".join([str(now.hour), str(now.minute), str(now.second)]) + ".mp4"
video_writer = cv2.VideoWriter(full_file_path, cv2.VideoWriter_fourcc(*'H264'), 20, (1920, 1080))
start_time = time.time()
while time.time() <= start_time + 5:
_, frame = cap.read()
video_writer.write(frame)
video_writer.release()
asyncio.run(async_send_video(full_file_path))
cap.release()
OpenCV: FFMPEG: tag 0x34363248/'H264' is not supported with codec id 27 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'
[ERROR:[email protected]] global /io/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2767) open Could not find encoder for codec_id=27, error: Encoder not found
[ERROR:[email protected]] global /io/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2839) open VIDEOIO/FFMPEG: Failed to initialize VideoWriter
Comments