Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Video Transcoding at Scale for ABC iview

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

Video Transcoding at Scale for ABC iview

ABC iview is a video on demand service from the Australian Broadcasting Corporation. In 2015, we built a new service in-house to handle transcoding for all of iview's content.

Metro is built on AWS, and uses FFmpeg, node.js and go components to transcode content quickly and cost-efficiently.

This talk was presented on August 4th 2016 at NDC Sydney.

Avatar for Daphne Chong

Daphne Chong

August 06, 2016

Other Decks in Technology

Transcript

  1. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  2. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  3. GXF, ABC1 Profile: - Renditions (6) - Crop - Normalise

    audio - Adjust ratio - Add watermark - GXF to MP4
  4. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  5. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  6. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  7. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  8. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  9. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  10. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  11. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  12. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  13. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  14. ./ffmpeg -i INPUT -c:v libx264 -filter_complex "[0:v]crop=720:576:0:32,yadif,scale=1024x576,setdar=16/9[ma in], [1:v]scale=54:-1[ovrl], [main][ovrl]overlay=main_w-overlay_w-47:main_h-overlay_h-44

    " -crf 22 -maxrate 1404k -bufsize 1500k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -g 50 -c:a libfdk_aac -b:a 96k -filter_complex "[0:a:0][0:a:1] amerge=inputs=2, dynaudnorm=f=500:g=31:p=0.82:m=30.0:r=0.0:s=0.0 [aout]" -ar 44100 -ac 2 -map 0:0 -map "[aout]" -movflags +faststart -threads 0 -y OUTPUT In reality, it looks like this
  15. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  16. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  17. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  18. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  19. Original length Time to produce rendition 60 min 7 min

    42 min Lowest (audio) Highest (1500k)
  20. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  21. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  22. SQS First in first out (FIFO) Single consumer per message

    Message has “visibility timeout” Adjustable visibility timeout
  23. DynamoDB Our use case was not optimal Manual aggregations Higher

    cost than expected Doesn’t scale automatically
  24. "ExampleLoadBalancer" : { "Type" : "AWS::ElasticLoadBalancing::LoadBalancer", "Properties" : { "AvailabilityZones"

    : [ "us-east-1a", "us-east-1b" ], "Listeners" : [ { "LoadBalancerPort" : "80", "InstancePort" : "8081", "Protocol" : "HTTP" } ] } }
  25. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  26. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  27. Scaling Considerations: AWS limitations AWS scaling metrics can be slow

    No automatic off switch Can’t choose instances to scale down (Instance protection now available)
  28. GXF, ABC1 Profile: - Renditions (2) - Crop - Normalise

    audio - Adjust ratio - Add watermark - GXF to MP4
  29. var autoscaling = new AWS.AutoScaling(...); var params = { AutoScalingGroupName:

    groupName, DesiredCapacity: capacity Some white text }; autoscaling.setDesiredCapacity(params, ...);
  30. var autoscaling = new AWS.AutoScaling(...); var params = { AutoScalingGroupName:

    groupName, DesiredCapacity: capacity Some white text }; autoscaling.setDesiredCapacity(params, ...);
  31. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  32. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  33. EC2 Instances: $34.31 EC2 (other): $ 4.24 RDS: $ 2.66

    S3: $ 1.65 SQS: $ 0.00 Total (USD): $42.86 Transcoding costs: 24 hrs
  34. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  35. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  36. GXF, ABC1 Profile: - Crop - Normalise audio - Adjust

    ratio - Add watermark - GXF to MP4
  37. 1. What is Transcoding? 2. Why build our own system?

    3. Architecture 4. Technology choices 5. Autoscaling transcoders 6. Costs 7. Future roadmap
  38. Q&A