Pseudo C# code (didn't try to compile it, but it should start you up):
Job job = new Job(); MediaItem mediaItem = new MediaItem(inputFile); job.MediaItems.Add(mediaItem);
VideoProfile videoProfile = new MainH264VideoProfile(); videoProfile.SmoothStreaming = true; videoProfile.SeparateFilesPerStream = true; // or false if you want all streams in one file
// Add your streams here via VideoProfile.Streams // Note: The default videoprofile up there has already one, so you might have to delete it first before populating the ones you want.
mediaItem.OutputFormat = new MP4OutputFormat() { VideoProfile = videoProfile, AudioProfile = new AacAudioProfile(128, 2, 44100, 16) };
job.Encode();
The only special thing to remember is to set VideoProfile.SmoothStreaming to true. The rest is standard H.264 profile stuff.
//add bitrate outputs for any default setting that is lower than original foreach (EncoderSettings setting in GetSettingsList()) { videoProfile.Streams.Add(new ConstantBitrate(setting.AvgBitRate, false), new Size(setting.Width, setting.Height)); }
// Use smooth streaming with automatically sized streams. videoProfile.SmoothStreaming = true;
//assign profile to media item for encoding mediaItem.OutputFormat = new MP4OutputFormat(); mediaItem.OutputFormat.VideoProfile = videoProfile; mediaItem.OutputFormat.AudioProfile = new AacAudioProfile(128, 2, 44100, 16);
job.MediaItems.Add(mediaItem);
Marked As Answer bymillrWednesday, December 16, 2009 10:53 PM
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.