I have 2 videos (same resolution, same encoding) files that I want to concat and I want to insert some text for 3 seconds between them, as a splitter. I'm doing this with ffmpeg on Windows.
Optional ideas that I would be interested in:
For now, I made the text as an image (but I am open to other suggestions). Let's say I have:
I have tried a few things, but I always end up with the same problem: the video is 23:20 (video1 + 3 seconds + video2), but the 3 seconds gap is just the last video1 frame frozen instead of my image/text...
Any Idea what I did wrong or how I should achieve this?
Here is what I tried so far:
Turn the image into a 3 seconds mp4 film, then concat (demuxer) it with the others:
ffmpeg -loop 1 -f image2 -i splitter.png -r 30 -t 3 splitter.mp4
ffmpeg -f concat -i input.txt -codec copy output.mp4
Where the input.txt
looks like:
file 'E:\video1.mp4'
file 'E:\splitter.mp4'
file 'E:\video2.mp4'
The content of splitter.png
is visible in the splitter.mp4
, but not in the output.mp4
. Also I'm not entirely sure the splitter.mp4 respects the exact same encoding as the 2 videos, and I don't know how to verify that.
Directly run the concat (demuxer) 90 times (30fps -> 3 seconds) on the image
ffmpeg -f concat -i input.txt -codec copy output.mp4
Where the input.txt
looks like:
file 'E:\video1.mp4'
file 'E:\splitter.png'
...
file 'E:\splitter.png'
file 'E:\video2.mp4'
Since all I'm doing is screencasting, I might as well screencast my splitter image. This way I would be sure of the audio & video encoding and wouldn't have any problem merging and it wouldn't need any reencoding... I know it might sound dumb, but it would probably do the trick...
Note: I didn't have try it, since I already worked through Openshot.
Use FFmpeg concat to merge videos When using FFmpeg to merge a series of video clips, the process is called concatenation, or concat for short. There are several ways that videos can be concatenated, depending on whether the individual videos share the same codec or not.
ffmpeg -f concat -i mylist.txt -c copy output.mp4 This process is a way of concatenating the files and not re-encoding. Hence, it should be done speedily & conveniently. If there is no error message, you are sure to receive a final merged video named by 'output. mp4' in the MP4 folder.
My guess is this is all a codec issue -- the PNG turned MP4 is probably not the same codec as your real MP4s.
Try this -- concatenation of files of different codecs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With