Skip to content

puckhead22/TranscoderExtension

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transcoder Extension

Extension for Transcoder app for Windows

Build an app that extends the Transcoder app, adding additional source and target formats. An example Transcoder extension, Animated GIF Creator with full source code is here and is in the Windows Store. You can use the Transcoder.Extension class in your project to help in the implementation of a Transcoder Extension:

public sealed class GifCreator : IBackgroundTask
{
    public async void Run(IBackgroundTaskInstance taskInstance)
    {
		var deferral = taskInstance.GetDeferral(); 

		var logoFile = await Package.Current.InstalledLocation.GetFileAsync("Assets\\Logo.png");

		var extension = new Transcoder.Extension
		{
			Price = await Transcoder.Extension.GetPriceAsync(), 
			SourceType = "Video",
			SourceFormats = new string[] { ".mp4", ".mov", ".wmv", ".avi" },
			DestinationFormats = new string[] { ".gif" },
			LogoFile = logoFile,
			TranscodeAsync = this.TranscodeGifAsync
		};

		extension.Run(taskInstance, deferral);
    }

    public IAsyncAction TranscodeGifAsync(StorageFile source, StorageFile destination, ValueSet arguments)
    {
        return AsyncInfo.Run(async delegate (CancellationToken token)
        {
			... todo: write transcoding here
		});
	}
}	

Transcoder Protocol

Create a Windows Universal App that exposes an application service. Read this article on MSDN on how to create and consume an app service. To work in Transcoder, the app service needs to follow a specific protocol, responding to messages that have "Command" properties:

Get Description

Gets the description of the app service

Input

Property Type Description
Command String "GetDescription"

Output

Property Type Description
DisplayName String the localized display name of the hosting application
PublisherName String the localized publisher name of the hosting application
Version String the version of the hosting application in the store
Price String the localized price of the hosting application in the store or "0" for free apps
LogoFileToken String the token for a square .png image at 50x50 px minimum size created by using the SharedStorageAccessManager.AddFile API
SourceType String "Audio" or "Video"

Get Source Formats

Get the source formats that the app service supports

Input

Property Type Description
Command String "GetSourceFormats"

Output

Property Type Description
Formats String the source formats that the transcoder takes separated by commas (for example ".wmv,.avi,.mp4")

Get Destination Formats

Gets the destination formats that the app service supports

Input

Property Type Description
Command String "GetDestinationFormats"

Output

Property Type Description
Formats String the destination formats that the transcoder takes separated by commas (for example ".wmv,.avi,.mp4")

Transcode

Input

Property Type Description
Command String "Transcode"
FileTokens String a JSON array containing JSON objects with SourceToken and DestinationToken string properties. The file tokens are generated by using the SharedStorageAccessManager.AddFile API
Quality String Source, Custom, HD1080p, HD720p, Wvga, Ntsc, Pal, Vga, Qvga
Width UInt (optional) width of destination file if Quality is "Custom"
Height UInt (optional) height of destination file if Quality is "Custom"

Output

Property Type Description
Status String "OK" if successful

About

Extension for Transcoder app for Windows

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 97.3%
  • HTML 2.7%