8

I found a way to properly show mosaic of streams from RTSP cameras on VLC 3.0.8 and wanted to share the solution:
Write the following into a file <mosaic_vlc3.vlm>

# Comment the following line if you don't want to reset your VLM configuration
del all

new ch1 broadcast enabled
setup ch1 input "rtsp://user:pass@192.168.1.101:554/stream1"
setup ch1 output #mosaic-bridge{id=ch1,width=1280,height=512}

new ch2 broadcast enabled
setup ch2 input "rtsp://user:pass@192.168.1.102:554/stream1"
setup ch2 output #mosaic-bridge{id=ch2,width=1280,height=512}

new bg broadcast enabled
# The following background file is simply a black picture with specified dimensions, you can create one with any image editor, like mspaint, it is required for proper mosaic size
setup bg input "bg_1280x1024.jpg"
setup bg option image-duration=-1
setup bg output #transcode{vcodec=mp4v,vb=0,fps=0,acodec=none,channels=2,sfilter=mosaic{alpha=255,width=1280,height=1080,cols=1,rows=2,position=1,order="ch1,ch2",keep-aspect-ratio=enabled,mosaic-align=0,keep-picture=1}}:bridge-in{offset=100}:display

control bg play
control ch1 play
control ch2 play

# end of mosaic batch

Place both files <mosaic_vlc3.vlm> and <bg_1280x1024.jpg> next to vlc.exe inside your VLC installation folder. Launching is simple:
Write the following string into a file <VLC_Mosaic.cmd>
vlc.exe --vlm-conf mosaic_vlc3.vlm
UPD: If you want to hide/suppress the interface (avoid two interface widows opening),
vlc.exe --vlm-conf mosaic_vlc3.vlm -I dummy
But in this case, in order to close the player, you should press Ctrl+Q hotkey, since [x] button wouldn't work for some unknown reason. You can also create a shortcut link with same arguments as above.

In case if your RTSP streams are unstable, you might try to change VLC configuration as shown on the screenshots below:

Codec Settings 1

Codec Settings 2

Nik
  • 630
  • 1
  • 6
  • 17
  • If you want to hide/suppress the interface (avoid two interface widows opening), you can add `-Idummy` as an argument. But in this case, in order to close the player, you should press `Ctrl+Q` hotkey, since [x] button wouldn't work for some unknown reason. – Nik Dec 05 '19 at 17:50
  • 1
    I have a 4x4 mosaic setup, but some streams are unstable, sometimes the image just disappears and instead you can see the black background. Is there a way to avoid this and just freeze the image? – Olivier Gérardin Jul 03 '20 at 19:40
  • 1
    Suggested config already have that instruction `keep-picture=1` and that works really well with short breaks. However, when camera goes down for long time and VLC completely loses connection, that causes black screen for the sector of the picture responsible for showing video stream from that particular camera. After that, VLC doesn't try to reconnect anymore and an I have not yet found a way way to force re-connection properly. Currently, I just run the script with `taskkill /F /IM vlc.exe`. – Nik Aug 17 '20 at 11:40
  • I wonder is there is a way to enable the audio like ch1 left ch2 right or even mixed. I use it to see a couple of baby cams and I would really like to have audio. – distante Sep 19 '20 at 18:58
  • distante, answered your question below – Nik Sep 22 '20 at 11:07
  • 1
    @Nik Append `--qt-start-minimized` command to start VLC in the background with a taskbar icon instead of opening it as an additional window. – Adephx Aug 09 '23 at 08:03
  • @Adephx there is better way, see my first comment. – Nik Aug 15 '23 at 21:21

1 Answers1

1

Answering a question in the comments:

  • Yes, it is possible to add sound. It is even possible to control general volume with mouse scroll, which is quite convenient. Just need to add select=audio properly, like in the example below. It can be added to one or more channels, which will result in mix of all sound channels. Personally, I prefer enabling only one audio channel.
new ch1 broadcast enabled
setup ch1 input "rtsp://login:pass@192.168.1.2:80/stream1.mp4"
setup ch1 output #duplicate{dst=mosaic-bridge{id=ch1,width=1024,height=640},select=video,dst=bridge-out{id=0},select=audio}
Nik
  • 630
  • 1
  • 6
  • 17