[FFmpeg-devel] ? Inserting an image in the middle of a video stream

John P Poet jppoet at gmail.com
Thu Apr 26 06:23:49 EEST 2018

On Wed, Apr 25, 2018 at 4:25 PM Devin Heitmueller <
dheitmueller at kernellabs.com> wrote:

> Hi John,
> On Wed, Apr 25, 2018 at 5:11 PM, John P Poet <jppoet at gmail.com> wrote:
> > I am working on a project where I need to insert a repeating image (10
> > seconds) in the middle of a video stream while also transcoding from one
> > video codec to another.  The images are going to be either png or jpg
> > images.  I have a frame number within the video stream which tells me
> where
> > to insert the sequence of image frames.
> This feels like a case where you might be better off with a video
> filter that takes two inputs rather than modifying ffmpeg.c.  The
> filter would normally pass through the AVFrames from the first input,
> except when you hit the appropriate timestamp, at which point it would
> switch to the other input for some period.
> Look at the overlay filter as an example.

Hi Devin,

I would love to see some code which does this.  Google has not been kind.
I find lost of examples of doing it from the command line, but I need to do
this pragmatically since the points I insert the image can be updated in
"real time" while transcoding the video.

> Alternatively, the filter could take the image to insert as a filter
> argument, use libavformat/avcodec to decode it once, and then your
> pipeline would be relatively standard.  I believe there are some
> examples that do that (look at the filters page and look for entries
> that take a jpg/png as a filter argument).

The image will be know ahead of time, so I like this option.  It would be
much more efficient.

When you say "look at the filters page", What page is that?  I have had a
hard time finding examples of this kind of operation.  When I do find an
example, I usually discover it is for a previous "API" and uses deprecated

 Thank you,


More information about the ffmpeg-devel mailing list