Ffmpeg 4 音频和 1 视频输入到 4 视频输出性能问题

Ffmpeg 4 audio and 1 video input to 4 video outputs performance issue

我已经创建了 4 个空接收器脉冲监视器并且工作正常。 当我将 4 输出发布到有噪音和停止的 rtmp 音频时。当使用 2 个输出时,它工作正常。 如果我将分辨率从 1920x1080 降低到 1280*720,它也能正常工作。 使用 4 个不同的音频输入和 1 个视频输入


SCREEN_WIDTH=1920
SCREEN_HEIGHT=1080
SCREEN_RESOLUTION=${SCREEN_WIDTH}x${SCREEN_HEIGHT}
COLOR_DEPTH=24
X_SERVER_NUM=2
VIDEO_BITRATE=3000
VIDEO_FRAMERATE=30
VIDEO_GOP=$((VIDEO_FRAMERATE))
AUDIO_BITRATE=160k
AUDIO_SAMPLERATE=44100
AUDIO_CHANNELS=1
#some codes here

ffmpeg -y\
  -hide_banner -loglevel error \
  -nostdin \
  -s ${SCREEN_RESOLUTION} \
  -r ${VIDEO_FRAMERATE} \
  -draw_mouse 0 \
  -f x11grab \
    -i ${DISPLAY} \
  -f pulse -i MySink1.monitor \
  -f pulse -i MySink2.monitor \
  -f pulse -i MySink3.monitor \
  -f pulse -i MySink4.monitor \
  -c:v libx264 \
    -pix_fmt yuv420p \
    -profile:v main \
    -preset veryfast \
    -minrate ${VIDEO_BITRATE} \
    -maxrate ${VIDEO_BITRATE} \
    -g ${VIDEO_GOP} \
    -map 0 -f flv -map 1  ${RTMP_URL1} \
  -c:v libx264 \
    -pix_fmt yuv420p \
    -profile:v main \
    -preset veryfast \
    -minrate ${VIDEO_BITRATE} \
    -maxrate ${VIDEO_BITRATE} \
    -g ${VIDEO_GOP} \
    -map 0 -f flv -map 2  ${RTMP_URL2} \
  -c:v libx264 \
    -pix_fmt yuv420p \
    -profile:v main \
    -preset veryfast \
    -minrate ${VIDEO_BITRATE} \
    -maxrate ${VIDEO_BITRATE} \
    -g ${VIDEO_GOP} \
    -map 0 -f flv -map 3  ${RTMP_URL3} \
  -c:v libx264 \
    -pix_fmt yuv420p \
    -profile:v main \
    -preset veryfast \
    -minrate ${VIDEO_BITRATE} \
    -maxrate ${VIDEO_BITRATE} \
    -g ${VIDEO_GOP} \
    -map 0 -f flv -map 4  ${RTMP_URL4} \````
    
I guess I need some performance issue. How can I add **tee** or use one decoded video in all outputs. 

使用tee muxer。简化示例:

ffmpeg \
  -f x11grab -framerate 30 -video_size 1920x1080 -i :0.0 \
  -f pulse -i MySink1.monitor \
  -f pulse -i MySink2.monitor \
  -f pulse -i MySink3.monitor \
  -f pulse -i MySink4.monitor \
  -map 0 -map 1 -map 2 -map 3 -map 4 \
  -c:v libx264 -vf format=yuv420p -maxrate 3000k -bufsize 6000k -g 60 -c:a aac -flags +global_header \
  -f tee "[select=\'v,a:0\':f=flv:onfail=ignore]${RTMP_URL1}|[select=\'v,a:1\':f=flv:onfail=ignore]${RTMP_URL2}|[select=\'v,a:2\':f=flv:onfail=ignore]${RTMP_URL3}|[select=\'v,a:3\':f=flv:onfail=ignore]${RTMP_URL4}"