简体   繁体   English

剪切视频并将它们与hstack同时堆叠在ffmpeg中

[英]Cut videos and stack them with hstack in ffmpeg at the same time

I have two videos that I want to stack with hstack. 我有两个要与hstack叠加的视频。 The videos are not perfectly in sync so I would like to cut a bit from the beginning of one of the videos to get them to sync perfectly. 这些视频并非完全同步,因此我想从其中一个视频的开头切入一点,以使它们完美同步。 Everything works fine using two concurrent commands: 使用两个并发命令,一切正常:

ffmpeg -ss 00:00:18 -i video1.mp4 -ss 00:00:02.000 -c:v libx264 left.mp4 

followed by 其次是

ffmpeg -i left.mp4 -i right.mp4 -filter_complex hstack output.mp4

I'm wondering however if it is possible to do the trimming at the same time as stacking so that ffmpeg doesn't have to encode the cut video twice. 但是,我想知道是否有可能在堆叠的同时进行修整,以便ffmpeg不必对剪切的视频进行两次编码。 This would save a lot of time for me as I will be doing this cutting & merging multiple times. 这将为我节省很多时间,因为我将多次进行此切割和合并。

I tried various ways to achieve this in one single command, but to no avail so I have to turn to the community. 我尝试了多种方法在一个命令中实现此目标,但无济于事,因此我不得不求助于社区。 Thank you for helping! 感谢您的帮助!

对于普通的MP4文件,它就像

ffmpeg -ss 20 -i left.mp4 -i right.mp4 -filter_complex hstack output.mp4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM