Python3.6 add audio to cv2 processed video

Viewed 2320

I have a code that takes in a video then constructs a list of frames from that video. then does something with each frame then put the frames back together into cv2 video writer. However, when the video is constructed again, it loses all its audio.

1 Answers

Stephen Meschke is right ! Use FFMPEG to extract and import audio. Type in cmd:

Extract audio:

ffmpeg -i yourvideo.avi -f mp3 -ab 192000 -vn sound.mp3

Import audio:

ffmpeg -i yourvideo.avi -i sound.mp3 -c copy -map 0:v:0 -map 1:a:0 output.avi

Related