SpoiledTechie.com
SpoiledTechie.com

Reputation: 10725

Use FFMPEG to Merge many frames into one video?

With a project I am working on, I am taking one video, extracting frames from within the middle, from 00:55:00 to 00:57:25. After I extract these images, I am modifying them via code and I then need to compile these images back into a video. To finish it off, I will then merge the video back into the original video.

Ive already pulled the frames from the video, modified them, but now I need to merge them back together into a video.

I used this question to check the format, but I am not getting the correct output.

https://superuser.com/questions/563570/use-ffmpeg-for-video-to-frames-then-frames-to-video-with-original-sound

Here is my current input to FFMPEG:

-r 24.97 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj0.Bmp" -r 24.97 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj1.Bmp" -r 24.97 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj2.Bmp" -r 24.97 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj3.Bmp" -r 24.97 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj4.Bmp" -r 24.97 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj5.Bmp" -r 24.97 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj6.Bmp" -r 24.97 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj7.Bmp" -r 24.97 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj8.Bmp" -an -r 24.97 "C:\Users\scott\AppData\Local\Temp\ewELJdA8.mp4"

EDIT

My current output gives me a video that doesn't play. So for some reason, the merging of frames isn't the correct format and FFMPEG isn't giving me a reasonal output to work with.

How do I merge frames together into a video?

Upvotes: 1

Views: 6535

Answers (1)

jrkt
jrkt

Reputation: 2715

There are several ways to accomplish this. The first using a pattern to merge all images that are incremental into a video:

ffmpeg -y -start_number 0 -i "C:\Users\scott\AppData\Local\Temp\iOs91azj%d.Bmp" -c:v libx264 -r 24.97 -pix_fmt yuv420p /media/test/output.mp4

The next, to specify individual images in a single command:

ffmpeg -y -loop 1 -i img1.png -loop 1 -i img2.png -filter_complex '[0:v] [1:v] concat=n=2:v=1 [v]' -map '[v]' -c:v libx264 -r 24.97 -pix_fmt yuv420p /media/test/output.mp4

Upvotes: 1

Related Questions