OlafenwaMoses/ImageAI

OpenCV: FFMPEG: tag is not supported with codec id 12 and format 'mp4 / MP4

alexpavlidespyrra opened this issue · 1 comments

This error happens when calling:

detections = self.video_detector.detectObjectsFromVideo(input_file_path=input_data,
                                        output_file_path=output_video_path,
                                        frames_per_second=frames_per_second,
                                        minimum_percentage_probability=min_percent_prob,
                                        video_complete_function=self.get_output)

I had a look under the hood and this line caused the problem:


output_video = cv2.VideoWriter(output_video_filepath, cv2.VideoWriter_fourcc(*"MP4V"),
                                            frames_per_second,
                                            (frame_width, frame_height))

According to this post https://stackoverflow.com/questions/57792837/opencv-ffmpeg-tag-is-not-supported-with-codec-id-12-and-format-mp4-mp4 changing MP4V to lowercase mp4v fixes the problem. I tried it and it fixed the problem. Please can you make this change? Thanks.

@alexpavlidespyrra thanks, will effect this change in next update.