In order to encode the video in Python, a four characters string is used to define the coding method. I tried to set the code to ‘MP4V’, as suggested by online references
fourcc = cv2.VideoWriter_fourcc(*'MP4V') voObj = cv2.VideoWriter('output.mp4',fourcc, 15.0, (1280,360))
But it’s not working. I got an error message saying ,
OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)' OpenCV: FFMPEG: fallback to use tag 0x00000020/' ???'
Encoding avi video works by setting the FOURCC code to ‘XVID’. For example,
fourcc = cv2.VideoWriter_fourcc(*'XVID') voObj = cv2.VideoWriter('output.avi',fourcc, 15.0, (1280,360))
which compressed the content in avi video as expected.
Any idea about the FOURCC for mp4?