neurospeech / xamarin-android-ffmpeg

Xamarin Android FFMpeg binding
MIT License
30 stars 6 forks source link

Conversion never takes place #20

Open NVentimiglia opened 6 years ago

NVentimiglia commented 6 years ago

package id="Xamarin.Android.MP4Transcoder" version="1.0.9" targetFramework="monoandroid60"

    public class VideoUtilityAndroid
    {
        public async Task<string> ConvertFileAsync(
            string inputPath,
            Action<int, int> onProgress = null)
        {

            File inputFile = new File(inputPath);

            if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
            {
                try
                {
                    File ouputFile = new File(inputFile.CanonicalPath.Replace(".mp4", "_min.mp4"));

                    double percent = 0;

                    await Xamarin.MP4Transcoder.Transcoder.For960x540Format().ConvertAsync(
                          inputFile,
                          ouputFile, f =>
                          {
                             // this is never called
                              percent = f;
                              onProgress?.Invoke((int)(f * (double)100), 100);
                          });

                    // file is empty at this point
                    return ouputFile.Path;
                }
                catch (Exception ex)
                {
                    LogController.LogError(ex);
                }
            }

            return inputFile.Path;
        }
    }
ackava commented 5 years ago

Could you please add some log?