VLC – multicast sender vbscript

To start VLC as a multicast sender I wrote a simple vbscript. It checks the folder “d:\movies”and shows all files included in a input box and tries to start vlc with the selected source file.

I downloaded some Free Movies to do my multicast testing.

After starting the Script a popup appears:

vbscript vlc multiast - select movie

 

After choosing the correct file VLC gets started on and the movie is streamed on multicast address  239.1.2.3 Port 5044. To change this modify: “strMultiCast”

Further modify the VLC program folder: “strVLCPlayer = “C:\Program Files (x86)\VideoLAN\VLC\vlc.exe””

The movie folder can be changed on: “objStartFolder = “D:\Movies””

To verify the functionality I have started a second VLC on a second machine and entered: “239.1.2.3:5004”

 VLC - Open network stream

VLC - Open network media

 Script:

option explicit

' Set all variables
Dim objFSO
Dim objStartFolder
Dim intArrayLength
Dim arrFileList()
Dim strSelectMovie
Dim intCount
Dim objFolder
Dim colFiles
Dim objFile
Dim strFileList
Dim WshShell
Dim strVLCPlayer
Dim strMultiCast
Dim intTTL

' pre dedefine variables and objects
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "D:\Movies"
intCount = 0
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
set WshShell=CreateObject("WScript.Shell")
strVLCPlayer = "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
strMultiCast = "239.1.2.3,port=5004"
intTTL = 12

' Create  array of movie folder and prepeare output for the inputbox
For Each objFile in colFiles
	ReDim Preserve arrFileList(intCount)
	arrFileList(intCount) = objFile.Name
	strFileList =  strFileList & vbCRLF & intCount & " " & objFile.Name
	intCount = intCount + 1
Next

' get maxlength of the array plus 1
intArrayLength = UBound(arrFileList)+1

' loop until the input is one of the shown objects in the array
Do
' select one of the movie files
strSelectMovie = Inputbox("Select a Movie" & strFileList)

' check if the entry is numberic 
If IsNumeric(strSelectMovie) Then
' check if the entered number is a valid movie in the array
	If Cint(strSelectMovie) < CInt(intArrayLength) then
		Wscript.Echo arrFileList(strSelectMovie)
		WshShell.run  """" & strVLCPlayer & """" & " " & """" & objStartFolder & "\" &  arrFileList(strSelectMovie) & " " & """" & " --ttl=" & intTTL & " -L --sout=#duplicate{dst=rtp{mux=ts,dst=" & strMultiCast & "},dst=display}"  & """"
		else
		MsgBox("Wrong entry, please try again")
	End If
else
	MsgBox("Wrong entry, please try again")
	strSelectMovie = "12000"
End If

Loop Until Cint(strSelectMovie) < CInt(intArrayLength)

UPDATE1: TTL value for MC streams added

5 comments for “VLC – multicast sender vbscript

  1. January 28, 2015 at 13:04

    Please let me know if the code for multicast receiver can be provided.

    • phil
      February 12, 2015 at 07:58

      currently I do not have a receiver script created. But I will try to create one as well as a modified version of the initial script. The question to play all files is a valid one. 🙂

    • phil
      April 30, 2015 at 11:37

      There is no speciuallity to receive a multicast either you use the command line such as described here or just open the gui and “open Media” -> Network -> rtds://:“. I will try to look up the command line and post it later.

  2. brian
    January 31, 2015 at 19:51

    Great script. Was wondering if you know what to change in the script so it streams all files in the specified folder? Instead of selecting one file.

    • phil
      February 12, 2015 at 07:59

      currently one video runs in an invinite loop. right now I did not think about playlits, cause created it for my CCIE studies with multicast and I had one movie in three different qualities. Wen I do have the time i will have a look on the playlist thing.

Leave a Reply

Your email address will not be published. Required fields are marked *