How to restream a m3u8 stream to YouTube/Facebook with FFmpeg
Whilst it’s not common if you want to restream a m3u8 source and view through YouTube here is the way to do it with FFmpeg.
You need to have the m3u8 link and FFmpeg, this method is usually used on a server and then you can view a location blocked m3u8 stream on YouTube (Smart tv).
The FFmpeg batch scripts is:
ffmpeg -re -i https://streamsite.com/stream/streamsource.m3u8 -c:v copy -c:a aac -ar 44100 -ab 128k -ac 2 -strict -2 -flags +global_header -bsf:a aac_adtstoasc -bufsize 2500k -f flv rtmp://a.rtmp.youtube.com/live2/YOUTUBESTREAMKEYHERE
This FFmpeg command copies the m3u8 link and connects to YouTube and streams it live. We are not encoding it, just passing it through to YouTube. The audio defines are just common values and the buffersize is the amount of buffer given.
The only things you need to change unless you wanna play around with audio variables are
https://streamsite.com/stream/streamsource.m3u8 to your actual m3u8 stream url
Put your YouTube live stream key to rtmp://a.rtmp.youtube.com/live2/YOUTUBESTREAMKEYHERE where it says YOUTUBESTREAMKEYHERE
Run the batch script and it will start streaming. Do note if you’re streaming copyrighted content to put the stream unlisted / private.
Thats how to restream or pass on a m3u8 stream to YouTube with FFmpeg.
i use your command on my ubuntu server, ffmpeg installed but the command do nothing, but if i used for youtube stream eveythink OK, just error for facebook live stream
The command for streaming for Facebook is something like that:
Hope it help 🙂