블로그 이미지
Sunny's

calendar

1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

Notice

2011. 1. 6. 11:29 IPhone

This Technote discusses some best practices for creating and deploying HTTP Live Streaming Media for the iPhone and iPad.

Introduction

HTTP Live Streaming allows you to send live or prerecorded audio and video to iPhone, iPad, and other devices including desktop computers, using an ordinary Web server. Playback requires iPhone OS 3.0 or later on devices running iPhone OS; QuickTime X or later is required on the desktop. See the HTTP Live Streaming Overview for more information.

This Technote offers the recommended encoding settings to use when creating HTTP Live Streaming media for iPhone and iPad apps, and for Safari on iPhone OS. It also provides tips for creating variant playlists, highlights some special considerations for deploying your media content to a web server and discusses how to validate your media streams.

IMPORTANT: This document is updated frequently. Please bookmark this page, and refer back to it for the most current recommendations before starting your next project.

Back to Top 

Recommended Encoding Settings for HTTP Live Streaming Media

Figure 1 contains recommended encoding settings to use when creating HTTP Live Streaming media.

IMPORTANT: These are recommended settings, not required settings. For example, if you are targeting movies that have very fast motion (such as sporting events), or if you have concerns about bandwidth, you may need to perform additional compression on your video to get the desired results. In this the case, use these settings as a starting point, and recompress until you are satisfied with the results.

These settings apply to both live and prerecorded (video on demand, or VOD) encoding. The provided settings are grouped according to whether the content is intended to be streamed over the Cellular or Wi-Fi network, whether the content is for iPhone/iPod Touch or iPad, and whether the content is 4:3 or 16:9 aspect ratio.

The following audio and video formats are supported:

  • Video: H.264 Baseline Profile Level 3.0 (iPhone/iPod Touch), Main Profile Level 3.1 (iPad)

  • Audio: HE-AAC or AAC-LC up to 48 kHz, stereo audio OR

    MP3 (MPEG-1 Audio Layer 3) 8 kHz to 48 kHz, stereo audio

Note: iPhone 3G supports H.264 Baseline Profile Level 3.1. If your app runs on older iPhones, however, you should use H.264 Baseline Profile 3.0 for compatibility.

Figure 1: Recommended Encoding Settings for HTTP Live Streaming Media.

Figure 1, Recommended Encoding Settings for HTTP Live Streaming Media.

How to create content with the recommended settings using QuickTime

To learn how to export files with these settings using QuickTime, see Technical Note TN2218, 'Compressing QuickTime Movies for the Web'

Back to Top 

Requirements for Apps

If you are using HTTP Live Streaming in iPhone and iPad applications sold on the App Store there are some requirements you must conform to. See the HTTP Live Streaming Overview for the details.

Back to Top 

Media Segmentation

HTTP Live Streaming requires that a media stream or file be segmented into a series of small media files of equal duration. This is usually accomplished using a tool that will segment the individual files and create a playlist.

This architecture allows for a live stream that has already been segmented to be quickly converted to a VOD stream just by updating the playlist.

There are two command-line tools available to you from Apple for segmentation of HTTP Live Streaming media. The tools are:

  • Media Stream Segmenter

  • Media File Segmenter

IMPORTANT: Both tools are frequently updated. If you are an iPhone Developer Program member or a Mac or ADC Select or Premier member, you can download the latest versions from the Apple Developer Connection website. To download, go to http://connect.apple.com, click on the 'Downloads' link, click on 'QuickTime', scroll down to the 'HTTP Live Streaming Tools', download and install the 'HTTP Live Streaming Tools'.

Media Stream Segmenter Tool

You can use the Media Stream Segmenter (mediastreamsegmenter) tool for deployment of HTTP Live Streaming Media.

The mediastreamsegmenter is also included with Mac OS X, version 10.6 and later. It can be found on your system disk at /usr/bin/mediastreamsegmenter. ( The /usr/bindirectory is hidden from the Finder, but is accessible using the Terminal application, located in the Utilities folder.)

This tool receives an MPEG-2 transport stream over a UDP network connection or from stdin and divides it into a series of small media segments of equal duration. It then creates an index file containing references to the individual media segments. The index file and media segments can be deployed using almost any web server infrastructure for streaming to iPhone OS and Mac OS X 10.6 Snow Leopard. The mediastreamsegmenter produces either live or Video on Demand (VOD) streams.

The mediastreamsegmenter tool accepts different command line arguments (you can obtain a list of the command line arguments and their meanings by typing man mediastreamsegmenter from the Terminal application, or see the online man page). This tool can produce an audio-only stream if you specify the following argument:

-a | -audio-only

This strips the audio elementary stream (AAC/ADTS or MP3) and writes it into the media file. You could, for example, run the mediastreamsegmenter on an existing audio/video stream to get an audio-only stream.

Here's an example showing how to use the mediastreamsegmenter to capture and create an unencrypted live stream:

mediastreamsegmenter -s 3 -D -f /Library/WebServer/Documents/stream 239.4.1.5:20103

The -s option defines the number of media file entries that should be kept in the index file. The default is 5. The -D option (in a live stream) will specify that the media files that are no longer in the index file will be removed after an expiry period. The -f option specifies the directory to store the media and index files.

In this example, the index file will contain 3 items. Media files will be removed after an expiry period. The media and index files will be stored in /Library/WebServer/Documents/stream.

Back to Top 

Media File Segmenter Tool

The media file segmenter (mediafilesegmenter) is a command-line tool that segments media files for deployment using HTTP Live Streaming. The mediafilesegmenter takes media from the specified file, multiplexes it into MPEG-2 Transport streams if required, and divides it into a series of small media files of approximately equal duration.

Note: The mediafilesegmenter accepts media from a file. Use the Media Stream Segmenter Tool to receive a stream over a network connection or from stdin.

The mediafilesegmenter also creates an index file containing references to the individual media files. The index file and media files can then be deployed as a VOD stream using common web server infrastructure.

The mediafilesegmenter tool accepts many different command line arguments (you can obtain a list of the command line arguments and their meanings by typing man mediafilesegmenter from the Terminal application).

Note: Previous versions of the tool required you specify the -O or -optimize option to turn on optimization, otherwise it was off by default. With the new tool, optimization is on by default, and you must now specify yes or no as a qualifier as shown here:

[-O | -optimize [yes | no]]

Back to Top 

Variant Playlists

A streaming multimedia presentation is specified by a Playlist file, which is a list of media file resources, each of which refers to a segment of a single contiguous stream. A server may offer multiple Playlist files to provide different encodings of the same presentation when HTTP Live Streaming. If it does, it should provide a Variant Playlist file (also known as a Stream Alternate) that lists each variant stream to allow clients to switch between encodings dynamically if the available bandwidth changes.

See the HTTP Live Streaming Overview and the HTTP Live Streaming Protocol Specification for additional information about Variant Playlists.

Variant Playlist Creator Tool

The Variant Playlist Creator (variantplaylistcreator) is a command line tool that will create a variant playlist in the m3u8 format for stream switching for HTTP Live Streaming segments created by mediafilesegmenter. iPhone Developer Program members and Mac and ADC Select or Premier members can download the tool as part of the HTTP Live Streaming Tools package as described in Media Segmentation.

The variantplaylistcreator takes pairs of URLs and plist files generated using the -generate-variant-info option from mediafilesegmenter and creates a variant stream playlist. You can obtain a list of all the command line arguments and their meanings by typing man variantplaylistcreator from the Terminal application.

Back to Top 

Important considerations when creating Variant Playlists

Here are some important points to consider when creating your own Variant Playlists:

  • Choosing the initial variant to be played

    The first entry in the Variant Playlist will be played at the initiation of a stream and is used as part of a test to determine which stream is most appropriate. The order of the other streams is irrelevant.

    You should create multiple playlists that have the same set of streams, but each with a different first entry that is appropriate for the target network. This ensures the user has a good experience when the stream is first played.

    We recommend you point to a 150k stream for the cellular Variant Playlist.

    We recommend you point to a 240k or 440k stream for the Wi-Fi Variant Playlist.

    See Recommended Encoding Settings for HTTP Live Streaming Media.

  • Where possible, encode enough variants to provide the best quality stream across a wide range of connection speeds

    For example, encode variants at 150 kbps, 350 kbps, 550 kbps, 900 kbps, 1500 kbps.

  • When possible, use relative path names in Variant Playlists and in the individual .m3u8 Playlist files

  • Audio/Video Stream Considerations

    The audio streams should be exactly the same.

    Video aspect ratio must be exactly the same, but can be different dimensions.

    We recommend 400 x 224 for 16:9 content and 400 x 300 for 4:3 content (see Recommended Encoding Settings for HTTP Live Streaming Media).

    Note: One easy way to synchronize different VOD stream files is to copy the audio track of one Variant Playlist member file into each of the other member files.

Back to Top 

Media Deployment

HTML5 video element

We recommend you use the HTML5 video element to display video in Safari on iPhone OS. For more information about the video element, see the Safari Guide to HTML5 Audio and Video and theHTMLMediaElement, HTMLVideoElement, and HTMLAudioElement class references in the Safari DOM Extensions Reference.

The source code example in Listing 1 demonstrates how to use the video element to display HTTP Live Streaming video in a web page.

Listing 1: HTML5 video element example.

<video src="http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8">
        This browser does not support HTML5 video.
</video>

See also Technical Note TN2262, 'Preparing Your Web Content for iPad' which describes platform-specific considerations for web content in Safari on iPhone OS devices, with specific information for iPad.

Back to Top 

Web Server Configuration

The distribution system for HTTP Live Streaming media is a web server or a web caching system that delivers the media files and index files to the client over HTTP (see the HTTP Live Streaming Overviewfor more information). No custom server modules are required to deliver the content, and typically very little configuration is needed on the web server.

Recommended configuration is typically limited to specifying MIME-type associations for .M3U8 files and .ts files.

Table 1 : MIME-type associations for .M3U8 files and .ts files.

File Extension MIME Type
.M3U8 vnd.apple.mpegURL or application/x-mpegURL
.ts video/MP2T

Servers that are constrained for compatibility can serve files ending in .m3u with MIME type audio/mpegURL.

Tuning time-to-live (TTL) values for .M3U8 files may also be necessary to achieve desired caching behavior for downstream web caches, as these files are frequently overwritten, and the latest version should be downloaded for each request. Check with your content delivery service provider for specific recommendations.

Back to Top 

Media Stream Validation

Media Stream Validator Tool

The Media Stream Validator (mediastreamvalidator) is a command-line tool to validate HTTP Live Streaming streams and servers. iPhone Developer Program members and Mac and ADC Select or Premier members can download the tool as part of the HTTP Live Streaming Tools package as described in Media Segmentation.

This tool simulates an HTTP Live Streaming session and verifies that the index file and media segments conform to the HTTP Live Streaming specification. It performs several checks to ensure reliable streaming. If any errors or problems are found, a detailed diagnostic report is displayed.

IMPORTANT: You should always run the mediastreamvalidator tool on your stream to verify that it conforms to the HTTP Live Streaming specification.

Here's example output from the mediastreamvalidator tool.

Listing 2: Example validator tool output.

Validating http://devimages.apple.com/iphone/samples/bipbop/gear3/prog_index.m3u8 against iPhone OS 3.1.0

Average segment duration: 8.77 seconds
Average segment bitrate: 510.05 kbit/s
Average segment structural overhead: 96.37 kbit/s (18.89 %)

Video codec: avc1
Video resolution: 480x360 pixels
Video frame rate: 29.97 fps
Average video bitrate: 407.76 kbit/s
H.264 profile: Baseline
H.264 level: 2.1

Audio codec: aac 
Audio sample rate: 22050 Hz
Average audio bitrate: 5.93 kbit/s

Note: The mediastreamvalidator will first show a listing of the streams you provide, followed by the timing results for each of those streams. However, it may take a few minutes for themediastreamvalidator to calculate the actual timing results.

For variant playlists, it is important that the bitrates specified in the playlist are very close to the actual measured rates. If not, a warning will be issued by the mediastreamvalidator. The bitrates are specified in the EXT-X-STREAM INF tag using the BANDWIDTH attribute.

Listing 3: Example Variant Playlist showing the BANDWIDTH attribute.

#EXTM3U 
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1280000 
http://example.com/low.m3u8 
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2560000 
http://example.com/mid.m3u8 
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=7680000 
http://example.com/hi.m3u8

See the HTTP Live Streaming Protocol Specification for more information about the BANDWIDTH attribute.

Back to Top 

References


Tech Note : http://developer.apple.com/library/ios/#technotes/tn2010/tn2224.html
posted by Sunny's
2010. 12. 9. 19:09 IPhone

iPhone HTTP Streaming with FFMpeg and an Open Source Segmenter

HTTP live streaming: iPhone streaming media overview

HTTP Live streaming draft proposal

download the MoviePlayer iPhone demo application

Step 1: Grab the lastest version of FFMpeg

Step 2: Encode your video for the iPhone

Step 3: Download and build the segmenter

Step 4: Prepare the HTTP server

Step 5: Test the stream

Step 6: Automatically the stream encoding and segmentation

Step 7: Create a variable rate HTTP stream

참조: http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/

 

Wowza Media Server 2 Advanced Preview 7

Streaming to the iPhone and iPod touch (HTTP Streaming)

H.264/AAC/MP3

HTML

Live Stram Repeater

http://www.wowzamedia.com/advanced.php

 

Tuner2 HiFi Radio: iPhone/iPod Touch Player

Reduces Streaming Costs by up to 1/4.
Increases Stream Reliability.
Increases Audio Quality for a Better User Experience.
Plays AAC/HE-AAC v1 and v2 streams over EDGE/3GPP/WiFi Networks for high fidelity streaming.
Plays MP3 streams for backward compatibility (SHOUTcast and Icecast2 only).
Uses commercially licensed AAC/HE-AACv1/HE-AACv2 implementation from Fraunhofer IIS / FhG for the best audio quality, unobtainable by open-source implementations.
Uses standards-based servers such as SHOUTcast, Icecast2, QuickTime/Darwin-QTSS/DSS, and Real/Helix Streaming Servers, which can also be used to reach other players and devices, further reducing deployment and administrations costs.
Uses ICY MPEG-2/ADTS, RTP MPEG-4/ISMA, 3GPP/LATM, and RTMP Adobe Flash streaming transports and protocols, covering all basis, not just some.
Displays real-time Program Associated Data (PAD) as Program Associated Text (PAT), Stream Name, Stream Description, Artist, and Title.
Displays real-time Program Associated Graphics (PAG), Logos, Album Cover Art, and Commercials for revenue generation.
Save Titles with graphics and history information.
Recall Saved Titles to Purchase on iTunes, e-mail to other users, or play originating stream.
E-mail streams to other users. Uses Tuner2 for AAC/HE-AAC Streaming Directory Listings.
Allows additional arbitrary stream URLs to be entered directly into Player and Favorites without requiring input to a Directory Server.
Shake function to select random stream for the undecided and adventurous listener.
Automatically Connects to 3G/EDGE Network when available, wihout having to start browser first.
Deterministic auto-reconnect in the event of network interuption.
Allows incoming calls while streaming and auto reconnect upon call termination.
Full DMCA Compliant using true streaming protocols, not progressive downloading, and all required content information.
Support lanscape in most views.
Custom Player versions with custom Directory Listings available. Please ask for more information: info(at)indexcom.com
We do NOT support MP3 Flash streams.

http://www.indexcom.com/iphone/features.html

 

MPMoviePlayerController

AudioFileStream, CFReadStream, CFHTTPMessage and AudioQueue

 

The iPhone only supports "HTTP Streaming" by default, not RTP. This goes for audio or video. "HTTP Streaming" is really just "range requests" to an HTTP server so that portions of the audio or video stream can be downloaded at a time. Tomcat supports these requests just fine.

There are a few apps (QIK has something for example) on the iPhone that support true streaming, but nothing built in.

 

iPhone has no RTP Stack. But I could use an external one (PJMEDIA) ... and so become the MPEG-4/H.264 video frames in the application

http://www.iphonedevsdk.com/forum/iphone-sdk-development/13880-rtp-stream-video-audio.html

 

Adobe's RTMP (Real Time Messaging Protocol)

 

vlc4iphone

소스

http://github.com/zodttd/vlc4iphone

git://github.com/zodttd/vlc4iphone.git

posted by Sunny's
2010. 9. 7. 15:24 IPhone

Streaming Movie Play 관련
유용한 영상인것 같네요..^^

posted by Sunny's
2010. 9. 2. 16:13 IPhone
현재 이러닝의 단점은 이동성이 떨어진다는 데 있습니다. 기업형 이러닝 콘텐츠는 플래시 기반으로 동작하기 때문에 이동성에 제약이 많습니다. 그러나 사교육용 이러닝 콘텐츠는 동영상 중심이기 때문에 PMP 같은 곳에 '미리 넣어 놓고' 볼 수 있습니다. 

이동성이 확보된 기기도 불편함은 있습니다. 바로 '미리 넣어' 놔야 볼 수 있다는 겁니다. 무선인터넷망을 통해 무거운 동영상을 스트리밍해서 본다면 패킷요금으로 패가망신할 정도의 요금이 나오기 때문에 현재는 불가능한 방식입니다. 

그렇기 때문에 PMP를 컴퓨터와 연결해서 동기화 혹은 복사해 놓고 강의를 듣는 것이 이동식 이러닝, m러닝(엠러닝)의 일반적인 방식이었습니다. 그런데 만약 동영상 이러닝 콘텐츠를 라이브로 스트리밍 받을 수 있으면서 와이파이(wi-fi)나 3G(와이브로 같은)를 이용할 수 있다면 사정은 많이 달라지겠죠?

그런 기술이 나왔다고 합니다. 


솔루션박스(http://www.solbox.com/)라는 회사가 이런 솔루션을 내놓았습니다. 




이동성 기기로는 요즘 장안에 화두가 되고 있는 아이폰을 선택했습니다. 아이폰 OS 3.0 버전에 최적화하여, http 라이브 스트리밍 기술을 구현했다고 하는군요. 

암호화 기술을 통해 불법적인 사용을 방지하도록 장치를 마련해 놓아 보안이 강화되었다고 설명하고 있습니다. 게다가 어댑티브 스트리밍(Adaptive Streaming)이라고 해서 무조건 스트리밍 받는게 아니고, 전송속도에 최적화하여 스트리밍 속도를 조절하는 기술도 적용되어 있다고 하니 기대해 볼만 할 것 같습니다. 

아이폰의 국내 출시로 스마트폰의 생태계도 활성화될 것 같습니다. 이러닝 업계도 이런 기술이 개발되고, 아이폰에서 사용할 수 있는 앱들이 출시되고 있는 만큼 이동성을 강화하는 방향으로 서비스의 틀을 바꾸어야 할 겁니다. 

이러닝이 처음 나왔을 때 그렇게 부르짖었던 적시학습(Just-in-Time Learning)이 스마트폰을 통해 구현될 날도 멀지 않은 것 같습니다. 

기술과 기기가 발전하고 나면 승부는 콘텐츠와 커뮤니티에서 나겠지요. 얼마나 적시학습에 최적화된 콘텐츠를 가지고 있느냐, 그리고 그것을 단순히 전송하는 수준에서 머무는 것이 아니라 학습공동체화하여 충성도 높은 서비스로 엮어 내느냐가 관건입니다. 

내년 이후 이러닝 시장도 전통적인(?) 고용보험 중심에서 다양한 영역으로 활성화될 것으로 보입니다. 스마트폰이 그 변화의 첨병이 될 것을 믿어 의심치 않습니다. 2009년에 아이폰이 출시되면서 스마트폰에 대한 일반인들의 관심이 높아질 것이고, 2010년에는 스마트폰이 서서히 보급되면서, 2011년부터는 본격적인 이러닝 서비스의 싸움이 될 것으로 예상됩니다.

미리 준비하고 총알을 쌓아 놓는 자가 선점할 수 있는 시대가 곧 올 것 같습니다. 이런 변화의 물결을 미리 감지하여 어떻게 움직일지 고민이 많네요. 변화는 곧 닥칠 것이고 기회도 오겠지요. 이것을 잡느냐 마느냐는 전적으로 타이밍의 문제인 것 같습니다. 타이밍은 언제로 잡느냐가 향후 10년을 먹고살 수 있는 기반을 만들어 줄 것이라 믿어 의심치 않습니다. 중요한 결정의 시간이 오고 있습니다.

출처 :http://www.heybears.com/2512666
posted by Sunny's
prev 1 next