如何使用FFmpeg hstack过滤器编写2个视频? [英] How to compose 2 videos by using FFmpeg hstack filter?

查看:419
本文介绍了如何使用FFmpeg hstack过滤器编写2个视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过并排组合2个视频到1个视频。
我也希望为每个视频设置开始/停止时间。
最终视频应为H264 / AAC编解码器和mp4格式。
我附了样本视频。
https://www.dropbox.com/s/e5eouyrrqsy44ts /1.webm?dl=0
https ://www.dropbox.com/s/u0zqie0icxamt3q/2.webm?dl = 0



我使用了以下ffmpeg命令。



ffmpeg -i 1.webm -i 2.webm -filter_complex[0:v] [1:v] hstackoutput.mp4



当我在Mac OS X 10.11的终端上运行此命令时,它给了我以下错误。



输入1高度480与输入0高度不匹配。



视频来自智能手机,因此其方向不正确。
请帮助我用FFmpeg制作视频。

解决方案

对于这组视频,您需要

  ffmpeg -i 1.webm -i 2.webm -filter_complex[0:v] scale = 480:640,setsar = 1 [ l]; [1:v] scale = 480:640,setsar = 1 [r]; [l] [r] hstack; [0] [1] amix-vsync 0 output.mp4 

写入应用程序尚未正确写入流属性。视频应标记为480x640。它不是关于一个缺少的旋转标签,因为框架上下文改变。


I want to compose 2 videos into 1 video by putting side by side. I also hope to set start/stop time for each video. Final video should be H264/AAC codec and mp4 format. I attached sample videos. https://www.dropbox.com/s/e5eouyrrqsy44ts/1.webm?dl=0 https://www.dropbox.com/s/u0zqie0icxamt3q/2.webm?dl=0

I used the following ffmpeg command.

ffmpeg -i 1.webm -i 2.webm -filter_complex "[0:v][1:v]hstack" output.mp4

When I run this command on Terminal of Mac OS X 10.11, It gave me the following error.

Input 1 height 480 does not match input 0 height.

The video are from smartphone, so its orientation is not correct. Please help me to make composed video with FFmpeg.

解决方案

For this set of videos, you need

ffmpeg -i 1.webm -i 2.webm -filter_complex "[0:v]scale=480:640,setsar=1[l];[1:v]scale=480:640,setsar=1[r];[l][r]hstack;[0][1]amix" -vsync 0 output.mp4

The writing application hasn't written the stream attributes correctly. The videos should be tagged as 480x640. It's not about a missing rotation tag, as the frame context changes.

这篇关于如何使用FFmpeg hstack过滤器编写2个视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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