Skip to content

Instantly share code, notes, and snippets.

@libraplanet
Created December 1, 2015 14:51
Show Gist options
  • Save libraplanet/393cf951c161b542c8a3 to your computer and use it in GitHub Desktop.
Save libraplanet/393cf951c161b542c8a3 to your computer and use it in GitHub Desktop.
transcode to Icecast2 from RTMP using vlc.
@SETLOCAL
@SET VLC_HOME=C:\Program Files (x86)\VideoLAN\VLC
@SET PATH=%VLC_HOME%;%PATH%
@REM ----------------------------------------------------------------------------------------------
@REM settings
@REM ----------------------------------------------------------------------------------------------
@REM [input rtmp url]
@SET RTMP_URL=rtmp://****/****/****
@REM [output icecast server]
@SET ICE_SERVER=localhost
@SET ICE_PORT=8000
@SET ICE_USER=source
@SET ICE_PASS=huckme
@REM [output icecast quality]
@SET ICE_SAMPLE_RATE=44100
@SET ICE_BIT_RATE=128
@SET ICE_MUX_CACHE=10000
@REM [icecast infomation]
@SET ICE_STREAM_MOUNT_POINT=moutpoint
@SET ICE_STREAM_NAME=name
@SET ICE_STREAM_DESCRIPTION=description
@SET ICE_STREAM_GENRE=genre
@SET ICE_STREAM_URL=(null)
@REM ----------------------------------------------------------------------------------------------
@REM sout setting
@REM ----------------------------------------------------------------------------------------------
@SET VLC_SOUT_TRANSCODE=vcodec=none,acodec=mp3,ab=%ICE_BIT_RATE%,channels=2,samplerate=%ICE_SAMPLE_RATE%
@SET VLC_SOUT_STD=access=shout,mux=mp3,dst=%ICE_USER%:%ICE_PASS%@%ICE_SERVER%:%ICE_PORT%/%ICE_STREAM_MOUNT_POINT%
@SET VLC_SOUT="#transcode{%VLC_SOUT_TRANSCODE%}:std{%VLC_SOUT_STD%}"
@REM ----------------------------------------------------------------------------------------------
@REM call
@REM ----------------------------------------------------------------------------------------------
@REM [args]
@SET COMMAND_ARGS=
@SET COMMAND_ARGS=%COMMAND_ARGS% -vvv "%RTMP_URL%"
@SET COMMAND_ARGS=%COMMAND_ARGS% --no-sout-video
@SET COMMAND_ARGS=%COMMAND_ARGS% --sout "%VLC_SOUT%"
@SET COMMAND_ARGS=%COMMAND_ARGS% --sout-keep
@SET COMMAND_ARGS=%COMMAND_ARGS% --sout-mux-caching "%ICE_MUX_CACHE%"
@SET COMMAND_ARGS=%COMMAND_ARGS% --sout-shout-mp3
@SET COMMAND_ARGS=%COMMAND_ARGS% --sout-shout-name="%ICE_STREAM_NAME%"
@SET COMMAND_ARGS=%COMMAND_ARGS% --sout-shout-description="%ICE_STREAM_DESCRIPTION%"
@SET COMMAND_ARGS=%COMMAND_ARGS% --sout-shout-genre="%ICE_STREAM_GENRE%"
@SET COMMAND_ARGS=%COMMAND_ARGS% --sout-shout-url="%ICE_STREAM_URL%"
@SET COMMAND_ARGS=%COMMAND_ARGS% --loop
@REM [call]
@START vlc.exe %COMMAND_ARGS%
@ENDLOCAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment