Programming with .NET - Generalhttp://forums.silverlight.net//17.aspx/1?Programming+with+NET+GeneralGeneral discussions around authoring Silverlight .NET applications.Mon, 01 Jan 0001 00:00:00 -05001746238http://forums.silverlight.net//p/14104/46238.aspx/1?How+to+capture+a+thumbnail+image+of+a+video+How to capture a thumbnail image of a video? <p>Hi,</p> <p>How to capture a thumbnail image of a video in SilverLight 2 ?</p> <p>&nbsp;Thanks</p> <p>&nbsp;</p> 2008-04-14T06:35:36-04:0046898http://forums.silverlight.net//p/14104/46898.aspx/1?Re+How+to+capture+a+thumbnail+image+of+a+video+Re: How to capture a thumbnail image of a video? <p>Hello, you can't do that in Silverlight. You'll have to do that on the server. The simplest way to capture capture a screen shoot is using WPF's RenderTargetBitmap. You will of course need .NET 3.0 or above on the server. Then in your web service application, you can use Process.Start method to start a WPF application. In the WPF application, you can write something like this:</p> <font size="2"> <p></font><font color="#0000ff" size="2">private</font><font size="2"> </font><font color="#2b91af" size="2">MediaPlayer</font><font size="2"> player = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">MediaPlayer</font><font size="2">();</font></p> <p>&nbsp;</p> <font size="2"></font><font color="#0000ff" size="2">private</font><font size="2"> </font><font color="#0000ff" size="2">void</font><font size="2"> Window_Loaded(</font><font color="#0000ff" size="2">object</font><font size="2"> sender, </font><font color="#2b91af" size="2">RoutedEventArgs</font><font size="2"> e)</font><font size="2"> <p>{</p> </font><font color="#2b91af" size="2">VideoDrawing</font><font size="2"> vd = </font> <font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">VideoDrawing</font><font size="2">();</font><font size="2"> <p>player.Open(</font><font color="#0000ff" size="2">new</font><font size="2"> </font> <font color="#2b91af" size="2">Uri</font><font size="2">(</font><font color="#a31515" size="2">&quot;expressionstudio.wmv&quot;</font><font size="2">, </font><font color="#2b91af" size="2">UriKind</font><font size="2">.Relative));</p> vd.Rect = </font><font color="#0000ff" size="2">new</font><font size="2"> </font> <font color="#2b91af" size="2">Rect</font><font size="2">(0, 0, 300, 300);</font><font size="2"> <p>vd.Player = player;</p> player.MediaOpened &#43;= </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">EventHandler</font><font size="2">(player_MediaOpened);</font><font size="2"> <p>player.Play();</p> <p><font color="#008000" size="2">//You may want to pass a parameter to the WPF application to indicate which frame you want to capture.</font></p> player.Position = </font><font color="#2b91af" size="2">TimeSpan</font><font size="2">.FromSeconds(30);</font><font size="2"> <p>}</p> </font> <p>&nbsp;</p> <font color="#0000ff" size="2">void</font><font size="2"> player_MediaOpened(</font><font color="#0000ff" size="2">object</font><font size="2"> sender, </font><font color="#2b91af" size="2">EventArgs</font><font size="2"> e)</font><font size="2"> <p>{</p> </font><font color="#2b91af" size="2">DrawingVisual</font><font size="2"> drawingVisual = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">DrawingVisual</font><font size="2">();</font><font size="2"> <p></font><font color="#2b91af" size="2">DrawingContext</font><font size="2"> drawingContext = drawingVisual.RenderOpen();</p> drawingContext.DrawVideo(player, </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">Rect</font><font size="2">(</font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">Point</font><font size="2">(0, 0), </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">Point</font><font size="2">(300, 300)));</font><font size="2"> <p>drawingContext.Close();</p> </font><font color="#2b91af" size="2">RenderTargetBitmap</font><font size="2"> rtb = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">RenderTargetBitmap</font><font size="2">(300, 300, 96, 96, </font><font color="#2b91af" size="2">PixelFormats</font><font size="2">.Pbgra32);</font><font size="2"> <p>rtb.Render(drawingVisual);</p> <p><font color="#008000" size="2">//Do whatever you want with this bitmap and then shutdown the WPF application.</p> </font> <p>player.Stop();</p> <p><font color="#2b91af" size="2">App</font>.Current.Shutdown();</p> <p>}</p> </font> <p>You can also try to use the WPF APIs directly in the web service application. But I haven't tested that.</p> 2008-04-16T05:02:55-04:00150781http://forums.silverlight.net//p/14104/150781.aspx/1?Re+How+to+capture+a+thumbnail+image+of+a+video+Re: How to capture a thumbnail image of a video? <p>Is there any way to elaborate on this anymore or does anyone els ehave an incite?</p> 2008-12-20T23:15:40-05:00153825http://forums.silverlight.net//p/14104/153825.aspx/1?Re+Re+How+to+capture+a+thumbnail+image+of+a+video+Re: Re: How to capture a thumbnail image of a video? <p>Yi-Lun Luo --</p> <p>Thanks very much.&nbsp; I'm using a web hosting service (DiscountASP.NET).&nbsp; Do you think this would work there?</p> <p>Thanks for your help.</p> 2008-12-30T05:35:08-05:00587626http://forums.silverlight.net//p/14104/587626.aspx/1?Re+How+to+capture+a+thumbnail+image+of+a+video+Re: How to capture a thumbnail image of a video? <p>It's easy, just use some screen recorder can help you <a title="capture pictures from video" href="http://www.screenrecord.net/capture-pictures-from-video.html" target="_blank"> capture pictures from video</a>. It can record whatever on your screen as video file, you just need to play the video on your computer screen, and it will help you record image of the video. And it also can help you save the image to standard format file.</p> 2011-08-24T06:06:09-04:00