本文介绍了如何平铺视频/创建视频蒙太奇?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有四个视频,我想以2x2的方式平铺以制作新视频.有什么办法可以使我轻松地做到这一点,最好是在Linux下免费吗?我愿意编写少量程序,也许是为了与某些库进行交互,但我不愿意自己编写整个视频处理程序.您可能会假设输入和输出视频使用的是最方便的任何常见格式.

I have four videos that I would like to tile in a 2x2 fashion to make a new video. Is there a way I can do this easily, preferably free and under Linux? I am willing to program a moderate amount, perhaps in order to interact with some library, but unwilling to write an entire video-processing program myself. You may assume that the input and output videos are in whatever commonly-occurring format is most convenient.

gm montage 命令(用于图像)的类似物为太棒了.

An analogue of the gm montage command (for images) would be fantastic.

推荐答案

我目前正在使用GStreamer进行类似的项目(演讲).您可能正在寻找 videomixer 元素.看看这个例子:视频4路分屏gstreamer管道(脚本位于此处).

I am currently using GStreamer for a similar project (lecture-capture) myself. You are probably looking for the videomixer element. Check out this example: Video 4-way split screen gstreamer pipeline (script is located here).

GStreamer在Windows上也可以正常工作.如果您感兴趣的话,您可能想查看 GStreamer WinBuilds .

GStreamer works perfectly fine on Windows too. You may want to check out the GStreamer WinBuilds if you are interested.

示例
这是一个适用于Windows的基本脚本(它没有反斜杠,因为我使用了 gst_parse_launch 从C代码中调用以解析管道描述):

Example
Here's a basic script that works for me on Windows (it doesn't have the backslashes because I use the gst_parse_launch call from C code to parse the pipeline description):

  v0. ! queue
      ! decodebin
      ! ffmpegcolorspace
      ! videoscale
      ! video/x-raw-yuv,width=320,height=240
      ! videobox right=-320 bottom=-240
      ! ffmpegcolorspace
      ! vmix.sink_0
  v1. ! queue
      ! decodebin
      ! ffmpegcolorspace
      ! videoscale
      ! video/x-raw-yuv,width=320,height=240
      ! videobox bottom=-240
      ! ffmpegcolorspace
      ! vmix.sink_1
  v2. ! queue
      ! decodebin
      ! ffmpegcolorspace
      ! videoscale
      ! video/x-raw-yuv,width=320,height=240
      ! videobox right=-240
      ! ffmpegcolorspace
      ! vmix.sink_2
  v3. ! queue
      ! decodebin
      ! ffmpegcolorspace
      ! videoscale
      ! video/x-raw-yuv,width=320,height=240
      ! ffmpegcolorspace
      ! vmix.sink_3
  vmix. ! queue
        ! ffmpegcolorspace
        ! dshowvideosink
  filesrc location="c:/test.mpg" name="v0"
  filesrc location="c:/test.mpg" name="v1"
  filesrc location="c:/test.mpg" name="v2"
  filesrc location="c:/test.mpg" name="v3"
  videomixer name=vmix
             sink_0::xpos=0   sink_0::ypos=0   sink_0::zorder=0
             sink_1::xpos=320 sink_1::ypos=0   sink_1::zorder=1
             sink_2::xpos=0   sink_2::ypos=240 sink_2::zorder=2
             sink_3::xpos=320 sink_3::ypos=240 sink_3::zorder=3

这篇关于如何平铺视频/创建视频蒙太奇?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 08:02