ExRTMP
View SourceRTMP server and client library for Elixir.
Installation
The package can be installed by adding ex_rtmp to your list of dependencies in mix.exs:
def deps do
[
{:ex_rtmp, "~> 0.4.1"}
]
endEnhanced RTMP
Enhanced RTMP is supported to some extent, there's a lack of support for Multitrack and ModEx packet types for audio and video.
Usage
See the examples folder.
save_to_flv.exs
A client publish to an RTMP server and the server stores into flv file.
To publish a stream to the server use ffmpeg:
ffmpeg -re -i input_file.mp4 -c:v copy -c:a copy -f flv rtmp://localhost:1935/live/test
send_mp4.exs
The server stream an mp4 file to connected clients. The mp4 file must have AAC audio and H264/AVC video.
To start the server:
elixir examples/send_mp4.exs "input_file.mp4"
and to play the stream, you can use vlc or ffplay:
ffplay -i rtmp://localhost:1935/live/test
read_to_flv.exs
A client connects to an RTMP server and saves the stream into an flv file.
elixir examples/read_to_flv.exs "rtmp://localhost:1935/live" test output.flvpublish_mp4.exs
A client publishes an mp4 file to an RTMP server.
elixir examples/publish_mp4.exs "input_file.mp4"