How can I split video / create video editing?

I have four videos that I would like to make in 2x2 style to make a new video. Is there a way to do this easily, preferably for free, and under Linux? I am ready to program a moderate amount, perhaps to interact with some library, but I do not want to write the entire video processing program. You can assume that input and output videos in any common format are most convenient.

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

+4
source share
4 answers

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

GStreamer works great on Windows. If you're interested, you can check out GStreamer WinBuilds .

Example
Here is a basic script that works for me on Windows (it does not have 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
+4
source

The following ffmpeg command will do exactly what I wanted to ask the question:

ffmpeg -i input1.mp4 -i input2.mp4 -i input3.mp4 -i input4.mp4 -filter_complex \
'[0:v]pad=iw*2:ih*2:0:0[int2];[int2][1:v]overlay=0:H/2[int3];[int3][2:v]overlay=W/2:0[int4];[int4][3:v]overlay=W/2:H/2[out]' \
-map [out] -c:v libx264 -crf 23 -preset veryfast output.mp4

-, , . , .

, .

+5

, AviSynth .

AviSynth - , , . , . AviSynth, .AVI, , .

AviSynth , .AVI .

+4
source

One possible solution would be to describe the layout of your video editing with SMIL , a multimedia markup language. This requires a text editor to write your SMIL document and an SMIL video player (such as Ambulant , Quicktime, or Realplayer) to display it.

+1
source

All Articles