January 14, 2009

VLC TIPS

To do one-way streaming of a MP3 file:

vlc test.mp3 --mtu=120 :sout="#duplicate{dst=std{access=udp,dst=192.168.100.5:1234}}"

or simple version:
vlc test.mp3 --sout udp:192.168.100.5:1234

To use non-GUI interface

vlc -I rc test.mp3 --mtu=120 :sout="#duplicate{dst=std{access=udp,dst=192.168.100.5:1234}}"

To hear the music:
vlc udp://@192.168.100.5
or
vlc udp://@
or
vlc udp://@:1234 (1234 is the default port)

VLC command line examples (test with version 0.9.8a)

Good Links
----------------
http://www.videolan.org/doc/streaming-howto/en/ch07.html
http://www.videolan.org/doc/play-howto/en/ch04.html
http://www.videolan.org/doc/streaming-howto/en/ch03.html (Command line module syntax)
http://www.videolan.org/streaming-features.html (Codec Matrix)


TO RECEIVE & PLAY
----------------------

To receive a UDP streaming on the 192.168.100.5 interface with a udp port of 3000

vlc udp://192.168.100.5:3000

a shorter version:

vlc udp://@:3000

If the udp port if the default port used by VLC (port 1234), this can be even shorter:

vlc udp://

To receive from a RTSP address, use:
vlc rtsp://URL

same goes for http, ftp or mms streaming url, and a SDP file.


TO STREAM
----------------------


syntax:
==============
vlc input_stream --sout "#module1{option1=parameter1{parameter-option1},option2=parameter2}:module2{option1=...,option2=...}:..."

You may also use the following syntax :
% vlc input_stream --sout-module1-option1=... --sout-module1-option2=... --sout-module2-option1=... --sout-module2-option2=... ...

The stream output also offers a simplified syntax, with which you can only you use the standard module main options:
% vlc input_stream --sout access/mux:url
where access, mux and url are as defined in the options of the -standard- module.

input_stream: any address usable by the RECEIVE&PLAY section above, so it can be RTP:// or HTTP:// or UDP:// ,etc

-I dummy
Disables the graphical interface
vlc://quit
Quit VLC after transcoding


Streaming Modules Discription
---------------------------------------

-- standard(std), allows to send the stream via an access output module: for example, UDP, file, HTTP, ... You will probably want to use this module at the end of your chains.

access=file/udp/http/https/rtp/mmsh
mux=ts/ps/mpeg1/ogg/asf/asfh/avi/mpjpeg
dst=filename/ipaddress:port/URL

-- transcode, is used to transcode (decode and re-encode the stream using a different codec and/or bitrate) the audio and the video of the input stream. If the input or output access method doesn't allow pace control (network, capture devices), this done "on the fly", in real time. This can require quite a lot of CPU power, depending on the parameters set. Other streams, such as files and disks are transcoded as fast as the system allows it.

vcodec=
vb=
venc=ffmpeg/theora/x264
fps=
deinterlace
scale=
width=
height=
acodec==
ab=
aenc=ffmpeg/vorbis/speex
samplerate=
channels=

-- duplicate, allows you to create a second chain, where the stream will be handled in an independent way.

dst= (Any of the stream output module described earlier, such as standard,transcode,etc can be used as parameter of this option)


-- display, allows you to display the input stream, as VLC would normally do. Used with the duplicate module, this allows you to monitor the stream while processing it.

-- rtp, streams over RTP (one UDP port for each elementary stream). This module also allows RTSP support.
dst=ipaddress
port=port number (must be an even number)
port-video= port number (must be an even number)
port-audio= port number (must be an even number)
mux= ,This option allows to set the encapsulation method used to send the stream. See mux= options of the standard module for a description of the available method. Only ts is possible for RTP streams. By default, each elementary stream is sent as a separate RTP media, i.e. no encapsulation is done.


Examples
---------------
-- To record from microphone and send out using udp
vlc --mtu=120 dshow:// :dshow-vdev="none" :dshow-adev="" :sout=#transcode{acodec=mp4a,ab=24,channels=1}:duplicate{dst=std{access=udp,mux=ts,dst=:1234}}

or
vlc --mtu=120 dshow:// :dshow-vdev="none" :dshow-adev="" :sout=#transcode{acodec=mp4a,ab=24,channels=1}:std{access=udp,mux=ts,dst=:1234}

or (record a-law wav file, somehow there is a lot of noise)
vlc dshow:// :dshow-vdev="none" :dshow-adev="" --dshow-audio-channels=1 --dshow-audio-samplerate=8000 --dshow-audio-bitspersample=8 :sout=#transcode{acodec=alaw,ab=64,channels=1}:std{dst=c:\temp\abc.wav,mux=wav,access=file}

-- To stream a wav file as G711 alaw. Note that VLC is sensitive to the input format. To stream G711, the input file has to be 8000 samples per second, 8bit.
vlc.exe c:\tools\record\national_anthem.wav --sout "#transcode{acodec=alaw,ab=64,scale=1,channels=1,ar=8000}:rtp{dst=192.168.100.40,port-audio=1250}"


3 comments:

  1. hi,
    i like this blog,,.. n very gud..
    but can u say how the command vil be if,the input is not a file its a strem from a ip(rtp,rtsp...etc).
    also how could be the output access??

    ReplyDelete
  2. Hi,

    Any thought of how to stream the line-in and/or microphone at the command line?

    I'm running Ubuntu and would like to present 2 mono inputs and present them as 2 mp3 or similar streams.

    I have been struggling to workout how to define the input at the command line.

    Any thoughts?

    ReplyDelete
  3. thanks for this blog. found it useful in my work.

    ReplyDelete