Reputation: 437
I created a few hundred .mp4 files with the wrong codec, I used
fourcc = cv2.VideoWriter_fourcc(*"XVID")
Instead of,
fourcc = cv2.VideoWriter_fourcc(*'MP4V')
Is it possible to change the codec without having to recreate all of the .mp4 files?
Upvotes: 1
Views: 620
Reputation: 3333
Files are compressed using the codec you provided. You cannot change it. You need either to transcode them (from one codec to another: this is a lossy process). You could use ffmpeg library to do so, either by running a batch on the created files or using a python wrapper on ffmpeg
It would be easier I guess to re encode the original content with the good codec, no quality loss in that case.
Upvotes: 1