Skip to content

Instantly share code, notes, and snippets.

@libraplanet
Last active December 2, 2015 16:31
Show Gist options
  • Save libraplanet/398bce24810d655cddf6 to your computer and use it in GitHub Desktop.
Save libraplanet/398bce24810d655cddf6 to your computer and use it in GitHub Desktop.
demux to Icecast2 from RTMP using ffmpeg on windows.
@SETLOCAL
@SET FFMPEG_HOME=C:\ffmpeg-20151130-git-7b11eea-win64-static\bin
@SET PATH=%FFMPEG_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 [icecast infomation]
@SET ICE_STREAM_MOUNT_POINT=mountpoint
@SET ICE_STREAM_NAME=stream name
@SET ICE_STREAM_DESCRIPTION=stream description
@SET ICE_STREAM_GENRE=genre
@SET ICE_STREAM_URL=(null)
@SET FORMAT=adts
@SET CONTENT_TYPE=audio/aac
@REM ----------------------------------------------------------------------------------------------
@REM call
@REM ----------------------------------------------------------------------------------------------
@REM [args]
@SET COMMAND_ARGS=
@SET COMMAND_ARGS=%COMMAND_ARGS% -re -i "%RTMP_URL% live=1"
@SET COMMAND_ARGS=%COMMAND_ARGS% -vn -acodec copy -f %FORMAT%
@SET COMMAND_ARGS=%COMMAND_ARGS% -ice_name "%ICE_STREAM_NAME%"
@SET COMMAND_ARGS=%COMMAND_ARGS% -ice_description "%ICE_STREAM_DESCRIPTION%"
@SET COMMAND_ARGS=%COMMAND_ARGS% -ice_genre "%ICE_STREAM_GENRE%"
@SET COMMAND_ARGS=%COMMAND_ARGS% -ice_public "1"
@SET COMMAND_ARGS=%COMMAND_ARGS% -ice_url "%ICE_STREAM_URL%"
@SET COMMAND_ARGS=%COMMAND_ARGS% -content_type "%CONTENT_TYPE%"
@SET COMMAND_ARGS=%COMMAND_ARGS% icecast://%ICE_USER%:%ICE_PASS%@%ICE_SERVER%:%ICE_PORT%/%ICE_STREAM_MOUNT_POINT%
@REM [call]
@ffmpeg %COMMAND_ARGS%
@ENDLOCAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment