ByteScout Image To Video SDK - C# - Multiple Videos At Once - ByteScout

ByteScout Image To Video SDK – C# – Multiple Videos At Once

  • Home
  • /
  • Articles
  • /
  • ByteScout Image To Video SDK – C# – Multiple Videos At Once

multiple videos at once in C# and ByteScout Image To Video SDK

How to use ByteScout Image To Video SDK for multiple videos at once in C#

Source code documentation samples provide quick and easy way to add a required functionality into your application. ByteScout Image To Video SDK was made to help with multiple videos at once in C#. ByteScout Image To Video SDK is the software development kit that can take a set of images and generate video slide show from them. Includes built-in support for 100+ of 2-D and 3-D slide transitions effects. Supports output in WMV, AVI, WEBM video formats.

The SDK samples like this one below explain how to quickly make your application do multiple videos at once in C# with the help of ByteScout Image To Video SDK. In order to implement this functionality, you should copy and paste code below into your app using code editor. Then compile and run your application. C# application implementation typically includes multiple stages of the software development so even if the functionality works please test it with your data and the production environment.

Trial version can be obtained from our website for free. It includes this and other source code samples for C#.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using System.Threading; using BytescoutImageToVideo; namespace MultipleInstances { class Program { private static int numBusy; private static ManualResetEvent doneEvent; static void Main(string[] args) { doneEvent = new ManualResetEvent(false); Console.WriteLine("Converting JPG slides to video in multiple threads, please wait..."); numBusy = 10; // 10 threads to start // Start threads for (int i = 1; i <= numBusy; i++) { ThreadPool.QueueUserWorkItem(DoWork, i); } // wait for all threads finished doneEvent.WaitOne(); Console.WriteLine("All threads are finished. Press any key to continue.."); Console.ReadKey(); } static TransitionEffectType GetRandomEffect() { Random rr = new Random(); return (TransitionEffectType)(rr.Next((int)TransitionEffectType.teZoomOut, (int)TransitionEffectType.teBlinds3DHorz)); } static void DoWork(object data) { int index = (int)data; try { Console.WriteLine("Thread {0} started...", index); // Create BytescoutImageToVideo.ImageToVideo object instance ImageToVideo converter = new ImageToVideo(); // Activate the component converter.RegistrationName = "demo"; converter.RegistrationKey = "demo"; // Add images and set the duration for every slide Slide slide; slide = converter.AddImageFromFileName("..\\..\\..\\..\\slide1.jpg"); slide.Duration = 3000; // 3000ms = 3s slide.InEffect = GetRandomEffect(); slide.OutEffect = GetRandomEffect(); slide = converter.AddImageFromFileName("..\\..\\..\\..\\slide2.jpg"); slide.Duration = 3000; slide.InEffect = GetRandomEffect(); slide.OutEffect = GetRandomEffect(); slide = converter.AddImageFromFileName("..\\..\\..\\..\\slide3.jpg"); slide.Duration = 3000; slide.InEffect = GetRandomEffect(); slide.OutEffect = GetRandomEffect(); // Set output video size converter.OutputWidth = 640; converter.OutputHeight = 480; // Set output video file name converter.OutputVideoFileName = String.Format("result_{0}.wmv", index); // Run the conversion converter.RunAndWait(); // Release resources System.Runtime.InteropServices.Marshal.ReleaseComObject(converter); Console.WriteLine("Thread {0} finished.", index); } catch (Exception ex) { Console.WriteLine("Thread {0} failed: {1}", index, ex.Message); } // check until numBusy is equal to 0 (as it we use it as a counter to count finished threads) if (Interlocked.Decrement(ref numBusy) == 0) { doneEvent.Set(); } } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Image To Video SDK Home Page

Explore ByteScout Image To Video SDK Documentation

Explore Samples

Sign Up for ByteScout Image To Video SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Image To Video SDK Home Page

Explore ByteScout Image To Video SDK Documentation

Explore Samples

Sign Up for ByteScout Image To Video SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next