-
-
Notifications
You must be signed in to change notification settings - Fork 12
Home
EnigmaDamn edited this page Mar 4, 2022
·
4 revisions
Welcome to the pyffmpeg wiki!
from pyffmpeg import FFmpegConvert from one format or codec to other (FFmpeg works with most codecs out there).
inp = 'path/to/music_folder/f.mp4'
out = 'path/to/music_folder/f.mp3'
ff = FFmpeg()
output_file = ff.convert(inp, out)
print(output_file)pyffmpeg ships with its own FFmpeg executable, but it has only one prebuilt function, the convert function. So if you would like to do anything else you should use the options function and pass in all the values just as you would on command prompt except the FFmpeg path itself. For instance, if you would write this on the command prompt:
> ffmpeg -i /path/to/video.mp4 -vf scale -1:720 /path/to/video_hd.mp4
You should do:
ff = FFmpeg()
ff.options("-i /path/to/video.mp4 -vf scale -1:720 /path/to/video_hd.mp4")avoiding ffmpeg command and overwrite command.
from pyffmpeg import FFmpegff = FFmpeg('path/to/app_folder')
ff.convert('path/to/music_folder/f.mp3', 'f.wav')ff.overwrite = False # do not overwrite but exit immediatelyIn case you want to use pyffmpeg with another library which gives you more functions and you have to provide an ffmpeg executable. Use the get_ffmpeg_bin function. It returns the full path to our ffmpeg executable.
ff = FFmpeg()
ffmpeg_exe = ff.get_ffmpeg_bin()