Overlaying video with ffmpeg

我们两清 提交于 2019-12-31 00:35:07

问题


I'm attempting to write a script that will merge 2 separate video files into 1 wider one, in which both videos play back simultaneously. I have it mostly figured out, but when I view the final output, the video that I'm overlaying is extremely slow.

Here's what I'm doing:

  1. Expand the left video to the final video dimensions

    ffmpeg -i left.avi -vf "pad=640:240:0:0:black" left_wide.avi

  2. Overlay the right video on top of the left one

    ffmpeg -i left_wide.avi -vf "movie=right.avi [mv]; [in][mv] overlay=320:0" combined_video.avi

In the resulting video, the playback on the right video is about half the speed of the left video. Any idea how I can get these files to sync up?


回答1:


Like the user 65Fbef05 said, the both videos must have the same framerate
use -f framerate and framerate must be the same in both videos.
To find the framerate use:
ffmpeg -i video1

ffmpeg -i video2

and look for the line which contains "Stream #0.0: Video:"
on that line you'll find the fps in movie.

Also I don't know what problems you'll encounter by mixing 2 audio tracks.
From my part I will try to use the audio from the movie which will be overlayed
over and discard the rest.



来源:https://stackoverflow.com/questions/5890738/overlaying-video-with-ffmpeg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!