How take the HLS stream as input and provide the RTMP stream as output with scaling?

It’s very easy just to follow the steps.

Ingest the HLS stream → then map video stream from the input HLS stream → Scale it → Transcode it to RTMP.
Now, to ensure correct mapping from the HLS stream, first, check the index of each stream with
ffprobe -show_streams hls_url command.

Must checkout: How to create an RTMP proxy server