[FFmpeg-user] Overlaying part of a video by an image file [quickly, without re-encoding the rest]

Jim DeLaHunt list+ffmpeg-user at jdlh.com
Fri Jul 24 23:08:34 EEST 2020


On 2020-07-24 07:34, Marcello Mazzon wrote:
> Hi;
>
> for months I have been on a project where I am trying to overlay a few
> seconds of a longer video by an image file, leaving the audio sequence
> intact. For this, I posted an enquiry on stackexchange [*] to which I
> received a reply by an official ffmpeg-consultant.
>
> *
> https://unix.stackexchange.com/questions/588667/ffmpeg-replace-part-of-a-video-by-a-jpg-file-for-5-seconds
>
> Unfortunately, we were incapable of coming up with a solution to
> integrate the image file into the video without re-encoding the whole
> of the video file but only the part where the image is being overlayed,
> leaving the exact codec and parameters of the video intact.
>> Greetings from Germany;
> Marcello

Marcello:

Welcome to the ffmpeg-users email list.

I will make the comment here which I also put on the Stack-exchange 
question: You apparently have additional requirements: that the 
operation complete in just a few seconds, and that the operation does 
not reencode the entire video sequence. You are more likely to get 
relevant answers if you include those requirements in your question. 
Note that these requirements may mean there is no easy way to satisfy 
them using FFmpeg.

In my experience, Gyan Doshi, who answered your question on Stack 
Exchange, knows a lot about FFmpeg and is very willing to help. If Gyan 
says that avoiding re-encoding the video is "not trivial", then that 
likely means the task is quite difficult. However, maybe someone will 
point out a clever use of FFmpeg which meets your requirements.

Much is possible if you are willing to write an extension of some kind 
to ffmpeg to operate on the video directly. However, it will be a lot of 
work to learn enough about FFmpeg to be able to write this code, and 
also substantial effort to write, test, and deploy the code. You will 
have to decide if that effort (or hiring someone to make that effort) is 
worth avoiding the video reencode.

Good luck, und schöne Grüße aus Kanada,
       —Jim DeLaHunt, software engineer, Vancouver, Canada




More information about the ffmpeg-user mailing list