FFMPEG 2视频转码并并排在1帧? [英] FFMPEG 2 Videos transcoded and side by side in 1 frame?

查看:276
本文介绍了FFMPEG 2视频转码并并排在1帧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个视频:HEADSHOT.MOV和SCREEN.MOV。它们都是大文件,我正在缩小(尺寸,比特率等),并将这两个并排放在同一个非常宽的视频帧中。最终的结果是,当你播放output_video.mp4时,你将有一个非常宽的框架,两个视频同步并以相同的速度播放。



这里是我正在努力做的复杂的错误版本:

  ffmpeg -i HEADSHOT.MOV -t 00:02:00  - acodec libfaac -ab 64k -vcodec libx264 -r 30 -pass 1 -s 374x210 -vfmovie = 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 

在上面例如,我也尝试设置一个测试电影持续时间为2分钟,这又引发了另一个问题,最好的办法是处理两部不同长度的电影(如果它们很接近)?



目前为止,我发现有用的资源有:



多个视频源组合成一个



http://ffmpeg.org/ffmpeg.html#overlay-1



任何帮助/建议非常感激。我在FFMPEG语法中遇到麻烦!谢谢!

解决方案

结果可以通过scale,pad和覆盖过滤器的组合实现,如下所示:

  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] ] overlay = main_w / 2:0 [out]-b:v 768k Output.mp4

第一部影片缩小了一半,并填补了原来的大小。第二个视频缩小了三分之二,覆盖了第一个视频的右半部分(padding area)。



较短的视频可以淡出;否则,最后一帧将显示到组合视频的结尾。



可以使用 -b:v 选项设置结果比特率。此外,视频尺寸和位置可以以像素为单位指定,用于焊盘,刻度和覆盖滤镜。


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:

Multiple video sources combined into one and

http://ffmpeg.org/ffmpeg.html#overlay-1

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.

这篇关于FFMPEG 2视频转码并并排在1帧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆