How do I assign an input video's framerate to the output video when multiple input arguments are present? To my understanding, if you have only one video input, its native framerate should be used by default if -framerate isn't explicitly defined. For example:

ffmpeg -i in.webm ./frames/image%05d.png


will extract an image sequence from a video using its native framerate. For a 5.4 second video with a native 30 fps, that means 162 frames will be extracted.

Now, I have a video with audio. I extracted an image sequence from it as above. After doing some edits to each frame, I want to join the edited image sequence back together, using the original framerate, and add the audio stream back in.

Right now I am able to do this over multiple steps:


Manually get the original video's framerate

ffprobe -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate in.webm

Let's say the output is 30/1
Merge the edited image sequence back into a video, using a hard-coded framerate

ffmpeg -i edited%05d.png -framerate 30 -c:v libvpx-vp9 -pix_fmt yuva420p -lossless 1 out.webm
Merge the original video's audio stream into the new video

ffmpeg -i in.webm -i out.webm -map 0:a:0 -map 1:v:0 -c copy final.webm


The exact code is roughly like that. In any case, I definitely had a working version last night.

Originally, I had tried to do everything in one step: generally speaking, the two ffmpeg commands above merged into one, but without -framerate, since I assumed based on research that the input video's framerate should carry over.

However, that did not happen. After analysing the output, it seems to me that ffmpeg failed to detect the input video's framerate, so the output video was assigned a default 25 fps instead. How can I resolve this, so that the output video is automatically assigned the framerate from one of the input videos?
-framerate is an input option for image sequence input, so it goes before that input.

Here's the combined command:

ffmpeg -framerate 30 -i edited%05d.png -i in.webm -c:v libvpx-vp9 -pix_fmt yuva420p -lossless 1 -c:a copy out.webm