ffmpeg-python
ffmpeg-python copied to clipboard
how to combine audio and video together
Hello i am developing a yotube downloader and when i am downloading youtube videos with high resolutions, there is no audio there, so i am downloading the audio and the video seperately. What i want is to merge them into one file but i am unable to do that. I don't know the command to use in order for me to merge the audio and the video
Did you sove this?
given videofilepath as your downloaded video stream and audiofilepath as your downloaded audio stream I chose mkv as the output container format as it supports anything this code makes ffmpeg merge audio and video together without re-encoding
outputstream = ffmpeg.output(ffmpeg.input(videofilepath), ffmpeg.input(audiofilepath), './myoutputvideofile.mkv', vcodec='copy', acodec='copy')
ffmpeg.run(outputstream, quiet=False) # or quiet=True if you don't want ffmpeg to write anything to stdout