Creating video from WPF/Silverlight animation

☆樱花仙子☆ 提交于 2019-12-19 21:20:12

问题


I have a animation written in XAML. I need to create a video (AVI) from that animation. Is there a way to do that ?


回答1:


Here is how to do it for WPF (i.e. not Silverlight)

http://blogs.msdn.com/b/saveenr/archive/2008/09/22/wpf-xaml-saving-an-animation-as-an-avi-video-file.aspx




回答2:


If you have Expression Encoder, you can do the following:

  1. Create a blank movie that has as many frames as your animation (you can change the length later if you get it wrong)
  2. Use the XAML Animation overlay option to add your XAML-based animation
  3. Render out the animation to WMV
  4. Convert the video from WMV to AVI (many free tools will do this)

I believe the free version of Expression Encoder will handle this.

If Expression Encoder won't work for you, you can also use screen capture software like Jing or Camtasia.




回答3:


With Silverlight my approach was:

  1. Take canvas snapshots into WriteableBitmap;
  2. Convert them to .jpg with free ImageTools Silverlight library;
  3. Save it to a folder;
  4. Launch FFmpeg.exe (from Silverlight) and convert that to video.

If you are not able to launch .exe files then the only option is to send each .jpg file (as byte array) to the server and use "Process.Start" there; and then send resulting video back to Silverlight.

Because ImageTools is not very quick, I had to resort to saving each image as .bmp and have libjpeg-turbo to convert them to .jpg.



来源:https://stackoverflow.com/questions/1454158/creating-video-from-wpf-silverlight-animation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!