티스토리 뷰

Tech/Tips

Http Live Streaming 관련

niu 2014. 1. 20. 19:17

* Http live streaming 이란

- 동영상 재생을 위한 프로토콜. 기본적인 VOD 재생외에도 Live 재생(중계)을 위한 용도로도 구성이 가능하다.

- m3u의 response data를 기준으로 차이점은 전체 영상 정보가 다 포함되어있느냐...

즉, m3u 마지막에 #EXT-X-ENDLIST로 끝나느냐 아니면 종료되지 않느냐의 차이로 VOD/LIVE가 구분됨

- ENDLIST가 없다면 Live로 인식하고 마지막 ts 다운로드 후 m3u를 재요청한다.

- 이때 index는 새로 요청한 m3u의 #EXT-X-MEDIA-SEQUENCE 정보를 참고하여 사용된다.

- hls 규격상 하나의 ts 내에는 1개 이상의 Intra frame이 있어야 한다.(안그럼 seek시에 오디오만 나옴)


* 다른 자료

- NAVER Blog

http://helloworld.naver.com/helloworld/7122

- IETF draft

http://tools.ietf.org/html/draft-pantos-http-live-streaming-11

- Apple Overview

https://developer.apple.com/library/ios/documentation/networkinginternet/conceptual/streamingmediaguide/Introduction/Introduction.html


* 간단하게 vod용 hls를 돌려보려면

- ffmpeg에서 바이너리를 받아서 : http://ffmpeg.org/download.html

- 아래 명령어를 통해 vod 영상에 대한 packetize 수행

ffmpeg -i sample.mp4 -c copy -map 0 -segment_time 1 -segment_list sample.m3u8 -vbsf h264_mp4toannexb -f segment sample-%d.ts


* Apple App 심사를 하면서의 이슈

- Apple Guideline에서 몇가지 태클이 들어옴.

https://developer.apple.com/appstore/resources/approval/guidelines.html

- 번역 : http://blog.naver.com/blueherald/120155315403

- 9. Media Contents 관련 항목 확인

3. 동영상 관련

플레이 되는 시간이 10분을 초과하는 경우 m3u8 형식의 동영상으로 인코딩 되어야 함

인코딩된 동영상에 대해 별도의 analyzer로 테스트 해볼수 있도록 샘플 URL  1개 이상 제공

해당 동영상은 64k 미만의 음성만 포함된 형식의 동영상과 정상적인 동영상 2개가 네트워크 속도에 따라

   선택적으로 플레이 되어야 함 (wowza smil 형식 적용 필요)

변환된 동영상은 애플에서 검증하는 mediastreamvalidator Tool에서 에러, 경고 로그가 찍히지 않고 OK만 나와야함

[출처] App Store Review Guidelines|작성자 해바라기 ObjC

- 별도의 analyzer라고 부르는것이 mediastreamvalidator이며 이건 apple 개발자 센터에서 다운로드 가능

- mediastreamvalidator에서 발생하는 case에 대한 설명

https://developer.apple.com/library/ios/technotes/tn2235/_index.html

- 발생했던 주요 이슈

WARNING: Media segment duration outside of expected duration by 25.926 % (7.41 vs. 10.00 seconds, limit is 20 %)

- ts의 길이가 적혀있는 시간과 차이가 발생할 경우(마진 20%)

- ts가 keyframe 단위로 split이 되기 때문에 ts가 5초인 영상의 경우 20%인 1초단위로 keyframe 생성하는것이 필요하다.

WARNING: Media segment bitrate outside of target playlist bitrate by 29.942 % (364530 vs. 520324 bps, limit is 10 %).

- adaptive bitrate streaming시에 bitrate를 지정하게 되어있는데 이것이 실제 영상과 다를 경우에 발생

WARNING: Playlist Content-Type is 'text/plain', but should be one of 'application/vnd.apple.mpegurl', 'audio/x-mpegurl' or 'audio/mpegurl'

- response data의 content-type 체크

'Tech > Tips' 카테고리의 다른 글

서버쪽의 CLOSE_WAIT timeout 줄이기  (0) 2014.01.14
오라클 xe 한글설정  (0) 2013.11.25
댓글