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

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago