Search code examples
pythonffmpegframe-rate

Set the framerate of converted output file using ffmpeg-python


I have the following line to convert a .mp4 file to a .gif file using ffmpeg-python:

ffmpeg.input('test.mp4').trim(start=0, duration=3).output('output.gif').run()

It works well, but I wanted to reduce the frame rate. At this link, I could not find a way to do this. Does somebody know how to do it ?


Solution

  • ffmpeg
        .input('test.mp4')
        .trim(start=0, duration=3)
        .filter('fps', fps=25, round='up')
        .output('output.mp4')
        .run()