Bytescout Image To Video SDK can show conversion progress during images to video conversion.
The VB.NET and C# sample codes below demonstrate how to read conversion progress when you convert JPG, PNG, BMP images to AVI or WMV video with Image To Video SDK.
Visual Basic .NET
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | Imports System.Diagnostics Imports System.Threading Imports BytescoutImageToVideoLib Class Program Friend Shared Sub Main( ByVal args As String ()) Console.WriteLine( "Converting JPG slides into video, please wait.." ) ' Create BytescoutImageToVideoLib.ImageToVideo object instance Dim converter As New ImageToVideo() ' Activate the component converter.RegistrationName = "demo" converter.RegistrationKey = "demo" ' set default in effect for slides (you can also set effects for each single slide) converter.Slides.DefaultSlideInEffect = 1 ' teFadeIn (1) - fades in effect for slides transition converter.Slides.DefaultSlideInEffectDuration = 500 ' 500 msec for in effect ' Add images and set the duration for every slide Dim slide As Slide slide = DirectCast (converter.AddImageFromFileName( "........slide1.jpg" ), Slide) slide.Duration = 3000 ' 3000ms = 3s slide = DirectCast (converter.AddImageFromFileName( "........slide2.jpg" ), Slide) slide.Duration = 3000 slide = DirectCast (converter.AddImageFromFileName( "........slide3.jpg" ), Slide) slide.Duration = 3000 ' Set output video size converter.OutputWidth = 400 converter.OutputHeight = 300 ' Set output video file name converter.OutputVideoFileName = "result.wmv" Console.WriteLine( "Conversion started. Hit a key to abort..." ) ' Run the conversion converter.Run() ' Show conversion progress: Dim i As Integer = 0 Dim spin As Char () = New Char () { "|" c, "/" c, "-" c, "" c} While Not Console.KeyAvailable AndAlso converter.IsRunning Dim progress As Single = converter.ConversionProgress Console.WriteLine([ String ].Format( "Converting images {0}% {1}" , progress, spin(i))) Console.CursorTop -= 1 i = i + 1 i = i Mod 4 Thread.Sleep(50) End While If converter.IsRunning Then converter. Stop () Console.WriteLine( "Conversion aborted by user." ) Else Console.WriteLine( "Conversion competed successfully." ) End If ' Open the result video file in default media player Process.Start( "result.wmv" ) Console.WriteLine() Console.WriteLine( "Hit any key..." ) Console.ReadKey() End Sub End Class |
Visual C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | using System; using System.Diagnostics; using System.Threading; using BytescoutImageToVideoLib; namespace ConversionProgress { class Program { static void Main(string[] args) { Console.Write( "Converting JPG slides into video, please wait.." ); // Create BytescoutImageToVideoLib.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 = (Slide)converter.AddImageFromFileName( "..\..\..\..\slide1.jpg" ); slide.Duration = 3000; // 3000ms = 3s slide = (Slide)converter.AddImageFromFileName( "..\..\..\..\slide2.jpg" ); slide.Duration = 3000; slide = (Slide)converter.AddImageFromFileName( "..\..\..\..\slide3.jpg" ); slide.Duration = 3000; // Set output video size converter.OutputWidth = 400; converter.OutputHeight = 300; // Set output video file name converter.OutputVideoFileName = "result.wmv" ; Console.WriteLine( "Conversion started. Hit a key to abort..." ); // Run the conversion converter.Run(); // Show conversion progress: int i = 0; char[] spin = new char[] { '|', '/', '-', '\' }; while (!Console.KeyAvailable && converter.IsRunning) { float progress = converter.ConversionProgress; Console.WriteLine( String .Format( "Converting images {0}% {1}" , progress, spin[i++])); Console.CursorTop--; i %= 4; Thread.Sleep(50); } if (converter.IsRunning) { converter. Stop (); Console.WriteLine( "Conversion aborted by user." ); } else { Console.WriteLine( "Conversion competed successfully." ); } // Open the result video file in default media player Process.Start( "result.wmv" ); Console.WriteLine(); Console.WriteLine( "Hit any key..." ); Console.ReadKey(); } } } |
Sorry! This product is not available.
Please click here to visit main page for the list of all available products and solutions.
Product Links: