I've been using an IPTV service that works great during the day, but at night it skips and stutters and buffers like crazy. It turns out the reason for this is to do with routing.
In Australia - specifically on the NBN - peak hour is usually between 3PM and 10PM, roughly when school kids start getting home and people get home from work and start their Netflix binge watching etc.
Most (if not all?) IPTV providers tend to have their servers in Europe. It seems like Germany is a popular choice for this. I have a 100mbps (megabit per second) connection at home and during off-peak I can get around 300 kilobytes per second which is 0.3mbps (0.3 megabit per second) and during peak time this plummets down to around 50kb/sec (kilobytes per second) or 0.05mbps (megabits per second) and this makes IPTV unwatchable.
After testing different speed tests from different locations, I've realised that Australia has a pretty consistent connection to the USA, in particular LAX and Miami during off-peak and even during peak times. It got me thinking about using that to my advantage to help with my IPTV situation.
How I fixed it
I decided that the best approach here would be to set up a VPS in an ideal location, run a proxy server on it and point VLC to that proxy server.
The first thing I did was set up a cheap VPS in Los Angeles. I chose to use this one for $8/year.
For better results and to be able to select different locations or change IP etc, I would recommend setting up a cheap VPS resource pool. This one is $19/year and lets you create up to 2 VPS in 4 locations in the USA (LA, Miami, New York and Chicago.
Once I had that set up, the next thing I did was set up a tiny proxy server, aptly named Tinyproxy.
Setting up Tinyproxy
I am setting this up on a Ubuntu 16.04 VPS, if you are using another distro then replace apt with yum/etc:
sudo apt update
sudo apt install tinyproxy
Tinyproxy is now installed, but it needs to be configured.
sudo nano /etc/tinyproxy.conf
We need to change a couple of things. First, the port. It defaults to 8080 which is very predictable and likely to result in your server being used by someone else. Change it to a random high port number that you will remember:
# Port: Specify the port which tinyproxy will listen on. Please note
# that should you choose to run on a port lower than 1024 you will need
# to start tinyproxy using root.
Secondly, by default, Tinyproxy is set to only allow access from the computer it's running on - not ideal in this case. Find the following lines and change it to look like this:
# Allow: Customization of authorization controls. If there are any
# access control keywords then the default action is to DENY. Otherwise,
# the default action is ALLOW.
# The order of the controls are important. All incoming connections are
# tested against the controls based on order.
Note I have placed a # in front of
Allow 127.0.0.1. By doing this I have made it accept all connections. It would be better to set up a rule to allow only a certain range, but for simplicity's sake I am leaving it like this.
As pointed out by Filip in the comments, doing this will open your proxy up to the world! It would be much safer to add your IP range or address in there. If you're not sure, find your IP by googling "what is my IP" and then put that instead of 127.0.0.1 and remove the # in front - if you have a dynamic IP this will be more complicated, so perhaps consider if this is something you're willing to do
Now that we've configured Tinyproxy, we need to restart tinyproxy.
systemctl restart tinyproxy
When the VPS comes back online it's all ready to go and Tinyproxy is waiting for us to use it.
Configure VLC Player
Finally, we need to configure VLC player to use this proxy when playing the videos.
Preferences and select the
Input/Codecs tab. Right down the bottom you will see
HTTP Proxy URL
Go ahead and put the IP of your VPS in there along with the port. For example
184.108.40.206:8080 making sure to replace the IP with your VPS IP and the port with the port you've chosen in the config file. Once that's in there, click
The moment of truth is upon us. Go ahead and try watching the IPTV stream that you usually have issues with, it's best to test it during off-peak time and as well as during peak time to be sure it's set up correctly.
And there we have it, we've got flawless* IPTV :)
*of course, other factors can come into play, but this will resolve issues related to routing.