I have tried to use a ffmpeg to extract an audio from a video file and this is my code
import io
import os
import subprocess
def extract_audio(video,output):
command = "ffmpeg -i '{video}' -ac 1 -f flac -vn '{output}'"
subprocess.call(command,shell=True)
extract_audio('dm.MOV','dm-new.flac')
And I got no error after compiled. By doing this I should get a new file which is 'dm-new.flac'. But there is no such a flac file created after I compile the script. I think there are something wrong with the syntax or something in the variable 'command' which I have no idea to fix this. My question here is how can I use ffmpeg in a python function base on this code?
By the way, I knew that I could just use ffmpeg without writing a function. But I really need to write in in a function. Thank you