Skip to content

Instantly share code, notes, and snippets.

@TroyKomodo
Created December 18, 2020 12:00
Show Gist options
  • Save TroyKomodo/1155456b02f1a02ac8691b1d7061393f to your computer and use it in GitHub Desktop.
Save TroyKomodo/1155456b02f1a02ac8691b1d7061393f to your computer and use it in GitHub Desktop.
Dual audio channel RTMP
ffmpeg -i "srt://127.0.0.1:5000/live?mode=listener" -filter_complex "[0:1]channelsplit=channel_layout=stereo[a1l][a1r];[0:1]channelsplit=channel_layout=stereo[t1][t2];[0:2]channelsplit=channel_layout=stereo[a2l][a2r];[a1l][a1r][t1][t2][a2l][a2r]join=inputs=6:channel_layout=5.1[a]" -c:a aac -c:v copy -map 0:v -map [a] -f flv rtmp://127.0.0.1:5001
ffmpeg -i -listen 1 rtmp://127.0.0.1:5001 -filter_complex "channelsplit=channel_layout=5.1[FL][FR][FC][LFE][BL][BR];[FL][FR]join=inputs=2:channel_layout=stereo[a1];[BL][BR]join=inputs=2:channel_layout=stereo[a2];[LFE][FC]join=inputs=2:channel_layout=stereo[a3]" -map "[a1]" -map "[a2]" -map 0:v out.mp4 -map "[a3]" -f null -
Produces an MP4 file with 2 audio tracks after being sent via the RTMP protocol.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment