본문 바로가기

Cloud AWS

Amazon AWS :: Cloudfront로 HLS 스트리밍 구성하기


 

다루는 내용

  • 아마존 Elastic Transcoder로 multiple bit-rate 트랜스코딩하기
  • 아마존 CloudFront로 multi bit-rate 스트리밍하기

실습
원본 준비

  1. S3에 버킷 생성 : cfarang
  2. cfarang 버킷에 input 폴더 생성
  3. input 폴더에 소스 파일 업로드
    실습에서는 윈도우 비디오 라이브러리에 있는 샘플 파일을 이용한다.

아마존 CloudFront 설정
CloudFront Distribution 생성

  1. 콘솔에서 CloudFront 클릭
  2. Create Distribution 클릭
  3. Web 섹션의 Get Started 클릭
  4. Origin Settings 섹션
    ∙ Origin Domain Name : cfarang.s3.amazonaws.com
    ∙ Restrict Bucket Access : Yes
    ∙ Origin Access Identity : Create a New Identity
    ∙ Grant Read Permissions on Bucket : Yes, Update Bucket Policy
    S3 버킷에 bucket policy (접근 권한) 설정을 따로 하지 않아도 자동으로 업데이트 한다.

    ∙ Create Distribution 클릭

아마존 Elastic Transcoder 설정
Pipeline 생성
원본으로 사용되는 S3와 Elastic Transcoder가 같은 리전(Region)인지 확인한다.

  1. 콘솔에서 Elastic Transcoder 클릭
  2. Create a new Pipeline 클릭
  3. Create New Pipeline 섹션
    ∙ Pipeline Name : pipeline lab
    ∙ Input Bucket : cfarang
    ∙ IAM Role : Create console default role
  4. Configuration for Amazon S3 Bucket for Transcoded Files and Playlists 섹션
    ∙ Bucket : cfarang
    ∙ Storage Class : Standard
  5. Configuration for Amazon S3 Bucket for Thumbnails 섹션
    ∙ Bucket : cfarang
    ∙ Storage Class : Reduced Redundancy
    ∙ Create Pipeline 클릭

Job 생성

  1. Create New Job 클릭
  2. Create a New Transcoding Job 섹션
    ∙ Pipeline : pipeline lab 선택
    ∙ Input Key : input/Wildlife.wmv 선택
    ∙ Output Key Prefix : output/ 입력 (S3에 폴더가 자동 생성된다.)
  3. Output Details 섹션
    2Mbps, 1.5Mbps, 1Mbps 3가지 멀티 비트레이트로 트랜스코딩한다.
    ∙ Preset : System preset : HLS 2M
    ∙ Segment Duration : 10
    ∙ Output Key : HLS20M
    + Add Another Output 클릭
    ∙ Preset : System preset : HLS 1.5M
    ∙ Segment Duration : 10
    ∙ Output Key : HLS15M
    + Add Another Output 클릭
    ∙ Preset : System preset : HLS 1M
    ∙ Segment Duration : 10
    ∙ Output Key : HLS10M
  4. Playlist 섹션
    각 Output에 해당하는 Playlist를 생성한다.
    ∙ Master Playlist Name : master20
    ∙ Playlist Format : HLSv3
    ∙ Output in Master Playlist : HLS20M 선택
    + Add Playlist 클릭
    ∙ Master Playlist Name : master15
    ∙ Playlist Format : HLSv3
    ∙ Output in Master Playlist : HLS15M 선택
    + Add Playlist 클릭
    ∙ Master Playlist Name : master10
    ∙ Playlist Format : HLSv3
    ∙ Output in Master Playlist : HLS10M 선택
    ∙ Create New Job 클릭

트랜스코딩 결과 파일 확인
트랜스코딩이 완료되면 S3의 output 폴더에 HLS10M.m3u8, HLS10M00000.tx, master10.m3u8 등이 생성된다.
    ∙ master10.m3u8
    
    ∙ HLS10M.m3u8
    

다이나믹 스트리밍 재생 확인
재생 URL
    http://<CloudFront Domain Name>/<master plalist file path>
예. http://dio391fb2zbrl.cloudfront.net/output/master10.m3u8

재생 테스트    

  1. 윈도우 미디어 플레이어
    ∙ 메뉴 à 파일 à URL 열기
    ∙ URL 입력
  2. JW 플레이어
    ∙ http://www.jwplayer.com/blog/delivering-hls-with-amazon-cloudfront/
  3. 기타 HLS 재생 가능 플레이어
    ∙ IOS, Android 등 모바일에서 재생 가능하다.

참고

Arang

Sr. Technical Trainer at GSNeotek