I have a use case where I have an input HLS stream that needs to be scaled down in size and passed to the RTMP stream as output. FFmpeg seems the right tool for it but I don’t know how to do it with FFmpeg.
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
Great! Is there any way to check whether my task is accomplished or not? Any command for that?
yes, to do this use the following command, then assume the HLS stream has only one video and audio stream for simplicity.
ffmpeg -i hls_url -map 0:v:0 -map 0:a:0 -vf scale=1280:720 -c:v libx264 -c:a libmp3lame 23 -f flv rtmp://test.out/out
Not worked for me
Actually, the above command is wrong here is the correct command.
The user forgot to mention the crf
before 23 -f
that’s why you got an error. Try out the below command and let me know if this works for you or not.
ffmpeg -i hls_url -map 0:v:0 -map 0:a:0 -vf scale=1280:720 -c:v libx264 -c:a libmp3lame -crf 23 -f flv rtmp://test.out/out