Skip to content

Instantly share code, notes, and snippets.

@Vankalif
Last active April 24, 2024 21:26
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save Vankalif/c61bd6c227c938572b3f2788b0e2c615 to your computer and use it in GitHub Desktop.
Save Vankalif/c61bd6c227c938572b3f2788b0e2c615 to your computer and use it in GitHub Desktop.
VLC 6 ip cameras mosaic config via RTSP
# Runs on windows by command -> vlc --vlm-conf path_to_file.vlm
# Background options
new bg broadcast enabled
# bg just plain black background jpg image
setup bg input "C:\Users\full_path_to\back.jpg"
setup bg option image-duration=-1
setup bg output #transcode{sfilter=mosaic{width=1920,height=960,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
# RTSP string for HIKVISION cameras
setup 1 input "rtsp://admin:pass@0.0.0.0:554/ISAPI/Streaming/Channels/102"
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:pass@0.0.0.0:554/ISAPI/Streaming/Channels/102"
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:pass@0.0.0.0:554/ISAPI/Streaming/Channels/102"
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:pass@0.0.0.0:554/ISAPI/Streaming/Channels/102"
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:pass@0.0.0.0:554/ISAPI/Streaming/Channels/102"
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:pass@0.0.0.0:554/ISAPI/Streaming/Channels/102"
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
@ostan
Copy link

ostan commented Apr 14, 2020

Hey, thanks for sharing!
For some reason it's not working for me. I did test out all my RTSP URLs and they do work in VLC (Media/Open Network Stream - one at the time).
Running vlc --vlm-conf path_to_file.vlm - the first time nothing happens, VLC does not open.
When I execute it the second time I get the error below in a pop-up.

Any ideas?
Thanks!

VLC crash reporting

Ooops: VLC media player just crashed.
Would you like to send a bug report to the developers team?

@Vankalif
Copy link
Author

Can you show me your config? I'll check it for mistakes.

@ostan
Copy link

ostan commented Apr 14, 2020

Sure:

Runs on windows by command -> vlc --vlm-conf path_to_file.vlm

Background options

new bg broadcast enabled

bg just plain black background jpg image

setup bg input "C:/Users/XXX/Documents/VLC/img02.jpg"
setup bg option image-duration=-1
setup bg output #transcode{sfilter=mosaic{width=1920,height=960,cols=3,rows=2,position=1,order="1,2,3,4",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

RTSP string for HIKVISION cameras

setup 1 input "rtsp://192.168.0.26:554/user=admin_password=xxx_channel=1_stream=0.sdp?real_stream"
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://192.168.0.27:554/user=admin_password=xxx_channel=1_stream=0.sdp?real_stream"
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://192.168.0.28:554/user=admin_password=xxx_channel=1_stream=0.sdp?real_stream"
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://192.168.0.2:554/user=admin_password=xxx_channel=1_stream=0.sdp?real_stream"
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}}

Launch everything

control bg play
control 1 play
control 2 play
control 3 play

@Vankalif
Copy link
Author

Vankalif commented Apr 14, 2020

rtsp://admin:12345@192.168.200.11:554/ISAPI/Streaming/Channels/101 - use rtsp string like this, you can use alternative channel with 102 number

@ostan
Copy link

ostan commented Apr 14, 2020

I don't know if it's relevant but all 4 cameras streams are 1920×1080 and the codec is MPEG-H Part2/HEVC (H.265) (hevc). But like I said they do play in VLC.

@Vankalif
Copy link
Author

For me works this one rtsp://admin:pass@IP:554/ISAPI/Streaming/Channels/102 - put your varibles in pass and ip and try to open one camera with config

@Vankalif
Copy link
Author

my cameras uses h.264 protocol - mpeg4, switch to it and try again.

@Cilvaring
Copy link

Hey there. Thanks for the work, helped me a lot in getting a big step further to my goal.
I also want to have 6 cameras but I can only get it to work with 4...

Maybe you have an idea what could be wrong. I can't think of anything anymore.
The original picture of the cameras is 2560x1920. To keep the ratio I chose
For 4 cameras: 1440x1080 (mosaic) and 720x540 (rtsp feed)
For 6 cameras: 1920x960 (mosaic) and 640x480 (rtsp feed)

With 4 cameras everything works fine.
But with 6 cameras, this happens... I don't get it

Cams

These are the codes:

`new channel1 broadcast enabled
setup channel1 input "rtsp://admin:123456@192.168.0.121:554//h264Preview_01_sub"
setup channel1 output #duplicate{dst=mosaic-bridge{id=1,width=720,height=540},select=video,dst=bridge-out{id=1}}

new channel2 broadcast enabled
setup channel2 input "rtsp://admin:123456@192.168.0.122:554//h264Preview_01_sub"
setup channel2 output #duplicate{dst=mosaic-bridge{id=2,width=720,height=540},select=video,dst=bridge-out{id=2}}

new channel3 broadcast enabled
setup channel3 input "rtsp://admin:123456@192.168.0.123:554//h264Preview_01_sub"
setup channel3 output #duplicate{dst=mosaic-bridge{id=3,width=720,height=540},select=video,dst=bridge-out{id=3}}

new channel4 broadcast enabled
setup channel4 input "rtsp://admin:123456@192.168.0.124:554//h264Preview_01_sub"
setup channel4 output #duplicate{dst=mosaic-bridge{id=4,width=720,height=540},select=video,dst=bridge-out{id=4}}

new mosaic broadcast enabled
setup mosaic input "file:///C:/Program Files/VideoLAN/VLC/bkg4.jpg"
setup mosaic option image-duration=-1
setup mosaic output #transcode{sfilter=mosaic{width=1440,height=1080,cols=2,rows=2,order="1,2,3,4",keep-aspect-ratio=enabled,keep-picture=1,mosaic-align=5},vcodec=mp4v,acodec=none}:duplicate{dst=display}

control mosaic play
control channel1 play
control channel2 play
control channel3 play
control channel4 play`

and for six cameras:

`new channel1 broadcast enabled
setup channel1 input "rtsp://admin:123456@192.168.0.121:554//h264Preview_01_sub"
setup channel1 option dshow-size="640x480"
setup channel1 output #duplicate{dst=mosaic-bridge{id=1,width=640,height=480},select=video,dst=bridge-out{id=1}}

new channel2 broadcast enabled
setup channel2 input "rtsp://admin:123456@192.168.0.122:554//h264Preview_01_sub"
setup channel2 option dshow-size="640x480"
setup channel2 output #duplicate{dst=mosaic-bridge{id=2,width=640,height=480},select=video,dst=bridge-out{id=2}}

new channel3 broadcast enabled
setup channel3 input "rtsp://admin:123456@192.168.0.123:554//h264Preview_01_sub"
setup channel3 option dshow-size="640x480"
setup channel3 output #duplicate{dst=mosaic-bridge{id=3,width=640,height=480},select=video,dst=bridge-out{id=3}}

new channel4 broadcast enabled
setup channel4 input "rtsp://admin:123456@192.168.0.124:554//h264Preview_01_sub"
setup channel4 option dshow-size="640x480"
setup channel4 output #duplicate{dst=mosaic-bridge{id=4,width=640,height=480},select=video,dst=bridge-out{id=4}}

new channel5 broadcast enabled
setup channel5 input "rtsp://admin:123456@192.168.0.125:554//h264Preview_01_sub"
setup channel5 option dshow-size="640x480"
setup channel5 output #duplicate{dst=mosaic-bridge{id=5,width=640,height=480},select=video,dst=bridge-out{id=5}}

new channel6 broadcast enabled
setup channel6 input "rtsp://admin:123456@192.168.0.126:554//h264Preview_01_sub"
setup channel6 option dshow-size="640x480"
setup channel6 output #duplicate{dst=mosaic-bridge{id=6,width=640,height=480},select=video,dst=bridge-out{id=6}}

new mosaic broadcast enabled
setup mosaic input "file:///C:/Program Files/VideoLAN/VLC/bkg6.jpg"
setup mosaic option image-duration=-1
setup mosaic output #transcode{sfilter=mosaic{width=1920,height=960,cols=3,rows=2,order="1,2,3,4,5,6",keep-aspect-ratio=enabled,keep-picture=1,mosaic-align=5},vcodec=mp4v}:duplicate{dst=display}

control mosaic play
control channel1 play
control channel2 play
control channel3 play
control channel4 play
control channel5 play
control channel6 play`

If you have any idea, I would really appreciate the help.

Thanks!

@Vankalif
Copy link
Author

Vankalif commented Jan 12, 2022 via email

@Cilvaring
Copy link

Thanks. But I don't understand.
I have a camera stream of 640*480.
Then I want 2 rows and 3 cols so I have 3 cameras next to each other in the top half and 3 cameras in the bottom half.

So is it not 3640=1920 and 2480=920 for the size of the mosaic or am I missing something?

Why 1080 / 6?

@Vankalif
Copy link
Author

Vankalif commented Jan 13, 2022 via email

@itzniru
Copy link

itzniru commented May 7, 2022

Ty ty and ty for this config file. 👍 Now it started working for me, after spending a few hours with a faulty one.

@aydam2728
Copy link

aydam2728 commented May 17, 2022

Hello,

I'm trying to execute the script but when I'm executing the conf file with CMD just default VLC app is lauching. No cams or no errors.
Has someone already had this problem ? The vlc.vlm file if you want to check

Thanks

# Runs on windows by command -> vlc --vlm-conf path_to_file.vlm

# Background options
new   bg broadcast enabled
bg just plain black background jpg image
setup bg input "B:\Desktop\black.jpg"
setup bg option image-duration=-1
setup bg output #transcode{sfilter=mosaic{width=1920,height=960,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:admin@192.168.1.254:554/cam/realmonitor?channel=1&subtype=0"
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:admin@192.168.1.254:554/cam/realmonitor?channel=2&subtype=0"
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:admin*@192.168.1.254:554/cam/realmonitor?channel=3&subtype=0"
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:admin*@192.168.1.254:554/cam/realmonitor?channel=4&subtype=0"
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:admin*@192.168.1.254:554/cam/realmonitor?channel=5&subtype=0"
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:admin*@192.168.1.254:554/cam/realmonitor?channel=6&subtype=0"
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

PS : Links are working individually

@adushaj
Copy link

adushaj commented Aug 26, 2022

Hey, thank you for sharing this Gist. It's leading me to the right path. I am encountering some instability with 3 of my Eufy cams running RTSP. Ignore camera 4. I have commented that one out because it's a trash Wyze cam of little importance to me that will be replaced soon by another Eufy. Final version desired is to have 4 RTSP cams displayed on a 1920x1080 display evenly divided into 960x540 per cam. Below is my running file at the moment. Stream #1 does a good job at staying stable with zero flicker while stream 2 and 3 begin to flicker quite a bit. Note that all of these streams run completely stable when I run a direct network stream in VLC individually so I feel like VLC is struggling somehow with the mosaic. Here's a clip on Imgur The background image is of my dogs and as previously mentioned, don't worry about the 4th stream not appearing at all. It's commented out right now.

del all
# background options
new  bg broadcast enabled
# background image
setup bg input     "C:\Users\aleks\VLC Mosaic for RTSP Streams\bg.jpg"
setup bg option image-duration=-1
setup bg output #transcode{sfilter=mosaic{width=1920,height=1080,cols=2,rows=2,position=1,order="1,2,3,4",keep-aspect-ratio=enabled,keep-picture=1,mosaic-align=5},vcodec=mp4v,vb=2000,fps=25/1}:duplicate{dst=display}

# Input options
new   1 broadcast enabled
# RTSP string for Eufy cams
setup 1 input "rtsp://192.168.199.130:554/live0"
setup 1 option dshow-size="960x540"
setup 1 output #duplicate{dst=mosaic-bridge{id=1,width=960,height=540},select=video,dst=bridge-out{id=1}}

new   2 broadcast enabled
setup 2 input "rtsp://192.168.199.151:554/live0"
setup 2 option dshow-size="960x540"
setup 2 output #duplicate{dst=mosaic-bridge{id=2,width=960,height=540},select=video,dst=bridge-out{id=2}}

new   3 broadcast enabled
setup 3 input "rtsp://192.168.199.170:554/live0"
setup 3 option dshow-size="960x540"
setup 3 output #duplicate{dst=mosaic-bridge{id=3,width=960,height=540},select=video,dst=bridge-out{id=3}}
# RTSP for Backyard Wyze Cam
#new   4 broadcast enabled
#setup 4 input "rtsp://admin:admin@192.168.199.193:554/live"
#setup 4 option dshow-size="960x540"
#setup 4 output #duplicate{dst=mosaic-bridge{id=4,width=960,height=540},select=video,dst=bridge-out{id=4}}

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

Anything stand out to you in this file? What about VLC settings? I've tried running this with both hardware acceleration off and on in VLC.

@thedroidkid
Copy link

Thanks I got mine working. Anyone know how to hide the second VLC window?

@ivan-cc
Copy link

ivan-cc commented Nov 30, 2022

Thanks I got mine working. Anyone know how to hide the second VLC window?

-I dummy

@noparking247
Copy link

I signed up for an account just to comment on this.

I have (4) Hikvision cameras and wanted to display them on a 1920x1080 monitor. I also wanted it to be as idiot proof as possible, hence why I'm looking at this route rather than using the full ActiveX client.

Anywho...

One important thing I think is overlooked, is the size of the initial background. In my case, I made a .jpg file in Paint the same size as the screen, 1920x1080.

I also tweaked some of the above config -- and it seems to be working great.

To be run with: vlc.exe --vlm-conf C:\Temp\test.vlm -I dummy --no-video-deco --no-embedded-video

del all

Background options

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

Input options

new 1 broadcast enabled
setup 1 input "rtsp://admin:SUPER_PASSWORD@172.16.251.101:554/ISAPI/Streaming/Channels/101"
setup 1 option dshow-size="640x480"
setup 1 output #duplicate{dst=mosaic-bridge{id=1,width=960,height=540},select=video,dst=bridge-out{id=0}}

new 2 broadcast enabled
setup 2 input "rtsp://admin:SUPER_PASSWORD@172.16.251.102:554/ISAPI/Streaming/Channels/101"
setup 2 option dshow-size="640x480"
setup 2 output #duplicate{dst=mosaic-bridge{id=2,width=960,height=540},select=video,dst=bridge-out{id=1}}

new 3 broadcast enabled
setup 3 input "rtsp://admin:SUPER_PASSWORD@172.16.251.103:554/ISAPI/Streaming/Channels/101"
setup 3 option dshow-size="640x480"
setup 3 output #duplicate{dst=mosaic-bridge{id=3,width=960,height=540},select=video,dst=bridge-out{id=2}}

new 4 broadcast enabled
setup 4 input "rtsp://admin:SUPER_PASSWORD@172.16.251.104:554/ISAPI/Streaming/Channels/101"
setup 4 option dshow-size="640x480"
setup 4 output #duplicate{dst=mosaic-bridge{id=4,width=960,height=540},select=video,dst=bridge-out{id=3}}

Launch everything

control bg play
control 1 play
control 2 play
control 3 play
control 4 play

Also note -- I run this with "vlc.exe --vlm-conf C:\Temp\test.vlm -I dummy --no-video-deco --no-embedded-video" -- as this eliminates any additional pop-up windows/title bars/etc. -- just a screen with 4 cameras.

@noparking247
Copy link

Note: The bolded statements just happen to begin with a # as they are commented out. Not sure why that happened, but, YOLO.

@elirannat
Copy link

Hi Vankalif how are you?

I do it like what wrote.. and still I didn't get anything in my VLC 3.0.18.
You have an option to check it with me?
Big thanks

@Vankalif
Copy link
Author

@elirannat do u read the comment @noparking247 ? Have you tried?

@Vankalif
Copy link
Author

Try this as example, before you start, you need an image with 1920x1080 size in pixels. Place it in "C:\Temp", name it bg.jpg
Hope it will help you!

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

new 1 broadcast enabled loop
setup 1 input "http://streams.videolan.org/samples/MPEG-4/CDR-Dinner_LAN_800k.mp4"
setup 1 option dshow-size="640x480"
setup 1 output #duplicate{dst=mosaic-bridge{id=1,width=960,height=540},select=video,dst=bridge-out{id=0}}

new 2 broadcast enabled
setup 2 input "http://streams.videolan.org/samples/MPEG-4/MPEGSolution_jurassic.mp4"
setup 2 option dshow-size="640x480"
setup 2 output #duplicate{dst=mosaic-bridge{id=2,width=960,height=540},select=video,dst=bridge-out{id=1}}

new 3 broadcast enabled loop
setup 3 input "http://streams.videolan.org/samples/MPEG-4/CDR-Dinner_LAN_800k.mp4"
setup 3 option dshow-size="640x480"
setup 3 output #duplicate{dst=mosaic-bridge{id=3,width=960,height=540},select=video,dst=bridge-out{id=2}}

new 4 broadcast enabled
setup 4 input "http://streams.videolan.org/samples/MPEG-4/MPEGSolution_jurassic.mp4"
setup 4 option dshow-size="640x480"
setup 4 output #duplicate{dst=mosaic-bridge{id=4,width=960,height=540},select=video,dst=bridge-out{id=3}}

control bg play
control 1 play
control 2 play
control 3 play
control 4 play

@elirannat
Copy link

Try this as example, before you start, you need an image with 1920x1080 size in pixels. Place it in "C:\Temp", name it bg.jpg Hope it will help you!

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

new 1 broadcast enabled loop setup 1 input "http://streams.videolan.org/samples/MPEG-4/CDR-Dinner_LAN_800k.mp4" setup 1 option dshow-size="640x480" setup 1 output #duplicate{dst=mosaic-bridge{id=1,width=960,height=540},select=video,dst=bridge-out{id=0}}

new 2 broadcast enabled setup 2 input "http://streams.videolan.org/samples/MPEG-4/MPEGSolution_jurassic.mp4" setup 2 option dshow-size="640x480" setup 2 output #duplicate{dst=mosaic-bridge{id=2,width=960,height=540},select=video,dst=bridge-out{id=1}}

new 3 broadcast enabled loop setup 3 input "http://streams.videolan.org/samples/MPEG-4/CDR-Dinner_LAN_800k.mp4" setup 3 option dshow-size="640x480" setup 3 output #duplicate{dst=mosaic-bridge{id=3,width=960,height=540},select=video,dst=bridge-out{id=2}}

new 4 broadcast enabled setup 4 input "http://streams.videolan.org/samples/MPEG-4/MPEGSolution_jurassic.mp4" setup 4 option dshow-size="640x480" setup 4 output #duplicate{dst=mosaic-bridge{id=4,width=960,height=540},select=video,dst=bridge-out{id=3}}

control bg play control 1 play control 2 play control 3 play control 4 play

Still not working to me Nicolay.
Please advice..
I can provide you remote access to check it.

Thank you & best regards,

@elirannat
Copy link

@elirannat do u read the comment @noparking247 ? Have you tried?

Yes I read it.
Not works.

@noparking247
Copy link

@elirannat do u read the comment @noparking247 ? Have you tried?

Yes I read it. Not works.

That's not overly informative. What doesn't work? Do the feeds work in VLC to begin with?

The streams you referenced appear to just contain audio... so... I'm not sure what you're expecting.

@F-AlFaris
Copy link

@Vankalif @noparking247 Firstly, thank you both for sharing your VLM files - they've been very useful for me to get my video streams operational. However, I'm experiencing a choppy and jittery video stream in mosaic.

I am currently running 14 cameras, each with the following specifications: 1440x1620 resolution, H265 encoding, 10 FPS, 1 sec Frame Interval, and 1024 Bitrate.

The VLC machine is a 1440p with hardware decoding enabled (Direct3D11 Video Acceleration) and running with an RTX 3090.

Although I can open all streams individually, they become choppy and jittery when combined in a mosaic. I suspect this issue may be related to the encoding options in the VLM file. Right now, the VLM file is set to mp4v for the encoding while my IP cameras encode in h265. I tried to change the vcodec transcoding settings to vcodec=h264, vcodec=h265, and vcodec=hevc in the VLM file, but the video just won't start without the vcodec=mp4v.

Would greatly appreciate suggestions or feedback on this. Is there a specific encoding option that I should use for h265 encoded streams or could there be another potential solution that I may be overlooking?

Here is the VLM configuration that I have been using:

# Runs on windows by command -> vlc --vlm-conf path_to_file.vlm

# Background options
new   bg broadcast enabled
# bg just plain black background jpg image
setup bg input     ""C:\Users\XXX\Downloads\bg.jpg""
setup bg option image-duration=-1
setup bg output #transcode{sfilter=mosaic{width=2560,height=1440,cols=4,rows=4,position=1,order="1,2,3,4,5,6,7,8,9,10,11,12,13,14",keep-aspect-ratio=enabled,keep-picture=1,mosaic-align=0},vcodec=mp4v,vb=2000,fps=10}:duplicate{dst=display}

# Input options
new   1 broadcast enabled
#RTSP string for cameras
setup 1 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=1&subtype=0"
setup 1 output #duplicate{dst=mosaic-bridge{id=1,width=640,height=340},select=video,dst=bridge-out{id=0}}

new   2 broadcast enabled
setup 2 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=2&subtype=0"
setup 2 output #duplicate{dst=mosaic-bridge{id=2,width=640,height=340},select=video,dst=bridge-out{id=1}}

new   3 broadcast enabled
setup 3 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=3&subtype=0"
setup 3 output #duplicate{dst=mosaic-bridge{id=3,width=640,height=340},select=video,dst=bridge-out{id=2}}

new   4 broadcast enabled
setup 4 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=4&subtype=0"
setup 4 output #duplicate{dst=mosaic-bridge{id=4,width=640,height=340},select=video,dst=bridge-out{id=3}}

new   5 broadcast enabled
setup 5 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=5&subtype=0"
setup 5 output #duplicate{dst=mosaic-bridge{id=5,width=640,height=340},select=video,dst=bridge-out{id=4}}

new   6 broadcast enabled
setup 6 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=6&subtype=0"
setup 6 output #duplicate{dst=mosaic-bridge{id=6,width=640,height=340},select=video,dst=bridge-out{id=5}}

new   7 broadcast enabled
setup 7 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=7&subtype=0"
setup 7 output #duplicate{dst=mosaic-bridge{id=7,width=640,height=340},select=video,dst=bridge-out{id=6}}

new   8 broadcast enabled
setup 8 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=8&subtype=0"
setup 8 output #duplicate{dst=mosaic-bridge{id=8,width=640,height=340},select=video,dst=bridge-out{id=7}}

new   9 broadcast enabled
setup 9 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=9&subtype=0"
setup 9 output #duplicate{dst=mosaic-bridge{id=9,width=640,height=340},select=video,dst=bridge-out{id=8}}

new   10 broadcast enabled
setup 10 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=10&subtype=0"
setup 10 output #duplicate{dst=mosaic-bridge{id=10,width=640,height=340},select=video,dst=bridge-out{id=9}}

new   11 broadcast enabled
setup 11 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=11&subtype=0"
setup 11 output #duplicate{dst=mosaic-bridge{id=11,width=640,height=340},select=video,dst=bridge-out{id=10}}

new   12 broadcast enabled
setup 12 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=12&subtype=0"
setup 12 output #duplicate{dst=mosaic-bridge{id=12,width=640,height=340},select=video,dst=bridge-out{id=11}}

new   13 broadcast enabled
setup 13 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=13&subtype=0"
setup 13 output #duplicate{dst=mosaic-bridge{id=13,width=640,height=340},select=video,dst=bridge-out{id=12}}

new   14 broadcast enabled
setup 14 input "rtsp://XXXX:XXXX@ip:554/cam/realmonitor?channel=14&subtype=0"
setup 14 output #duplicate{dst=mosaic-bridge{id=14,width=640,height=340},select=video,dst=bridge-out{id=13}}

# Launch everything
control bg play
control 1 play
control 2 play
control 3 play
control 4 play
control 5 play
control 6 play
control 7 play
control 8 play
control 9 play
control 10 play
control 11 play
control 12 play
control 13 play
control 14 play

@muhanadali100
Copy link

Please anyone can help me with 16 Camera, I need a script with 1920 x 1080 and 16 Camera

@noparking247
Copy link

@F-AlFaris that doesn't really surprise me. I had similar results when I was using the main stream of my cameras (with similar configurations). I ended up switching it to the substream feed, which looks fine when it's small anyway. In my case with Hikvision cameras, this was done by appending the "/Channels/101" to the path -- each vendor will be different.

I also noticed that VLC has a memory leak when using mosaic. If I used the main feed, I'd be lucky to have it working for more than an hour. With the substream, it works for ~24 hours. I ended up writing a small script to run every 5 minutes to check to see if "vlc.exe" is consuming more than 2GB of RAM -- if it is, forcefully close it, and relaunch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment