How can I tile videos/create a video montage?

前端 未结 4 2046
情歌与酒
情歌与酒 2021-02-10 10:08

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 progra

4条回答
  •  梦如初夏
    2021-02-10 10:50

    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 works perfectly fine on Windows too. You may want to check out the GStreamer WinBuilds if you are interested.

    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
    

提交回复
热议问题