upstandfm / audio-transcoder

Convert audio into different formats.
Other
5 stars 1 forks source link

Compare FFmpeg with Elastic Transcoder (performance + pricing) #6

Closed danillouz closed 4 years ago

danillouz commented 4 years ago

I used a 3 minute audio recording (WebM) of 1.1MB to trigger some transcoding jobs.

danillouz commented 4 years ago

AWS Elastic Transcoder

AWS outputs the transcoding time in the console.

Run Time
1 6,185 sec
2 6,211 sec
3 6,877 sec
danillouz commented 4 years ago

FFmpeg + Lambda

Used the CloudWatch logs to extract the Lambda execution time, while using different Lambda memory configurations:

128 MB

Run Duration Billed duration
1 38,333 ms 38,400 ms
2 38,019 ms 38,100 ms
3 37,102 ms 37,100 ms

256 MB

Run Duration Billed duration
1 20,530 ms 20,600 ms
2 19,113 ms 19,200 ms
3 18,992 ms 19,000 ms

512 MB

Run Duration Billed duration
1 10,017 ms 10,100 ms
2 9,351 ms 9,400 ms
3 9,312 ms 9,400 ms

1024 MB

Run Duration Billed duration
1 4,912 ms 5,000 ms
2 4,763 ms 4,800 ms
3 4,611 ms 4,700 ms

2048 MB

Run Duration Billed duration
1 2,890 ms 2,900 ms
2 2,705 ms 2,800 ms
3 2,679 ms 2,700 ms

3008 MB (max)

Run Duration Billed duration
1 2,828 ms 2,900 ms
2 2,485 ms 2,500 ms
3 2,608 ms 2,700 ms
danillouz commented 4 years ago

These are not very extensive benchmarks, but IMHO good enough to see the trend where transcoding audio becomes twice as fast, while doubling Lambda memory, up to 2 GB.

This means the best memory setting for the FFmpeg Lambda is 2048 MB.

danillouz commented 4 years ago

AWS Elastic Transcoder

In terms of costs, AWS Elastic Transcoder is quite expensive (compared to Lambda).

For EU Ireland, we pay $0,00522 per minute of transcoded audio. Where we get 20 minutes for free every month in the free tier.

Note that the AWS Elastic Transcoder pipeline and S3 buckets have to be in the same region to avoid data transfer costs.

Cost example

To transcode 100 000 audio files of 3 minutes each, takes: 100 000 * 6.4 sec avg transcoding time = 640 000 sec = 10666,666666667 min transcoding time

$0,00 522 * 10666,666666667 = $55,68

danillouz commented 4 years ago

FFmpeg + Lambda

For Lambda, the cost depends on the memory setting and execution duration (GB/s).

For EU Ireland 1 GB/sec costs $0,000 00 1667.

Note that since the S3 buckets and Lambdas run in the same region, we avoid (S3) data transfer costs.

Cost example

To transcode 100 000 audio files of 3 minutes each we pay:

Without free tier we pay: 600 000 GB/sec $0,000 00 1667 GB/sec = $1,0002 (holy sht!) (With free tier we pay: 600 000 - 400 000 GB/sec * $0,000 00 1667 GB/sec =  $0,3334)

😅💰💪