Skip to content

libvlc.Medium.AddOption

Andrew Lambert edited this page Nov 26, 2022 · 12 revisions

libvlc.Medium.AddOption

Method signature

 Sub AddOption(Options As String, Flags As UInt32 = 0)

Remarks

This method is used to apply advanced reading/streaming options to a single Medium object. These are VLC command-line options that change what libvlc will do when the Medium is played with a VLCPlayer. These options can, for example, transcode media from one format to another and then write output into a file instead of playing the media to the user.

Example

This example creates a Medium from an ogg/vorbis audio file, and then uses AddOption to instruct libvlc to transcode the audio stream into an MP3 file rather than playback normally:

  Dim m As libvlc.Medium = GetFolderItem("C:\example\music.ogg")
  m.AddOption(":sout=#transcode{acodec=mp3,ab=128,channels=2,samplerate=44100}:std{access=file,mux=raw,dst=""C:\example\music.mp3""}")
  Dim player As New VLCPlayer
  player.Media = m
  If Not player.Play() Then MsgBox("Unable to transcode!")
  Do Until Not player.IsPlaying
    App.YieldToNextThread
  Loop

See also

Clone this wiki locally