I'm using FFMPEG to do the following two things:
To create mp4s from images, I use the following command:
ffmpeg -r 5 -i 'img%03d.jpg' output.mp4
As far as I know, this creates a video with a framerate of 5fps.
But when I try to compile mp4s, it seems like frames within each mp4 are being dropped.
To create the compiled footage, I create a text file that points to all the mp4s that should be included in the compilation, eg
file 'set1/output.mp4'
file 'set2/output.mp4'
file 'set3/output.mp4'
file 'set4/output.mp4'
file 'set5/output.mp4'
file 'set6/output.mp4'
file 'set7/output.mp4'
Then I run the following command:
ffmpeg -f concat -i input.txt -codec copy compilation.mp4
The resulting video seems to drop 2-3 frames from each of the output videos.
How do I ensure that the compiled video doesn't drop any frames?
(For reference, I used the following tutorial: https://trac.ffmpeg.org/wiki/Concatenate )
I was able to find a work-around using the following tutorial:
FFmpeg making video from images placed in different folders
Rather than compiling mp4s, I could point to all the image assets that should be compiled into the final video file.
I created a text file that looked like this:
file 'set1/img%03d.jpg'
file 'set2/img%03d.jpg'
file 'set3/img%03d.jpg'
file 'set4/img%03d.jpg'
file 'set5/img%03d.jpg'
file 'set6/img%03d.jpg'
file 'set7/img%03d.jpg'
Where each set folder contains images with the naming convention img001.jpg, img002.jpg, etc.
Then I can compile all the images into a final video using the following command:
ffmpeg -f concat -r 5 -i input.txt compilation.mp4
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.