简体   繁体   English

FFMPEG同时开始播放2个视频,但隐藏一个视频直到另一个视频结束

[英]FFMPEG Start 2 videos at the same time but hide one until the other is finished

I have a generic intro sequence (no audio) and a main video clip. 我有一个通用的简介序列(无音频)和一个主视频剪辑。 I want the audio from the main clip to play as the intro sequence is playing then the video to switch from the finished intro sequence to the main video. 我希望主片段中的音频在播放介绍序列时播放,然后将视频从完成的介绍序列切换到主要视频。 So almost like playing both videos at the same time but hiding one until the other is finished. 因此,几乎就像同时播放两个视频一样,但是要隐藏一个视频直到另一个视频结束。 Is this possible with ffmpeg? ffmpeg有可能吗? Almost like a send to back function for the video on the main clip (but keep it's audio rolling so it's in sync when it shows as the intro clip finishes). 几乎就像主剪辑上的视频的发送到背面功能一样(但要保持音频的滚动,以便在简介剪辑结束时显示它是同步的)。

Looks like you want a J-cut. 看起来您想要J形切口。 This can be done using the overlay filter. 可以使用覆盖滤镜完成此操作。

ffmpeg -i main.mp4 -i intro.mp4 -filter_complex "[1][0]scale2ref[intro][base]; \
       [base][intro]overlay=eof_action=pass[v]" -map "[v]" -map 0:a -c:a copy out.mp4

The scale2ref filter ensures that the intro is the same resolution as the main video. scale2ref过滤器可确保简介与主视频具有相同的分辨率。 Then the intro is overlaid on top of the main video, in sync, and vanishes when it ends, leaving the main video on display. 然后,该简介会同步覆盖在主视频的顶部,并在结束时消失,从而使主视频显示在屏幕上。 The audio is copied over - no processing required. 音频被复制-无需处理。

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

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