Skip to content

Instantly share code, notes, and snippets.

@aspose-cloud
Last active February 26, 2018 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-cloud/7748ea814398e6075d1bc44b51507cca to your computer and use it in GitHub Desktop.
Save aspose-cloud/7748ea814398e6075d1bc44b51507cca to your computer and use it in GitHub Desktop.
The GIST contains .NET Examples of Aspose.Video Cloud APIs.
The GIST contains .NET Examples of Aspose.Video Cloud APIs.
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var remoteName = "TestPostAddAudio.avi";
var fullName = Path.Combine(this.dataFolder, remoteName);
var destFileName = Path.Combine(BaseTestOutPath, remoteName);
var audioFile = "test.wav";
var destAudio = Path.Combine(this.dataFolder, audioFile);
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
this.StorageApi.PutCreate(destAudio, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + audioFile));
AudioContainer options = new AudioContainer();
options.Path = destAudio;
var request = new PostAddAudioRequest(remoteName, destFileName, options, this.dataFolder);
var actual = this.VideoApi.PostAddAudio(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var watermark = "watermark.png";
var watermarkPath = Path.Combine(this.dataFolder, watermark);
var remoteName = "watermarkImage.avi";
var fullName = Path.Combine(this.dataFolder, remoteName);
var resultPath = Path.Combine(this.dataFolder, "converted.mp4");
ConvertOptions options = new ConvertOptions();
options.Watermark = new WatermarkImageOptions();
options.Watermark.WatermarkPath = watermarkPath;
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
this.StorageApi.PutCreate(watermarkPath, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + watermark));
var request = new PostConvertVideoRequest(remoteName, "mp4", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var fullName = Path.Combine(this.dataFolder, localName);
var resultPath = Path.Combine(this.dataFolder, "convertedWatermarkText.mp4");
ConvertOptions options = new ConvertOptions();
options.WatermarkText = new WatermarkTextOptions();
options.WatermarkText.Text = "Test watermark text";
options.WatermarkText.FontFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial.ttf");
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(localName, "mp4", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var fullName = Path.Combine(this.dataFolder, localName);
var resultPath = Path.Combine(this.dataFolder, "aspectratio.avi");
ConvertOptions options = new ConvertOptions();
options.AspectRatio = ConvertOptions.AspectRatioEnum.R32;
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(localName, "avi", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var fullName = Path.Combine(this.dataFolder, localName);
var resultPath = Path.Combine(this.dataFolder, "bitrate.avi");
ConvertOptions options = new ConvertOptions();
options.Bitrate = 128;
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(localName, "avi", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var fullName = Path.Combine(this.dataFolder, localName);
var resultPath = Path.Combine(this.dataFolder, "fps.avi");
ConvertOptions options = new ConvertOptions();
options.FPS = 48;
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(localName, "avi", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var remoteName = "TestPostAppendVideo.avi";
var fullName = Path.Combine(this.dataFolder, remoteName);
var fullNameToAppend = Path.Combine(this.dataFolder, "videoForAppend.mp4");
var destFileName = Path.Combine(BaseTestOutPath, remoteName);
AppendOptions options = new AppendOptions();
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
this.StorageApi.PutCreate(fullNameToAppend, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + "sample.mp4"));
options.VideoToAppendPath = fullNameToAppend;
var request = new PostAppendVideoRequest(remoteName, destFileName, options, this.dataFolder);
var actual = this.VideoApi.PostAppendVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var fullName = Path.Combine(this.dataFolder, localName);
var resultPath = Path.Combine(this.dataFolder, "resolution.avi");
ConvertOptions options = new ConvertOptions();
options.FrameSize = "840x480";
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(localName, "avi", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var remoteName = "toconvert.avi";
var fullName = Path.Combine(this.dataFolder, remoteName);
var resultPath = Path.Combine(this.dataFolder, "converted.mp4");
ConvertOptions options = new ConvertOptions();
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(remoteName, "mp4", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var fullName = Path.Combine(this.dataFolder, localName);
var resultPath = Path.Combine(this.dataFolder, "pts.avi");
ConvertOptions options = new ConvertOptions();
options.PTS = ConvertOptions.PTSEnum.SlowDown;
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(localName, "avi", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var fullName = Path.Combine(this.dataFolder, localName);
var resultPath = Path.Combine(this.dataFolder, "Encoded.avi");
ConvertOptions options = new ConvertOptions();
options.Codec = ConvertOptions.CodecEnum.VP9;
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(localName, "avi", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.mp4";
var resultPath = Path.Combine(this.dataFolder, "extracted.mp4");
var fullName = Path.Combine(this.dataFolder, localName);
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostExtractVideoRequest(localName, resultPath, 1000, 4000, this.dataFolder);
var actual = this.VideoApi.PostExtractVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
var localName = "sample.mp4";
var destPath = Path.Combine(this.dataFolder, "thumbnail.png");
var fullName = Path.Combine(this.dataFolder, localName);
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostExtractThumbnailRequest(localName, destPath, 1000, this.dataFolder);
var actual = this.VideoApi.PostExtractThumbnail(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
var localName = "sample.avi";
var remoteName = "TestGetVideo.avi";
var fullName = Path.Combine(this.dataFolder, remoteName);
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new GetVideoRequest(remoteName, this.dataFolder);
var actual = this.VideoApi.GetVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var fullName = Path.Combine(this.dataFolder, localName);
var resultPath = Path.Combine(this.dataFolder, "pts.avi");
ConvertOptions options = new ConvertOptions();
options.PTS = ConvertOptions.PTSEnum.SpeedUp;
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(localName, "avi", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
var loadWebVideoData = new LoadWebVideoData();
loadWebVideoData.LoadingVideoUrl = "http://www.engr.colostate.edu/me/facil/dynamics/files/drop.avi";
var saveOptionsData = new SaveOptionsData();
saveOptionsData.SaveFormat = "avi";
saveOptionsData.FileName = "webloaded.avi";
loadWebVideoData.SaveOptions = saveOptionsData;
var request = new PostLoadWebVideoRequest(loadWebVideoData);
var actual = this.VideoApi.PostLoadWebVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
this.VideoApi = new VideoApi(AppKey, AppSID, BaseProductUri);
this.StorageApi = new StorageApi(AppKey, AppSID, BaseProductUri);
var localName = "sample.avi";
var fullName = Path.Combine(this.dataFolder, localName);
var resultPath = Path.Combine(this.dataFolder, "Volume.avi");
ConvertOptions options = new ConvertOptions();
options.Volume = 50;
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new PostConvertVideoRequest(localName, "avi", resultPath, options, this.dataFolder);
var actual = this.VideoApi.PostConvertVideo(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
var localName = "sample.avi";
var remoteName = "TestGetVideo.avi";
var fullName = Path.Combine(this.dataFolder, remoteName);
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new GetVideoPropertiesRequest(remoteName, this.dataFolder);
var actual = this.VideoApi.GetVideoProperties(request);
// For complete examples and data files, please go to https://github.com/aspose-video-cloud/aspose-video-cloud-dotnet/
using Aspose.Video.Cloud.Sdk.Api;
using Com.Aspose.Storage.Api;
using Aspose.Video.Cloud.Sdk.Model;
using Aspose.Video.Cloud.Sdk.Model.Requests;
private const string BaseProductUri = @"https://api.aspose.cloud/v1.1";
// Get App Key and App SID from https://dashboard.aspose.cloud/
private const string AppSID = "";
private const string AppKey = "";
var localName = "sample.avi";
var remoteName = "TestGetVideoProperty.avi";
var fullName = Path.Combine(this.dataFolder, remoteName);
this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));
var request = new GetVideoPropertyRequest(remoteName, "duration", this.dataFolder);
var actual = this.VideoApi.GetVideoProperty(request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment