3

I'm looking for a command line video tool running on linux, which is scriptable, and it can give an output video with mosaic videos inside. The problem is, that the mosaic videos have to change inside the output. Imagine a 4*4 mosaic video, but there are more input videos than 16, so for example every 10 seconds I have to change a tile in the mosaic to another video.

I've found the command line VLC tool and avisynth which can generate mosaic output, but as I see they don't support the changing videos described above.

Does someone know other options?

Thanks in advance!

2 Answers2

0

AviSynth can join videos, hence you can change a video source at any time in the script.

For instance, in the following sample, the top left video of the four inputs will change to a different video after 6 seconds:

v11 = AviSource("SomeSampleVideo.avi", false). \
  Crop(0, 0, 320, 240).AssumeFPS(25).ConvertToRGB32.Trim(0, 150).FadeOut(25, $FF0000)

v12 = AviSource("AnotherSampleVideo.avi", false). \
  Crop(40, 10, 320, 240).AssumeFPS(25).ConvertToRGB32.FadeIn(25, $FF0000)

v1 = v11 + v12

v2 = ImageReader("SomeSampleBitmap.bmp").Crop(20, 10, 320, 240).ConvertToRGB32
v3 = AviSource("YetAnotherVideo.avi", false).Crop(30, 30, 320, 240).ConvertToRGB32
v4 = v1.Subtract(v2)

return StackVertical(StackHorizontal(v1, v2), StackHorizontal(v3, v4))


It is possible that I have misunderstood the requirements though..

Sertac Akyuz
  • 54,131
  • 4
  • 102
  • 169
0

A work around could be to run your videos over a UDP stream generated with VLC e.g.:

    vlc -vvv $YOUR_INPUT_VIDEO_AS_A_VARIABLE --sout='#transcode{vcodec=h264, vb=768, fps=25.0, width=1920, height=1080, scale=1, acodec=aac, ab=128, samplerate=32000}:standard{access=udp, mux=ts, dst=239.0.0.1}'

Then include this udp stream in your VLC mosaic e.g.:

   setup video1 input udp://@239.0.0.1

Later i imagine you can write a script which is called with a variable being the path to your new video ($YOUR_INPUT_VIDEO_AS_A_VARIABLE) ultimately killing the earlier VLC instance and restarting it with the new video sending it to the same udp address. In your case you'd need to take ports into consideration e.g. sending video 1 to 239.0.0.1:1234; video 2 to 239.0.0.1:1236; video 3 to 239.0.0.1:1238 - and so on.

UDP doesn't care if nothing is sent so I guess you will have a short period where no video is played (the time it takes to kill the old VLC instance and stream the new video).

Again, it's a work around. So maybe this helps, otherwise forget it.

Mike F
  • 1,224
  • 4
  • 26
  • 44