FFMPEG pushed RTMP stream not working on Android & iPhone

后端 未结 3 1517
温柔的废话
温柔的废话 2021-02-13 00:07

I have to make a semi-live-stream. I used Nginx-rtmp module and then pushed content to it via ffmpeg using:

ffmpeg -re -i content.mp4 -r 25 -f fvl \"rtmp://rtmp.         


        
3条回答
  •  攒了一身酷
    2021-02-13 00:24

    1. Your input video uses H.264 with a high profile.

      If you want compatibility with both iOS and Android you must use the baseline profile. Newer iPhones support the main and high profiles but the Android documentation only mentions baseline:

      -c:v libx264 -profile baseline

    2. Don't use the native aac as audio codec, use libfdk_aac since it's the highest quality encoder available for FFmpeg and it will help you produce a valid AAC stream:

      -c:a libfdk_aac

    3. Make sure the audio rate is suported. The FLV video format only supports sample rates of 11025, 22050, and 44100.

      -ar 44100

    4. The ffprobe shows an unsupported stream Stream #0:1: Data: none. Use map to skip it:

      -map 0:0 -map 0:2

    5. (MPEG-TS only) If you use a .ts file as input make sure to remove the AAC ADTS header:

      -bsf:a aac_adtstoasc

    Eg:

    ffmpeg -re -i content.mp4 -map 0:0 -map 0:2 -c:v libx264 -vprofile baseline -preset ultrafast -tune zerolatency -r 25 -pix_fmt yuv420p -c:a libfdk_aac -ac 2 -ar 44100 -f flv rtmp://...
    

提交回复
热议问题