Search code examples
pythonaudiovideoffmpegraspberry-pi

Combining an audio file with video file in python


I am writing a program in Python on RaspberryPi(Raspbian), to combine / merge an audio file with video file.

Format of Audio file is WAVE Format of Video file is h264

Audio and video already recorded and created at same time successfully, I just need to merge them now.

Can you please guide me on how do I do that?


Solution

  • I got the answer of my Question, you can also try it and let me know if need further assistance

    cmd = 'ffmpeg -y -i Audio.wav  -r 30 -i Video.h264  -filter:a aresample=async=1 -c:a flac -c:v copy av.mkv'
    subprocess.call(cmd, shell=True)                                     # "Muxing Done
    print('Muxing Done')