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.
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
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
Make sure the audio rate is suported. The FLV
video format only supports sample rates of 11025, 22050, and 44100.
-ar 44100
The ffprobe
shows an unsupported stream Stream #0:1: Data: none
. Use map
to skip it:
-map 0:0 -map 0:2
(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://...