Assuming your copy of FFmpeg includes something like the rtmpprotocols listed in ffmpeg -protocols, you should do this using a splitvideo filter. The whole command will look something like this:
ffmpeg -i input.mp4 <video options> -filter split rtmp://server[:port][/app] out.mp4
source
share