If your frames are named in a pattern where the numbers increase by 5 (e.g., DR_W101_005.png, DR_W101_010.png, etc.), you can still use FFmpeg with the %02d format by specifying the start number and step.
However, FFmpeg does not directly support non-sequential numbering like this with the %02d format. Instead, you can create a symbolic link or rename the files temporarily to a sequential pattern, but this might be cumbersome.
To address this directly, you would need to script the renaming or handle the creation of a list file for FFmpeg. Here’s a method using a shell script to create symbolic links with sequential numbers and then using FFmpeg:
-
Create Symbolic Links with Sequential Numbers:
- Create a temporary directory to hold the symbolic links.
- Generate links with sequential numbers.
-
Use FFmpeg with the Sequential Pattern:
- Convert the symbolic links to a video using FFmpeg.
-
Create Symbolic Links:
for i in $(seq -w 5 5 55); do
ln -s ../DR_W101_${i}.png frame_$(printf "%02d" $COUNTER).png
-
Run FFmpeg:
ffmpeg -framerate 30 -i temp_frames/frame_%02d.png -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4
-
Cleanup:
- After creating the video, you can remove the temporary directory:
-
Step 1:
mkdir temp_frames: Create a temporary directory to hold the symbolic links.
cd temp_frames: Navigate to the temporary directory.
COUNTER=1: Initialize a counter for the sequential numbers.
for i in $(seq -w 5 5 55); do ... done: Loop through the numbers 5 to 55, with a step of 5.
ln -s ../DR_W101_${i}.png frame_$(printf "%02d" $COUNTER).png: Create a symbolic link with a sequential number.
COUNTER=$((COUNTER+1)): Increment the counter.
-
Step 2:
ffmpeg -framerate 30 -i temp_frames/frame_%02d.png -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4: Use FFmpeg to create the video from the symbolic links.
-
Step 3:
rm -r temp_frames: Remove the temporary directory after the video is created.
This method ensures that you can create a video using FFmpeg with frames that have numbers increasing by 5.