AnswerBun.com

ffmpeg: Replace part of a video by a jpg file for 5 seconds

Unix & Linux Asked by vyasa on January 3, 2022

Sometimes I have a video in which I like to discard the video sequence for five seconds between second 11 and second 16 (as an example) and instead incorporate an image from a jpg file that is displayed during that time and leaving the audio sequence intact.

Would be great if someone told me an apt command line for this.

Thanks in advance 🙂

UPDATE 20200906: The solution should not re-encode the entire video in order to rapidly process large video files with a short image-overlay.

2 Answers

Just an idea, but how about: splitting the video in three parts (pre, needed-part, post)

then applying the idea posted to the "needed-part".

Afterwards concatenate the three files together again ?

PS: Using the command above kinda destroys my videos picture quality... no idea why...

Answered by Rye on January 3, 2022

Use

ffmpeg -i video -i image -filter_complex "[1][0]scale2ref[img][vid];[vid][img]overlay=enable='between(t,11,16)'" -c:a copy out.mp4

Scale2ref resizes the image to the resolution of the video. The overlay places the image on top of the video from the 12th to the end of the 16th second.

Answered by Gyan on January 3, 2022

Add your own answers!

Related Questions

How to configure a GRE tunnel for ubuntu?

1  Asked on December 6, 2020 by natf2d

   

resolv.conf always empty

1  Asked on December 6, 2020 by marc

         

Run a python script when connected to internet

1  Asked on December 5, 2020 by cutepoison

 

SSH remote forwarding results in 404 Not Found

1  Asked on December 4, 2020 by flow2k

   

Isolate non-FOSS “completely”

1  Asked on December 4, 2020 by user654789384

   

Use ranger as my default file manager in i3wm

3  Asked on December 4, 2020 by sln

       

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP