Home > other >  mapping 3 or more outputs on ffmpeg command
mapping 3 or more outputs on ffmpeg command

Time:12-06

I am using this below command to stream on multiple output it works fine till 2 outputs but when I added third output it's giving an error-

command for 2 output-

ffmpeg_stream = 'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080  -i :122 -f alsa -i pulse -ac 2 -c:a aac -b:a 64k -threads 0 -flags  global_header -c:v libx264 -pix_fmt yuv420p -s 1920x1080 -threads 0 -f tee -map 0:0 -map 1:0 "[f=flv]rtmps://live-api-s.facebook.com:443/rtmp/stream_key|[f=flv]rtmp://a.rtmp.youtube.com/live2/stream_key"'

command for 3 outputs-

ffmpeg_stream = 'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080  -i :122 -f alsa -i pulse -ac 2 -c:a aac -b:a 64k -threads 0 -flags  global_header -c:v libx264 -pix_fmt yuv420p -s 1920x1080 -threads 0 -f tee -map 0:0 -map 1:0 -map 2:0 "[f=flv]rtmps://live-api-s.facebook.com:443/rtmp/stream_key|[f=flv]rtmp://a.rtmp.youtube.com/live2/stream_key|[f=flv]rtmp://play.stream.some_domain/stream/i48b-rdq0-jwme-2yj0"'

error-

liveStreaming   | Invalid input file index: 2.

Thank you

CodePudding user response:

-map is used to add input streams for output. You have only 2 inputs. For the 3rd output using tee, you just need to add it inside the output URL like you already did. Remove -map 2:0

ffmpeg_stream = 'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080 -i :122 -f alsa -i pulse -ac 2 -c:a aac -b:a 64k -threads 0 -flags global_header -c:v libx264 -pix_fmt yuv420p -s 1920x1080 -threads 0 -f tee -map 0:0 -map 1:0 "[f=flv]rtmps://live-api-s.facebook.com:443/rtmp/stream_key|[f=flv]rtmp://a.rtmp.youtube.com/live2/stream_key|[f=flv]rtmp://play.stream.some_domain/stream/i48b-rdq0-jwme-2yj0"'

  • Related