Skip to content

Instantly share code, notes, and snippets.

@confused-Techie
Created December 13, 2024 16:56
Show Gist options
  • Save confused-Techie/d09c8fa02265c2adb1c5b0e89ec3bdbd to your computer and use it in GitHub Desktop.
Save confused-Techie/d09c8fa02265c2adb1c5b0e89ec3bdbd to your computer and use it in GitHub Desktop.
VLC Video Wall

Create a Video Wall with VLC (WIP)

If you want to create a video wall within VLC there's a few ways to do this, but as far as I can tell none are perfect. Where this likely would work is for someone with a small handful of cameras wanting to create a videowall. But once enough cameras are thrown into the mix the performance because just to terrible to work with.

But lets look at how we could accomplish this:

Playlist

A playlist will show the stream from a single camera at a time, looping through them as needed.

Pros:

  • Performance is generally fine as there isn't much happening
  • Simple configuration to create and maintain. Cons:
  • If the resolution of the streams differs, then the size of the window may change and jump around when switching cameras.
  • Can only see one camera at a time.

Configuration File

File name: playlist.vlc Run command: "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --run-time=5 --loop --no-video-title "playlist.vlc"

# This is just a M3U basic format 
rtsp://user:[email protected]:554/
rtsp://user:[email protected]:554/

In the file we just create a list of any stream source. In my example that source being an RTSP stream, but it seems it could be any valid source for VLC.

Mosaic

If you only have a small handful of cameras and want to see them all at the same time, a mosaic may be the best choice.

Configuration File

File name: mosaic.vlm

# Background options
new   bg broadcast enabled
# bg just plain black background jpg image
setup bg input "background.jpg"
setup bg option image-duration=-1
setup bg output #transcode{sfilter=mosaic{width=1920,height=1080,cols=3,rows=2,position=1,order="1,2,3,4,5,6",keep-aspect-ratio=enabled,keep-picture=1,mosaic-align=5},vcodec=mp4v,vb=2000,fps=15}:duplicate{dst=display}

# Input options
new   1 broadcast enabled
setup 1 input "rtsp://admin:[email protected]:554/"
setup 1 option dshow-size="640x480"
setup 1 output #duplicate{dst=mosaic-bridge{id=1,width=640,height=480},select=video,dst=bridge-out{id=0}}

new   2 broadcast enabled
setup 2 input "rtsp://admin:[email protected]:554/"
setup 2 option dshow-size="640x480"
setup 2 output #duplicate{dst=mosaic-bridge{id=2,width=640,height=480},select=video,dst=bridge-out{id=1}}

new   3 broadcast enabled
setup 3 input "rtsp://admin:[email protected]:554/"
setup 3 option dshow-size="640x480"
setup 3 output #duplicate{dst=mosaic-bridge{id=3,width=640,height=480},select=video,dst=bridge-out{id=2}}

new   4 broadcast enabled
setup 4 input "rtsp://admin:[email protected]:554/"
setup 4 option dshow-size="640x480"
setup 4 output #duplicate{dst=mosaic-bridge{id=4,width=640,height=480},select=video,dst=bridge-out{id=3}}

new   5 broadcast enabled
setup 5 input "rtsp://admin:[email protected]:554/"
setup 5 option dshow-size="640x480"
setup 5 output #duplicate{dst=mosaic-bridge{id=5,width=640,height=480},select=video,dst=bridge-out{id=4}}

new   6 broadcast enabled
setup 6 input "rtsp://admin:[email protected]:554/"
setup 6 option dshow-size="640x480"
setup 6 output #duplicate{dst=mosaic-bridge{id=6,width=640,height=480},select=video,dst=bridge-out{id=5}}

# Launch everything
control bg play
control 1 play
control 2 play
control 3 play
control 4 play
control 5 play
control 6 play

Playlist Mosaic

Finally, if you have more camera's than could fit in a standard mosaic, you could attempt a mosaic made up of playlists.

This idea while somewhat functional, is really where I ran into such severe performance issues I had to ditch the project. But in the event that's not always true, here's how you do it:

Configuration File

File name: playlist-mosaic.vlm

### Background
new bg broadcast enabled
setup bg input "background.jpg"
setup bg option image-duration=-1
setup bg output #transcode{sfilter=mosaic{width=1920,height=1080,cols=3,rows=2,position=1,order="1,2,3,4,5,6",keep-aspect-ratio=enabled,keep-picture=1,mosaic-align=5},vcodec=mp4v,vb=2000,fps=15}:duplicate{dst=display}

### Streams

new PLAYLIST0 broadcast enabled
setup PLAYLIST0 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST0 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST0 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST0 option dshow-size="640x480"
setup PLAYLIST0 option sout-transcode-scale=0.25
setup PLAYLIST0 output #duplicate{dst=mosaic-bridge{id=1,width=640,height=480},select=video,dst=bridge-out{id=0}}
setup PLAYLIST0 option sout-keep
setup PLAYLIST0 option run-time=10
setup PLAYLIST0 option file-caching=1000
setup PLAYLIST0 option network-caching=1000
setup PLAYLIST0 loop


new PLAYLIST1 broadcast enabled
setup PLAYLIST1 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST1 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST1 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST1 option dshow-size="640x480"
setup PLAYLIST1 output #duplicate{dst=mosaic-bridge{id=2,width=640,height=480},select=video,dst=bridge-out{id=1}}
setup PLAYLIST1 option sout-keep
setup PLAYLIST1 option run-time=10
setup PLAYLIST1 option file-caching=1000
setup PLAYLIST1 option network-caching=1000
setup PLAYLIST1 loop

new PLAYLIST2 broadcast enabled
setup PLAYLIST2 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST2 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST2 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST2 option dshow-size="640x480"
setup PLAYLIST2 output #duplicate{dst=mosaic-bridge{id=3,width=640,height=480},select=video,dst=bridge-out{id=2}}
setup PLAYLIST2 option sout-keep
setup PLAYLIST2 option run-time=10
setup PLAYLIST2 option file-caching=1000
setup PLAYLIST2 option network-caching=1000
setup PLAYLIST2 loop

new PLAYLIST3 broadcast enabled
setup PLAYLIST3 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST3 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST3 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST3 option dshow-size="640x480"
setup PLAYLIST3 output #duplicate{dst=mosaic-bridge{id=4,width=640,height=480},select=video,dst=bridge-out{id=3}}
setup PLAYLIST3 option sout-keep
setup PLAYLIST3 option run-time=10
setup PLAYLIST3 option file-caching=1000
setup PLAYLIST3 option network-caching=1000
setup PLAYLIST3 loop

new PLAYLIST4 broadcast enabled
setup PLAYLIST4 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST4 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST4 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST4 option dshow-size="640x480"
setup PLAYLIST4 output #duplicate{dst=mosaic-bridge{id=5,width=640,height=480},select=video,dst=bridge-out{id=4}}
setup PLAYLIST4 option sout-keep
setup PLAYLIST4 option run-time=10
setup PLAYLIST4 option file-caching=1000
setup PLAYLIST4 option network-caching=1000
setup PLAYLIST4 loop

new PLAYLIST5 broadcast enabled
setup PLAYLIST5 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST5 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST5 input "rtsp://admin:[email protected]:554/"
setup PLAYLIST5 option dshow-size="640x480"
setup PLAYLIST5 output #duplicate{dst=mosaic-bridge{id=6,width=640,height=480},select=video,dst=bridge-out{id=5}}
setup PLAYLIST5 option sout-keep
setup PLAYLIST5 option run-time=10
setup PLAYLIST5 option file-caching=1000
setup PLAYLIST5 option network-caching=1000
setup PLAYLIST5 loop

### Launch
control bg play
control PLAYLIST0 play
control PLAYLIST1 play
control PLAYLIST2 play
control PLAYLIST3 play
control PLAYLIST4 play
control PLAYLIST5 play
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment