ImageAIDocumentation icon indicating copy to clipboard operation
ImageAIDocumentation copied to clipboard

ERROR OpenCV: FFMPEG:

Open martincritelli opened this issue 2 years ago • 0 comments

Hi, I ran the video object detection code but at the end of the process I got back this message:

"OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)' OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'"

This is the script I used:

from imageai.Detection import VideoObjectDetection
import os

execution_path = "mypath"
video_path= "video source path"
print (os.path.join(execution_path, "retinanet_resnet50_fpn_coco-eeacb38b.pth"))
detector = VideoObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(os.path.join(execution_path, "retinanet_resnet50_fpn_coco-eeacb38b.pth"))
detector.loadModel()

def forSeconds(second_number, output_arrays, count_arrays, average_output_count):
    print("SECOND : ", second_number)
    print("Array for the outputs of each frame ", output_arrays)
    print("Array for output count for unique objects in each frame : ", count_arrays)
    print("Output average count for unique objects in the last second: ", average_output_count)
    print("------------END OF A SECOND --------------")

video_proce_path = detector.detectObjectsFromVideo(input_file_path=os.path.join(video_path, "video.mp4"),
                                                   output_file_path=os.path.join(execution_path, "video_detected"),                                                 , frames_per_second=25, per_second_function= forSeconds, log_progress=True)
print (video_proce_path)

Thank you for the help.

martincritelli avatar Nov 21 '23 15:11 martincritelli