RTSP plus VLC - Creating a Windows 10 BAT file to run - Can it be done?

Alaska Country

Getting comfortable
Jun 10, 2021
557
753
Alaska
Using VLC on a Windows 10 desktop works well to run a RTSP stream. No issue with this working with a Dahua NVR plus Dahua cameras on the windows computer.

However, would like to add a desktop BAT file to open and stream a Dahua camera without the need to open and select the stream within VLC.

The below will open VLC using a BAT file, but will not stream the indicated camera. i.e. it will not select the media tab or open network stream tab but displays an empty playlist window.

Code:
"C:\Program Files\VideoLAN\VLC\vlc.exe" rtsp:/admin:password@192.168.1.108/cam/realmonitor?channel=1&subtype=0 --fullscreen --no-video-title-show
exit

Would appreciate code that will make this operational without the need to reenter the user name, password or select the desired channel. All should be part of the BAT file.
 
Appreciate the heads up on not being able to use a desktop shortcut to launch VLC and then start a RTSP stream to the same computer.

Did notice that it could be possible to use a batch file to start VLS. Then use something like Windows Script Host (Send Keys) to use CTRL + N to select the streaming network URL in VLS. Some also may use VBA to perform the same functions.
 
Did you try putting rtsp link inside the quotation marks? Also don't forget to add two / after rtsp:
 
Yes, the two double forward slashes are included in the "real" bat file. The BB code on IPC talk strips one out for some reason.

Gave your idea a try and nothing happened. With the quotes, as is in the orginal ,VLC will start but when modified will not. Thanks for the suggestion.
 
Yes, the two double forward slashes are included in the "real" bat file. The BB code on IPC talk strips one out for some reason.

Gave your idea a try and nothing happened. With the quotes, as is in the orginal ,VLC will start but when modified will not. Thanks for the suggestion.

Can you add these parameters to your command line and attach your log file?

Code:
--extraintf logger --log-verbose=2 --verbose-objects=+all --logfile="C:\Users\YOUR_WINDOWS_USERNAME\Desktop\vlc-log.txt"
 
Added the code to the bat file but it will not produce a log in the requested location. Changed the windows user name to access the desktop. Did see my two bat files so that part is correct.

When running the bat file, the VLC window pops up but nothing else happens. i.e. no log file is written.

VLC.PNG

Did notice that there is no space around the ampersand but in the run window there is a space on each side. Tried escaping, but no luck.

Bat_File.PNG
 
The problem is simple the "&" sign in your url. You can debug such things when you start vlc like "vlx.exe -vvv rtps:/your-url".

This should work:

Code:
"C:\Program Files\VideoLAN\VLC\vlc.exe" "rtsp:/admin:password@192.168.1.108/cam/realmonitor?channel=1&subtype=0" --fullscreen --no-video-title-show

exit



an other interessting vlc feature is the "run-time" option. that makes it possible to put your cameras into a single playlist and switch to the next streams after X seconds:

Code:
vlc --fullscreen --playlist-autostart playlist.xspf --run-time=10
 
FWIW, the first "Code" box works great when run as a bat file on my PC, opening an Amcrest (Dahua-rebrand) IP2M-841 at full screen. :cool:
 
Added the code to the bat file but it will not produce a log in the requested location. Changed the windows user name to access the desktop. Did see my two bat files so that part is correct.

When running the bat file, the VLC window pops up but nothing else happens. i.e. no log file is written.

View attachment 129268

Did notice that there is no space around the ampersand but in the run window there is a space on each side. Tried escaping, but no luck.

View attachment 129269

Can you attach the .bat file to your post? If forum doesn't allow it, try in RAR or ZIP file.
 
This should work:

Code:
"C:\Program Files\VideoLAN\VLC\vlc.exe" "rtsp:/admin:password@192.168.1.108/cam/realmonitor?channel=1&subtype=0" --fullscreen --no-video-title-show

exit

Issue is now solved with your code. Thanks so much for posting. It opens up VLC and streams camera 1, etc. That is the desired outcome.

Issue closed......
 
  • Like
Reactions: TonyR