×
Namespaces

Variants
Actions
Revision as of 04:58, 1 July 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Video playback guidance for Nokia Lumia 610

From Nokia Developer Wiki
Jump to: navigation, search
WP Metro Icon Multimedia.png
WP Metro Icon Graph1.png
SignpostIcon WP7 70px.png
Article Metadata
Tested with
Devices(s): Nokia Lumia 610
Compatibility
Platform(s): Windows Phone 7 (only)
Windows Phone 7.5
Article
Created: Justin.Angel (23 Mar 2012)
Last edited: hamishwillee (01 Jul 2013)

This article provides best practice guidance to preparing your video content and Windows Phone apps that incorporate video for the Nokia Lumia 610, and other Windows Phone devices with 7x27a processors.

Contents

Introduction

As part of the Windows Phone 7.5 refresh, Windows Phone devices may now use the 7x27a-processor. This processor supports a subset of the codecs available for hardware acceleration in the 8x50 and 8x55 processors used in other Lumia smartphones. In order to enable video playback on phones using a 7x27a processor, the baseline requirements for all Windows Phone devices have been aligned with hardware accelerated codecs supported by the 7x27a-processor.

Baseline comparison of Windows Phone devices

Content providers can offer 7x27a-powered phones video from their catalogue that is encoded at the baseline bitrate and resolution. If no such video content is available, content providers should re-encode their video libraries to the new baseline. Nokia is, however, aware that many content providers may not choose to do this.

This article discusses best practices for apps to achieve optimal video playback on 7x27a-powered phones.

Supported video codecs for phones with a 7x27a-processor

The Windows Phone 7.5 refresh has made no changes to the supported video encoding profiles for existing Windows Phone devices using 8x50 or 8x55 processors. For Windows Phone devices with a 7x27a processor and 256 MB of RAM, a subset of these video encoding profiles is supported. For more information see MSDN's Supported Media Codecs for Windows Phone.

There are three video codecs supported on phones with 8x50- or 8x55 processors that aren’t supported by hardware acceleration on phones with 7x22a processors: VC1 Advanced profile (a common WMV format), MPEG-4 Pt 2 Advanced-Simple profile, and MPEG-4 Pt 2 (for 512-MB devices).

Below are listed the differences between the supported video encoding profiles on 7x27a- and 8x50/8x55-processor powered phones:

Codec and Profile Phone chipset Level Max average bitrate Max peak bitrate Max resolution and framerate
H.263 7x27a/baseline 30 2 Mbps 4 Mbps 800×480 @ 30 fps
8x50 / 8x55 40 2 Mbps 20 Mbps 800x600 @ 30 fps
VC1 Simple (for WMV 9) 7x27a/baseline Medium 2 Mbps Not Available 800×480 @ 30 fps
8x50 / 8x55 Medium 2 Mbps 20 Mbps 800x600 @ 30 fps
VC1 Main (for WMV 9) 7x27a/baseline Low 512 Kbps 1 Mbps 400×240 @ 30 fps
8x50 / 8x55 Medium 2 Mbps 20 Mbps 800x600 @ 30 fps
MPEG-4 Pt 2 Simple 7x27a/baseline 3 2 Mbps 4 Mbps 800×480 @ 30 fps
8x50 / 8x55 2 Mbps 27 Mbps 800x600 @ 30 fps
H.264 Baseline 7x27a/baseline 2.0 2 Mbps 4 Mbps 800×480 @ 30 fps
8x50 / 8x55 3.1 10 Mbps 27 Mbps 1280x720 @ 30 fps
H.264 Main 7x27a/baseline 1.3 - CABAC,

2.0 - CAVL

CABAC: 2 Mbps,

CAVLC: 768 Kbps

4 Mbps 800×480 @ 30 fps
8x50 / 8x55 3.1 10 Mbps 27 Mbps 1280x720 @ 30 fps
H.264 High 7x27a/baseline 1.3 - CABAC,

2.0 - CAVLC

CABAC: 2 Mbps,

CAVLC: 768 Kbps

4 Mbps 800×480 @ 30 fps
8x50 / 8x55 3.1 10 Mbps 27 Mbps 1280x720 @ 30 fps

What happens when playing unsupported formats or codecs on a phone with a 7x27a processor?

Formats that are not supported on all Windows Phones — such as FLAC, RMVB, and OGG — will fail to play on 7x27a-powered phones.

Video in a supported format but encoded in a codec not supported with hardware acceleration or at higher bitrates or resolutions than the Windows Phone baseline, may either fail to playback or be rendered in software. If software rendering occurs playback will be poor — jumpy and choppy.

For example, a video using the VC1 codec Advanced or Main profiles may play through software rendering, instead of hardware acceleration, but if the encoded bitrate is too high it will fail.

To understand how software rendering affects playback, take this example:

<MediaElement
Source="http://tinyurl.com/256mbVC1Advanced"
AutoPlay="True"
/>

When run on a Lumia 610 and observing the Windows Phone Performance Profiler will show the CPU utilisation spiking at over 80% most of the time.

Performance profile during software rendering of video

However, when running the same video encoded at the H.264 baseline, significantly reduced CPU utilisation during video playback will be seen.

<MediaElement
Source="http://tinyurl.com/256mbH264"
AutoPlay="True"
/>
Performance profile during graphics processor rendering of video

This reduced CPU use is because video rendering takes place in the dedicated graphics processor and more importantly it translates into lower battery consumption. Because of that it’s recommend you use the baseline video encoding to avoid software rendering of videos, as doing so significantly reduces the time between charges for a phone.

Tip #1: Re-encode all video content

If your video content encoding doesn’t meet the new Windows Phone baseline specifications, the recommended best practice to re-encode all video content to the new Windows Phone video baseline specifications. If you have an existing video content catalogue you should encode your catalogue for separate delivery to 7x27a-powered Windows Phones. Microsoft Expression Encoder SP1 (bundled in Expression Studio) provides a useful list of available codecs:

List of available codecs

Bearing the supported video codecs for 7x27a-powered phone in mind, you can easily change the video encoding properties from unsupported to supported.

Tip #2: Always handle MediaFailed events

When playing videos using VC1 codec Advanced or Main profiles on a 7x27a-powered phone, the phone will attempt to perform software rendering. Such rendering is likely to fail if the video is considerably above the supported video spec. Attempting to play any other unsupported codecs will fail. When video playback failure occurs the MediaElement will fire the MediaFailed event and stop video playback. Similar behaviour can be seen when attempting to play unsupported media codecs such as OGG, FLAC, or RMVB on 8x50- and 8x55-powered phones.

You should always handle MediaFailed events, show an appropriate message to the user, and gracefully handle any video playback issues. For example, the following video is a VC1 Advanced 2MBs bitrate video that’s considerably above spec for software rendering. Attempting to play this video will cause the MediaFailed to fire almost immediately.

<MediaElement
Source="http://tinyurl.com/256mVC1Advanced2Mbps"
AutoPlay="True"
MediaFailed="mediaElement_MediaFailed"
/>
private void mediaElement_MediaFailed(object sender, ExceptionRoutedEventArgs e)
{
MessageBox.Show("We're sorry, we couldn't play this video.");
 
if (NavigationService.CanGoBack)
NavigationService.GoBack();
}

When running this application on a Nokia Lumia 610 or in the 256MB emulator, you will see this MessageBox popup.

VideoPlaybackLumia610 MessageBoxPopup-UnsupportedVideo.png

Tip #3: Disable High-Quality video on 7x27a devices

We recommend you only offer baseline encoded video on 7x27a-powered devices. You can use the MediaCapabilities.IsMultiResolutionVideoSupported property to determine if above baseline video is supported on the phone or not. This property was introduced in the Windows Phone 7.1 SDK.

For example, the app SuperTube offers users the option of watching content in Low Quality (LQ), High Quality (HQ), or High Definition (HD). SuperTube’s Low Quality video is the only video supported on 7x27a-powered phones. The app could therefore be modified so that on 7x27a-powered phones it would only offer Low Quality video playback.

An if-then-else condition that displays supported video codecs only, would look something like this:

if (MediaCapabilities.IsMultiResolutionVideoSupported)
{
ShowAllVideoFormats();
}
else
{
ShowOnlyLowQualityVideoFormats();
}

Tip #4: When all video content is unsupported, remove video content completely

If none of the video content in your app will play on a 7x27a-powered phone we recommend all the video content be removed, but only if the app’s overall experience can be maintained.

This is in particular recommended for apps with mixed content types such as video, audio, images, and text, where the types are separated cleanly by different “views”.

App with content types are in clearly separated views.

To remove the app's video content, use an if-then-else condition similar to:

if (!MediaCapabilities.IsMultiResolutionVideoSupported)
{
RemoveVideoPanoramaItem();
}

If your application is primarily focused on video playback and none of the video content is playable on 7x27a-powered phones it’s recommended that you opt your app out from these phones. For more information on opting-out your apps from these phones, see the Nokia Developer Wiki article Opting your app out from Windows Phone with 256 MB.

Tip #5: Invoke RestrictTracks for SmoothStreamingMediaElement

Many Silverlight apps use IIS Smooth Streaming to achieve adaptive video playback on Windows Phone. Such apps have to programmatically limit which adaptive tracks can be played on Windows Phone, and will need to be updated to limit supported tracks based on the new video playback baseline.

IIS Smooth Streaming works as follows: starting with a single High-Definition video file/stream, multiple video streams in different bitrates and resolutions are created. Silverlight then chooses which bitrate to play based on heuristic logic.

VideoPlaybackLumia610 IISSmoothStreamingFlow.png

For example, we can examine this Smooth Streaming video manifest and see four possible H.264 video bitrates and resolutions, each under a different <QualityLevel />:

<SmoothStreamingMedia MajorVersion="2" MinorVersion="1" Duration="419999999">
<StreamIndex Type="video" Name="video" Chunks="21" QualityLevels="4" MaxWidth="1280" MaxHeight="720" DisplayWidth="1280" DisplayHeight="720">
<QualityLevel Index="0" Bitrate="1600000" FourCC="H264" MaxWidth="1280" MaxHeight="720" />
<QualityLevel Index="1" Bitrate="800000" FourCC="H264" MaxWidth="720" MaxHeight="404" />
<QualityLevel Index="2" Bitrate="400000" FourCC="H264" MaxWidth="400" MaxHeight="224" />
<QualityLevel Index="3" Bitrate="200000" FourCC="H264" MaxWidth="220" MaxHeight="124" />

Our goal for all Windows Phones is to limit which tracks are played to only those tracks that are supported on the phone. For 7x27a-powered phones your best option is to use the Microsoft Media Platform: Player Framework, which is covered in the next section, as it has built-in logic that restricts tracks successfully. However, if your app is directly consuming the SmoothStreamingMediaElement it's recommended you limit the supported bitrates to a single tested bitrate or the minimum bitrate.

Dynamic smooth streaming bitrate changes are not supported on 7x27a-powered Windows Phone devices, and therefore heuristic logic is not required: You’ll have to choose a single bitrate to play before video playback starts. Then the question becomes, which single video track will you choose? If you cannot test your video content, it’s recommended you limit video content to the minimum bitrate. However, the minimum bitrate might be lower than the baseline bitrates. Therefore, if you can test your video stream it’s recommended you use the highest supported and successfully tested bitrate. For example this Smooth Streaming video will only play when restricted to the lowest bitrate. Let’s attempt to play this video without limiting smooth streaming tracks and observe the behaviour.

<SmoothStreaming:SmoothStreamingMediaElement 
SmoothStreamingSource="http://tinyurl.com/256mbSmoothStreaming"
MediaFailed="ssme_MediaFailed" />
private void ssme_MediaFailed(object sender, ExceptionRoutedEventArgs e)
{
MessageBox.Show("We're sorry, we couldn't play this video.");
 
if (NavigationService.CanGoBack)
NavigationService.GoBack();
}
VideoPlaybackLumia610 MessageBoxPopup-UnsupportedVideo.png

Now limit the supported Smooth Streaming tracks to the lowest available bitrate.

<SmoothStreaming:SmoothStreamingMediaElement 
x:Name="video"
ManifestReady="ssme_ManifestReady"
SmoothStreamingSource="http://tinyurl.com/256mbSmoothStreaming"
MediaFailed="ssme_MediaFailed" />
private void ssme_ManifestReady(object sender, EventArgs e)
{
if (!MediaCapabilities.IsMultiResolutionVideoSupported)
{
OnlyPlaySmoothStreamsWithMinimumBitrate(video);
}
}
 
private void OnlyPlaySmoothStreamsWithMinimumBitrate(
SmoothStreamingMediaElement ssme,
ulong? maximumBitrate = null)
{
if (ssme == null)
{
return;
}
 
var streamsToRemoveTracksFrom =
ssme.ManifestInfo
.Segments
.SelectMany(segmenet => segmenet.AvailableStreams)
.Where(streamInfo => streamInfo.Type == MediaStreamType.Video);
 
foreach (StreamInfo streamInfo in streamsToRemoveTracksFrom)
{
var minimumAvailableBitrate =
streamInfo.AvailableTracks.Min(t => t.Bitrate);
 
var actualMaximumBitrate =
maximumBitrate.HasValue
? maximumBitrate.Value
: minimumAvailableBitrate;
 
var allowedTracksUsingApprovedBitrated =
streamInfo
.AvailableTracks
.Where(track => track.Bitrate == actualMaximumBitrate)
.ToList();
 
streamInfo.RestrictTracks(allowedTracksUsingApprovedBitrated);
}
}

The code snippet above uses the RestrictTracks method as its main interaction point with the SmoothStreamingMediaElement. To read more about this method, see Giuseppe Guerrasio's Using Smooth Streaming Media Element for Windows Phone 7.

When running this example we see that video playback works as expected.

VideoPlaybackLumia610 IISSmoothStreamingWorkingImage.png

You can choose playback bitrates other than the minimum after they have been successfully tested. For example for this Smooth Streaming video we can play it at up to a 688000 bitrate, although 230000, 331000, and 477000 bitrates are available. But remember, it's recommended thay you support only one bitrate in your app.

<SmoothStreaming:SmoothStreamingMediaElement 
x:Name="video"
ManifestReady="ssme_ManifestReady"
SmoothStreamingSource="http://tinyurl.com/Elephants-Dream"
MediaFailed="ssme_MediaFailed" />
private void ssme_ManifestReady(object sender, EventArgs e)
{
if (!MediaCapabilities.IsMultiResolutionVideoSupported)
{
OnlyPlaySmoothStreamsWithMinimumBitrate(video, 688000);
}
}

For this video limiting the Smooth Streaming video playback to the 688000 track plays it successfully.

VideoPlaybackLumia610 IISSmoothStreamingWorkingElephantDream.png

Tip #6: For Smooth Streaming Videos use the Microsoft Media Platform: Player Framework

The Microsoft Media Platform: Player Framework is a fully featured Windows Phone video player provided by Microsoft as a third-party download. It supports 7x27a-powered phones out of the box. The <SmfPlayer /> control has been future proofed in the Windows Phone 7.5 release and will select the lowest bitrate based on the previously mentioned MediaCapabilities.IsMultiResolutionVideoSupported property. You can use the <SmfPlayer /> control with any Smooth Streaming video manifest and it will choose the optimal track to play.

<Mmppf:SMFPlayer VolumeLevel="1">
<Mmppf:SMFPlayer.Playlist>
<Media:PlaylistItem DeliveryMethod="AdaptiveStreaming"
MediaSource="http://tinyurl.com/256mbSmoothStreaming" />
</Mmppf:SMFPlayer.Playlist>
</Mmppf:SMFPlayer>

Running this app you will see the <SmfPlayer /> control chose the right Smooth Streaming track to play.

VideoPlaybackLumia610 SmfPlayer.png

Conclusion

7x27a-powered phones impose limitations on the video they can play. These limitations have been implemented to account for the lower processing capacity and memory of these phones. However, by re-encoding your video and making use of the techniques outlined in this article you can preserve your apps UX and continue to offer your users a rich video experience.

Video assets

We would like to thank Microsoft’s Channel9 for hosting the video content used in this article. The two videos shown in this article are Channel9's Inside Windows Phone #33 - Windows Phone 7.5 Refresh and the Creative Commons movie Elephants Dream.

This page was last modified on 1 July 2013, at 04:58.
573 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×