Search code examples
python-3.xffmpegmoviepy

remove audio from mp4 file ffmpeg


I am on a Mac using Python 3.6. I am trying to remove audio from an mp4 file using ffmpeg but unfortunately it does not give me the "silenced" mp4 file I look for. Code I use is:

ffmpeg_extract_audio("input_file.mp4", "output_file.mp4", bitrate=3000, fps=44100)

It gives me a new output file with a low-quality video image, but still the audio. Any suggestion?


Solution

  • ok thank you @sascha. I finally put all my mp4 files in the same folder and run the following code:

    for file in *.mp4; do ffmpeg -i "$file" -c copy -an "noaudio_$file"; done
    

    If, like me, one uses Sublime Text or any other text editor (already using Python language), it run with the following:

    import subprocess
    command = 'for file in *.mp4; do ffmpeg -i "$file" -c copy -an "noaudio_$file"; done'
    subprocess.call(command, shell=True)