ubernal
ubernal

Reputation: 83

Change videos frame rate (fps) in python

I would like to know if it is possible to change the fps of a video. I have videos of 24, 25 and 30 fps and I would like to change them all to 30 fps.

Thank you

Upvotes: 3

Views: 8818

Answers (2)

ubernal
ubernal

Reputation: 83

I finally solved the problem:

import subprocess

c = 'ffmpeg -y -i ' + video_input_path + ' -r 30 -s 112x112 -c:v libx264 -b:v 3M -strict -2 -movflags faststart '+video_output_path

subprocess.call(c, shell=True)

Upvotes: 1

Sandipan Dey
Sandipan Dey

Reputation: 23101

With moviepy one can simply try this:

from moviepy.editor import *
clip = VideoFileClip(video_input_path)
clip.write_videofile(video_output_path, fps=30)
#clip.reader.close()

Upvotes: 5

Related Questions