Windows and Windows Phone apps can finally use FFmpeg.

Source: Internet
Author: User

(This article also published in my public number "dotnet daily Essence article", Welcome to the right QR code to pay attention to. )

Preface: It's difficult to develop a media player that supports multiple formats on a Windows phone because you can't take advantage of an open source library like Ffmpege. But right now, Microsoft has provided an open source Ffmpeginterop to solve this problem.

Due to the limitations of the WINRT and Windows Phone platforms, the above app can only play several formats supported by the built-in multimedia player (such as wmv,mp4, etc.), although these formats still satisfy most cases. But if you're going to develop a format that supports a more comprehensive player (or if your software intends to play some extra formats, such as MKV, FLV, and MOV), then it's a bit of a hassle, because some of the common open source multimedia libraries can't be used directly. Even the famous software such as VLC has been slow to launch WP version.

Microsoft has released a series of compilation instructions to build and WINRT compatible ffmpeg. However, this can lead to performance loss. To solve this problem, Microsoft recently released an open source library called Ffmpeginterop on GitHub to solve this problem. This open source Library uses Ffmpege to process media content, but playback uses the Windows Media Framework. This way you can get better performance because the Windows Media Framework can take advantage of hardware acceleration. Microsoft has also released a sample Media Player app written in C #, C + +, and JavaScript.

The general usage is:

    1. Creates a Ffmpeginterop object that is inserted into the XAML MediaElement object or in the Winjs HTML5 video component
    2. Use Fileopenpicker to open a local file as a pass-through to Ffmpeginterop

The C # code for the above steps is similar to the following:

   1://Instantiate FFmpeg object and pass the stream from opened file
   2: irandomaccessstream readstream = await file. OpenAsync (Fileaccessmode.read);
   3:false);
   4:
   5://Pass Mediastreamsource to Media Element
   6: Mediaelement.setmediastreamsource (Ffmpegmss.getmediastreamsource ());
More detailed usage can be understood by "reading the original". The GitHub address of the item can also be found from the original address.

(in particular, Microsoft's homepage on GitHub also lists a lot of open-source projects, a treasure that cannot be missed.) )

Original address: http://blogs.windows.com/buildingapps/2015/06/05/using-ffmpeg-in-windows-applications/

Windows and Windows Phone apps can finally use FFmpeg.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.