I need a ffmpeg command to first feed a mp4 video into a RTMP output stream, then followed by a RTMP input subsequently; what should be the parameters to get it working?
You can do something like this:
ffmpeg -i intro.mp4 -i rtmp://second-input-server:port/input-id -filter_complex "concat=n=2:v=1:a=1[merged_video][merged_audio]" -map [merged_video] -map [merged_audio] -f flv rtmp://final-output:port/merged
- We are taking two inputs, one from a local file (
intro.mp4) and one using an rtmp address (
- We are using the
concatfilter here, specifying that it has 2 segments to concant (
n=2), each segment having 1 video (
v=1) and 1 audio stream (
- We are labelling the concatted streams as
merged_audio, and muxing them into
flvformat, before sending that to the output rtmp server (
This assumes that you have the two inputs having same number of streams (1 video and 1 audio), same frame rate, same dimensions etc. If you don't, you may need to add additional filters (e.g.
fps) and stream selectors (e.g.
[1:a:1]) above to first make the two streams have the same characteristics, before feeding those to the