How to run a 24/7 Ant media server live stream and keep network transfer usage low?
If I am running an Ant Media Server to host a 24/7 YouTube live stream, how can I make sure that I'm not going over the monthly network transfer limit? If I do go over the limit and receive an Outbound Transfer limit warning email, what are my next steps?
2 Replies
So the first thing to note is that each Linode plan comes with a certain amount of Network Transfer each month. This amount is pro-rated as well. This means that a Linode created in the middle of the month would only have about half the monthly network transfer available. So for example a 1GB Nanode plan (which comes with 1TB for the month) would have around 500GB of network transfer available if created mid-month. If a plan is active for an entire month then it will have access to the entire plan's network transfer.
In terms of the streaming content itself, you want to make sure that you're not running large resolution files. In my testing I was consuming around 10 mb/s for a 4k video stream. I then added a second 4k stream the usage went up to 20 mb/s. Had I not made changes I would have gone over my plan's network transfer limit. What I did was re-render my videos to be 480p, and then started both streams again. Since this change the output for both streams has been consistently 4.03 mb/s. I'm running my Ant server on a 2GB Linode plan, which comes with 2TB of transfer and I should be at around 1.3 or 1.4 TB usage for the whole month. This includes the time that I was running the servers initially at 20mb/s, though they only ran like that for about a day.
So what happens if you go over your plans network transfer limit? You are billed at $0.01/GB (or $10/TB) and is it charged at the end of the billing period. Please note that a Linode account shares it's Network pool with all Linodes. This means that if you have multiple Linodes on your account the network transfer will be shared between Linodes.
Generally speaking the math between upgrading your plan vs paying for the overages is about the same. So if you're concerned that you'll need more you could either upgrade to a different plan or pay the overage. Before committing to that though I would encourage you to look at the size and resolution of your videos/media. In my experience the smaller you make them the less transfer you'll use. Take another look at any Youtube 24/7 stream, you'll see that the quality is usually pretty low like 480p.
If you want to resize the video via the command line, you can use ffmpeg. You'll first need to install it onto your system, but then you can use it to re-process the video.
The exact syntax for resizing or cropping may vary, but these two articles show examples on what the syntax looks like.