ffmpeg 将拆分的数据合成一帧_FFMPEG 2视频转码并并排在1帧?

该博客探讨如何使用ffmpeg工具将两个视频文件HEADSHOT.MOV和SCREEN.MOV缩小并并排放置在同一帧中,创建一个输出_video.mp4。作者寻求解决不同长度视频的同步播放和最佳处理方式。解决方案包括使用scale、pad和overlay滤镜来实现所需效果,并提供了一个具体的ffmpeg命令示例。
摘要由CSDN通过智能技术生成

I have 2 videos: HEADSHOT.MOV and SCREEN.MOV. They are both large files and I am looking to both shrink (size, bitrate, etc) and place these two side by side in the same, very wide, video frame. The end result would be that when you play the output_video.mp4, you would have a very wide frame with both videos in sync and playing at the same rate.

Here is the syntatically incorrect version of what I am trying to do:

ffmpeg -i HEADSHOT.MOV -t 00:02:00 -acodec libfaac -ab 64k -vcodec libx264 -r 30 -pass 1 -s 374x210 -vf "movie=SCREEN.MOV [small]; [in][small] -an -r 30 -pass 1 -s 374x210 overlay=10:10 -t 00:02:00 [out]" -threads 0 output_movie.mp4

In the above example, I also tried to set a test movie duration for 2 minutes which raises another question, What is the best way to handle 2 movies of varying length (if they are close)?

The resources I have found helpful so far are:

Any help/advice is greatly appreciated. I am having trouble with the FFMPEG syntax! Thank you!

解决方案

The result can be achieved with the combination of scale, pad and overlay filters as the following:

ffmpeg.exe -i LeftInput.mp4 -vf "[in] scale=iw/2:ih/2, pad=2*iw:ih [left];

movie=RightInput.mp4, scale=iw/3:ih/3, fade=out:300:30:alpha=1 [right];

[left][right] overlay=main_w/2:0 [out]" -b:v 768k Output.mp4

Here the first video is shrunk by half, and padded to its original size. The second video is shrunk by two thirds and overlayed on the right half (padding area) of the first one.

The shorter video can be faded out; otherwise, it last frame will be display till the end of the combined video.

The result bit rate can be set with -b:v option. Also, video sizes and positions can be specified in pixels for pad, scale and overlay filters.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值