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?

1 Answer 1


You can do something like this:

-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 (rtmp://second-input-server:port/input-id).
  • We are using the concat filter here, specifying that it has 2 segments to concant (n=2), each segment having 1 video (v=1) and 1 audio stream (a=1).
  • We are labelling the concatted streams as merged_video and merged_audio, and muxing them into flv format, before sending that to the output rtmp server (rtmp://final-output:port/merged).

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. scale, fps) and stream selectors (e.g. [0:v:0], [1:a:1]) above to first make the two streams have the same characteristics, before feeding those to the concat filter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.