Categories: Development

How to restream a m3u8 stream to YouTube 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.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

3 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

3 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

3 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

3 years ago