Recently I have been trying to transcode 120+ videos to different versions of the same file. If you have visited jsecademy you will see that I’m using Wistia to host all of the current videos.
I decided that I need to switch over to Amazon S3 storage and I will need to convert the videos to different versions of the same video. The simplest and easiest way to go about doing this would be to use Amazon Elastic Transcoder service and just setup a couple of rules and be done with it.
Let’s do a bit of math to figure out how much it would cost me to transcode 120 videos.
On average most of the videos that I have to transcode are about 10 minutes in length.
That would be : 120 videos * 10 minutes * $0.015 Amazon’s fee = $18.00 USD
That’s how much it cost to go from 1080p => 720p. Just like most things in life that’s not going to be good enough, since some users might be on a mobile phone or might be using a slow internet connection, a couple of more conversions need to be in place.
$18.00 USD 1080p => 720p
$18.00 USD 720p => 480p
$18.00 USD 480p => 360p
The total of the services comes to $54.00
The answer is pretty straightforward, especially if you have a large set of videos that you need to process.
This entire blog post is about FFMPEG and Node.js why am I even bringing up Amazon Services? It just makes sense that if you are going to be building an application that is going to require a transcoding service for videos why not just use a tool that does it for you?
Since I don’t yet have hundreds of thousands of paying customers to JSecdemy, it doesn’t make much sense for me to start using amazon services. Instead, I just wrote a small little Node.js script that automates this entire process of transcoding the videos automatically.
Here is the script:
Don’t forget to create the folder that’s going to be holding your transcoded videos.
This exact script might not work for your own specific problem but it should give you a good starting point of how to go about using it for your own situation.
If you want to run the script just use the following command line arguments.
node process.js /location/of/videos 1 30
There you have it!
Talk to you soon,
I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More