FFMPEG在视频末尾添加图像 [英] FFMPEG add image at the end of a video
本文介绍了FFMPEG在视频末尾添加图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用FFMPEG在.mp4视频文件的末尾添加一秒钟的图像。我的视频大小是WxH,我的图像大小是MxM,所以视频和图像大小是不同的。
I need to add an image for one second at the end of a .mp4 video file using FFMPEG. My video size is WxH and my image size is MxM, so video and image sizes are different.
我尝试了其他选项,以便在末尾添加图像视频为:
I have tried different options in order to add the image at the end of the video as:
ffmpeg -i "concat: videoIn.mp4|image.jpg" -c copy videoOut.mp4
或
ffmpeg -i videoIn.mp4 -loop 1 -t 1 -i image.jpg -f lavfi -t 2 -i anullsrc -filter_complex "[0:v][0:a][1:v][2:a] concat = n=2:v=1:a=1[v][a] -c:v libx264 -c:a aac -strict -2 -map" [v] "-map" [a]" videoOut.mp4
但没有一个给我我需要的结果。
but none gave me the result I need.
有人可以帮我吗?
亲切的问候
推荐答案
使用
ffmpeg -i videoIn.mp4 -loop 1 -t 1 -i image.jpg -f lavfi -t 1 -i anullsrc -filter_complex "[1:v]scale=WxH:force_original_aspect_ratio=decrease,pad=W:H:'(ow-iw)/2':'(oh-ih)/2'[i];[0:v][0:a][i][2:a] concat=n=2:v=1:a=1[v][a]" -c:v libx264 -c:a aac -map "[v]" -map "[a]" videoOut.mp4
调整图像大小以适合WxH帧大小,然后填充以获取视频的帧大小。
The image is resized to fit within a WxH frame size and then padded to get the video's frame size.
您需要ffmpeg 3.4.2或更高版本。
You'll need ffmpeg 3.4.2 or later.
这篇关于FFMPEG在视频末尾添加图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文