[FFmpeg-user] Appending new jpg images to an existing mp4 (built of jpg's)

Steve Williams steve at williamsitconsulting.com
Tue Apr 12 06:12:20 EEST 2022


I am completely new to the video world, so I am trying to learn from the 
various resources on the Internet.

I am running ffmpeg on a Unix (OpenBSD) system.

I have a webcam that is capturing 4 still (jpeg) images per minute. The 
jpeg is stored in a filename YYYY-MM-DD-hh-mm-ss.  Once an hour, I use 
ffmpeg to create an mp4 movie of all the stills for the day.

ffmpeg -y -pattern_type glob -i "image_2020-04-11-*.jpeg" -c:v libx264 
-preset ultrafast today.mp4

As the day progresses, the ffmpeg is encoding more and more images and 
totally recreating "today.mp4".

Is there a way to just append the new jpeg files to "today.mp4"?

I can change formats, whatever it takes if it's possible.

Reading the faq, there are various "concat" options, but I am not sure 
if they are relevant.  The one that seemed to make the most sense is:

3.14.2 Concatenating using the concat demuxer
FFmpeg has a concat demuxer which you can use when you want to avoid a 
re-encode and your format doesn’t support file level concatenation.

I don't want to re-encode all the jpeg images... so I was thinking I 
could create an "hourly" mp4 of the new jpeg images and then use the 
concat demuxer to combine the 2 mp4's into a new (third) file.  But I 
was wondering if there was a more efficient way to do this.

Can I specify "ffmpeg -i today.mp4" -y pattern_type glob -i 
"image_2020-04-11-*.jpeg" ...

Looking at "3 Detailed description" in the documentation, it looks like 
that would run the today.mp4 through the demuxer, decoder, then 
re-encode it all.  I am trying to avoid the decoding / re-encoding of 
the existing mp4.

Is this even possible?

Steve Williams

More information about the ffmpeg-user mailing list