FFmpeg overlay two videos, one input with transparency
Posted
by
Gian B.
on Super User
See other posts from Super User
or by Gian B.
Published on 2014-08-25T09:45:42Z
Indexed on
2014/08/25
10:22 UTC
Read the original article
Hit count: 301
I am trying to create a karaoke from a CD+G file (converted to AVI using FFmpeg) and add a video as a background of the lyrics.
Here's a screenshot of a the output from CD+G conversion, for simplicity let's call this lyrics.avi http://imgur.com/wUwHUhV
Now a have this video.mp4 file that I'd like to put behind this lyrics.avi
Here's a sample of what I'm trying to achieve http://imgur.com/8GuWXtQ I'm sure most of you are familiar with karaoke.
I haven't used FFmpeg much and I'm not really sure if what I want to achieve is possible with FFmpeg.
- Is it possible to overlay two videos, and add a transparency to one of the videos? In this case the colour black?
- How can I set the offset time of the lyrics.avi?
Here's the command the I've tried so far:
ffmpeg -i video.mp4 -i lyrics.avi -filter_complex "nullsrc=size=854x480 [base]; [0:v] setpts=PTS-STARTPTS, scale=854x480 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=854x200 [bottomleft]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][bottomleft] overlay=shortest=1:y=280" -c:v libx264 -y karaoke.mp4
© Super User or respective owner