For people who love technology, there is a challenge to live in a developing country being middle class living out of the city, let me tell you a little story.
I’m an independent developer, I build all kinds of web apps for many clients in all the spectrum, from the big brands to the most unknown businesses, I like what I do and I like being my own boss.
I’m also very vocal about technologies, I share my code freely on GitHub, WordPress Plug-in directory, etc. and my knowledge on Stack Overflow, forums, IRC channels and of course, giving free workshops, talks and media appearances on any college or news outlet who invite me to share about technology. For this reason, some friends and brands sometimes give me some new products to try them out and give a review, I do it for free because again, I love technology.
A friend of mine has recently give me an early access to a 360 camera prototype, and let me tell you, it was awesome. I expended a whole weekend recording some interesting places in Guatemala and then, processing and editing some videos, but at the end of the process I have to upload those videos to YouTube in order to share my results to the world, but I only have 1Mbps upload connection.
Here in Guatemala most ISPs use ADSL technology, and that technology can only achieve 1Mbps for upload, let a part the fact that my home/office is too far from the closest DSLAM which leave me with the maximum of 5Mbps for download and just 1Mbps for upload. Of course there are other ISPs and other service plans and technologies, but in the town I live most ISPs don’t want to invest on doing all the wiring and installing all the required equipment just for one client, there are some ISPs that can do all the work but want to charge me all the expenses, go figure.
So I’m stuck with just 1Mbps for upload, it is functional but unusable for 720p/HD video streaming and file uploads take days to be completed and make the whole connections unstable because of the upstream consumption.
The other factor that messes with my connections is stability, I don’t know why (and believe me, I have asked a lot) the internet comes and goes, trying to upload a video bigger than 100MiB to YouTube is an impossible task, but I have found a solution for that, which is the main theme of this post…
…Surviving with a third world internet connection.
I have a web hosting account in the US which has SSH/FTP access, which means I can upload files using a common FTP client where I can pause and resume any upload anytime, or resume an interrupted upload, so I upload my YouTube videos first to my hosting server, it takes some time but I can limit the bandwidth consumption to be able to use the internet when uploading a video, it also helps me survive any network or power surge, both happens a lot.
Having a remote SSH terminal access enables me to run almost any kind of script, code or GNU/Linux binary, the account is restricted to some degree but it can run many things without trouble, one of them is Python. Being able to run Python helps to run some 3rd party libraries, like the YouTube API for video uploads, so after uploading a video from my PC to my host I’m able to then upload the video on my remote US host to YouTube running this script:
Because my remote US host machine is for web hosting purposes it has a great bandwidth so it takes just seconds for a video to be uploaded to YouToube.
Going back to my story about the 360 videos, after editing and injecting the 360 metadata to my videos I ended with 2GiB of data to upload, that would take 5 hours to upload using my entire upload bandwidth, I can’t do that, so I ask a friend who work on a huge IT company here if he can upload my files to my FTP, he agreed and luckily the file where uploaded in matter of minutes, that afternoon I proceeded to remotely upload the videos to YouTube and after half an hour I was able to see the videos online, to the surprise that one of the videos had crappy audio quality.
I recorded a fountain which makes a high frequency noise that was really bad encoded by YouTube, I guess that the audio encoder uses some kind of noise reduction that removes this high frequencies leaving an awful fill with artifacts, so I had to remove these high frequencies myself and then re-upload the whole video again… no way.
I though of a solutions to avoid uploading the whole thing again, but first I have to check if there was a CLI tool for 360 metadata injection, so after googling I found a one, my solution was to edit the audio locally, remove the high frequencies, encode the audio, then upload only the audio and using FFmpeg, remux the already uploaded video with the new audio, re-inject the 360 metadata on the remote terminal and then upload the video from my remote host to YouTube…
I don’t know if sounds too complex but waiting 5 hours to re-upload a video wasn’t something I was willing to do, so here are my steps on my remote server:
First, I cloned the Spatial Media repo from GitHub to my remote server:
Then, using FFmpeg I remuxed the video with the new audio:
ffmpeg -i video.mp4 -an -vcodec copy without_audio.mp4
ffmpeg -i without_audio.mp4 -i new_audio.m4a -vcodec copy -acodec copy with_new_audio.mp4
Of course I could do this in just one step, but just to be sure, I muxed just a video track without the other audio tracks, then I injected the file with its 360 metadata:
python /path/to/spatial-media/spatialmedia \
And after that I uploaded the video with the same Python library I use always:
python upload_video.py \
--title="My Video Title" \
--description="My video description" \
--keywords="some, keywords, for, my, video" \
So after all that in less than 20 minutes I had a video uploaded to YouTube instead of re-uploading 2GB of video having to wait 5 hours…
It took me more time to write this article, and if you want to know how much time it takes to live with this kind of internet connection, here is a little bandwidth calculator I coded, source code included:
Contribute to BandwidthCalc development by creating an account on GitHub.github.com
I know some day ISPs here will upgrade their service plans, I have waiting since 2008, I hope this story make you appreciate your internet connection speed.