I am trying to join a sequence of images (*.png
) using ffmpeg
. The filenames of the images are in the following format: recon_0001.png, recon_0002.png, ... , recon_0100.png
. I would like to join the images sequentially (i.e. recon_0001.png
being the first frame, recon_0002.png
the second frame and so on.)
After looking at the following link: Python: Make a video using several .png images , I tried to implement my task using the following code:
from __future__ import division
import cv2
import os
import matplotlib.pyplot as plt
from pylab import pcolor, show, colorbar, xticks, yticks
import numpy as np
if(1):
ffmpeg -f image2 -r 1/5 -i /Users/Username/Folder/recon_%04d.png -vcodec mpeg4 -y movie.mp4
But, I get the following error:
ffmpeg -f image2 -r 1/5 -i /Users/Username/Folder/recon_%04d.png -vcodec mpeg4 -y movie.mp4
^
SyntaxError: invalid syntax
What am I missing here? I am new to the use of ffmpeg
and I will really appreciate any help.