Search code examples
pythonffmpegjupyter-notebook

Compiling frames into a video with ffmpeg


I have a folder with a number of frames in which I'd like to concatenate into an mp4 file using ffmpeg. What is the correct syntax to do this in a Jupyter notebook script? I have tried:

os.system("ffmpeg -r 30 -i ./inputs/upload%00001d.png -y ./inputs/result.mp4")

The above runs through with no errors but does not produce an output.


Solution

  • As I've stated in the comment, correct your file format to upload%05d.png and consider specifying the codec too:

    def saveMpeg():
        os.system("ffmpeg -r 30 -i ./inputs/upload%05d.png -vcodec mpeg4 -y ./inputs/result.mp4")
    
    saveMpeg()