All Projects → neurospeech → xamarin-android-ffmpeg

neurospeech / xamarin-android-ffmpeg

Licence: MIT license
Xamarin Android FFMpeg binding

Programming Languages

powershell
5483 projects
C#
18002 projects

Projects that are alternatives of or similar to xamarin-android-ffmpeg

Xamuidemo
Xamarin Forms Login Page UI Kit
Stars: ✭ 82 (+182.76%)
Mutual labels:  xamarin-android
Xamarin.forms.videoplayer
A Xamarin Forms control to render the native video player on every platform.
Stars: ✭ 140 (+382.76%)
Mutual labels:  xamarin-android
Improvexamarinbuildtimes
Tips and tricks on how to speed up the time it takes to compile a Xamarin app
Stars: ✭ 180 (+520.69%)
Mutual labels:  xamarin-android
Xaml Code Experiences
A collection of the experiences I have collected during days of Xamarin and Wpf, while following the MVVM design pattern.
Stars: ✭ 114 (+293.1%)
Mutual labels:  xamarin-android
Xamarin.gradlebindings
VS add-in. Creates Xamarin.Android Binding Projects using gradle
Stars: ✭ 136 (+368.97%)
Mutual labels:  xamarin-android
Workoutwotch
Repository for my video series on building an iOS app in .NET.
Stars: ✭ 156 (+437.93%)
Mutual labels:  xamarin-android
Googleclientplugin
Google Client Plugin for Xamarin iOS and Android
Stars: ✭ 69 (+137.93%)
Mutual labels:  xamarin-android
Xamarin Demos
This repository contains the Syncfusion Xamarin UI control’s samples and the guide to use them.
Stars: ✭ 218 (+651.72%)
Mutual labels:  xamarin-android
Plugin.audiorecorder
Audio Recorder plugin for Xamarin and Windows
Stars: ✭ 140 (+382.76%)
Mutual labels:  xamarin-android
Xamarinandroidtutorial
Step by step to build android apps with C#. Code files for YouTube tutorial
Stars: ✭ 172 (+493.1%)
Mutual labels:  xamarin-android
Arcgis Toolkit Dotnet
Toolkit for ArcGIS Runtime SDK for .NET
Stars: ✭ 125 (+331.03%)
Mutual labels:  xamarin-android
Xamarin Docs
Xamarin Documentation - public content repo
Stars: ✭ 136 (+368.97%)
Mutual labels:  xamarin-android
Authenticatorpro
📱 Two-Factor Authentication (2FA) client for Android + Wear OS
Stars: ✭ 155 (+434.48%)
Mutual labels:  xamarin-android
Ffimageloading
Image loading, caching & transforming library for Xamarin and Windows
Stars: ✭ 1,288 (+4341.38%)
Mutual labels:  xamarin-android
Denunciado
This project born from the need from people to have a way of communication between municipalities and communities. Some municipalities, have their platforms, but they are complex to validate the veracity of complaints. Denounced, it was born with the purpose of offering a free platform to these municipalities. Denounced consists of three main modules developed with Microsoft technologies, using the .Net Framework and Xamarin for its development: 1. Back End Web Project: Module of administration of the complaints, by the employees of the town councils. In this tool, the employees of the city council receive, validate, report and close the complaints, after being served. 2. Web Portal Client: It consists of a web project, so that the community make their complaints, in the same, the users of the service create a profile, must specify when making their complaint, evidence to support this. Through the portal, they can see the complaints of other community members, follow it, give their opinion or provide possible solutions or more evidence. 3. Mobile Project: It has the same functionalities as the web portal, with the addition, that the automatic location can be sent, from the cell phone.
Stars: ✭ 183 (+531.03%)
Mutual labels:  xamarin-android
Faceoff
An iOS, Android and UWP app created in Xamarin.Forms that uses Microsoft's Cognitive Emotion API Services to compare facial expressions
Stars: ✭ 79 (+172.41%)
Mutual labels:  xamarin-android
Simpleauth
The Simplest way to Authenticate and make Rest API calls in .Net
Stars: ✭ 148 (+410.34%)
Mutual labels:  xamarin-android
Connectivityplugin
Connectivity Plugin for Xamarin and Windows
Stars: ✭ 253 (+772.41%)
Mutual labels:  xamarin-android
Xamarin Playground
Random cool stuff I play around using Xamarin.. :3 Some of these cool projects I feature them on my blog, with step by step explanation. :) Don't forget to check it out. Go to: theconfuzedsourcecode.wordpress.com
Stars: ✭ 183 (+531.03%)
Mutual labels:  xamarin-android
Microsoft.maui.graphics
Stars: ✭ 160 (+451.72%)
Mutual labels:  xamarin-android

xamarin-android-ffmpeg

Xamarin Android FFMpeg binding

For Android 6.0 onwards, use Xamarin.Android.MP4Transcoder

Android 6.0 onwards, text relocations are strictly prohibited, many source files used in ffmpeg use text relocations so ffmpeg will never run on future android builds unless they rewrite large library and replace them with alternative of text relocations. For this, only alternative is to use Android's native Mp4 transcoder.

MP4Transcoder internally uses https://github.com/ypresto/android-transcoder , please read license before using Xamarin.Android.MP4Transcoder

    Install-Package Xamarin.Android.MP4Transcoder


         if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) {

            await Xamarin.MP4Transcoder.Transcoder.For720pFormat().ConvertAsync(inputFile, ouputFile, f => {
                onProgress?.Invoke((int)(f * (double)100), 100);
            });
            return ouputFile;

        }

Big Thanks

https://github.com/WritingMinds/ffmpeg-android-java

Licensing

This code is licensed under MIT, however, you must use this library by accepting and following licensing terms mentioned in the source project at https://github.com/WritingMinds/ffmpeg-android-java

Nuget Package

You can download Xamarin.Android.FFmpeg package from Nuget Package manager or run following command in Nuget Package Console.

    Install-Package Xamarin.Android.FFmpeg

Usage

    public class VideoConverter 
    {

        public VideoConverter()
        {

        }

	/**
	* This method must be called from UI thread.
	***/
        public Task<File> ConvertFileAsync(Context context,
            File inputFile, 
            Action<string> logger = null, 
            Action<int,int> onProgress = null)
        {
            File ouputFile = new File(inputFile.CanonicalPath + ".mpg");

            ouputFile.DeleteOnExit();

            List<string> cmd = new List<string>();
            cmd.Add("-y");
            cmd.Add("-i");
            cmd.Add(inputFile.CanonicalPath);

            MediaMetadataRetriever m = new MediaMetadataRetriever();
            m.SetDataSource(inputFile.CanonicalPath);

            string rotate = m.ExtractMetadata(Android.Media.MetadataKey.VideoRotation);

            int r = 0;

            if (!string.IsNullOrWhiteSpace(rotate)) {
                r = int.Parse(rotate);
            }

            cmd.Add("-b:v");
            cmd.Add("1M");

            cmd.Add("-b:a");
            cmd.Add("128k");


            switch (r)
            {
                case 270:
                    cmd.Add("-vf scale=-1:480,transpose=cclock");
                    break;
                case 180:
                    cmd.Add("-vf scale=-1:480,transpose=cclock,transpose=cclock");
                    break;
                case 90:
                    cmd.Add("-vf scale=480:-1,transpose=clock");
                    break;
                case 0:
                    cmd.Add("-vf scale=-1:480");
                    break;
                default:

                    break;
            }

            cmd.Add("-f");
            cmd.Add("mpeg");

            cmd.Add(ouputFile.CanonicalPath);

            string cmdParams = string.Join(" ", cmd);

            int total = 0;
            int current = 0;

	await FFMpeg.Xamarin.FFMpegLibrary.Run(
		context,
		cmdParams 
		, (s) => {
			logger?.Invoke(s);
			int n = Extract(s, "Duration:", ",");
			if (n != -1) {
				total = n;
			}
			n = Extract(s, "time=", " bitrate=");
			if (n != -1) {
				current = n;
				onProgress?.Invoke(current, total);
			}
		});

            return ouputFile;
        }

        int Extract(String text, String start, String end)
        {
            int i = text.IndexOf(start);
            if (i != -1)
            {
                text = text.Substring(i + start.Length);
                i = text.IndexOf(end);
                if (i != -1)
                {
                    text = text.Substring(0, i);
                    return parseTime(text);
                }
            }
            return -1;
        }

        public static int parseTime(String time)
        {
            time = time.Trim();
            String[] tokens = time.Split(':');
            int hours = int.Parse(tokens[0]);
            int minutes = int.Parse(tokens[1]);
            float seconds = float.Parse(tokens[2]);
            int s = (int)seconds * 100;
            return hours * 360000 + minutes * 60100 + s;
        }

    }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].