AydinAdn/MediaToolkit

MedialToolKit not working on Mac Unity

Closed this issue · 2 comments

I've setup mediaToolKit to work perfectly on windows with Unity 2017, however for mac with Unity 2017 it doesn't appear to do anything, while the dll doesn't give any errors it doesn't appear to ever finish whatever I put inside the (Using var engine..). I even tried giving it nonexistent paths to files and it still runs forever inside the using statement. Code example shown below, any help on this would be much appreciated.

Does this not work on Mac or am I doing something wrong for Mac ?

// oldmedia = /Users/Sohail/Public/Temp/T_1.mp3 (path to file)
var oldMedia = new MediaFile { Filename = f.FullName };
// newmedia = /Users/Sohail/Public//Temp_new//T_1.ogg (path to file)
var newMedia = new MediaFile { Filename = item.Value};
using (var engine = new Engine())
      {
         // engine.Convert(oldMedia, newMedia); // doesn't finish 
	engine.GetMetadata(oldMedia); // doesn't finish
      }

So for mac you need to download and specify the ffmpeg in the using (var engine(pathTo_ffmpeg))thats made for mac (https://evermeet.cx/ffmpeg/).
Example listed below:

string ffpmeg_Path = "";

void Start() {
   ffpmeg_Path = Path.Combine (Application.streamingAssetsPath, "ffmpeg");
}

void ConvertFile(){
   // oldmedia = /Users/Sohail/Public/Temp/T_1.mp3 (path to file)
  var oldMedia = new MediaFile { Filename = f.FullName };
  // newmedia = /Users/Sohail/Public//Temp_new//T_1.ogg (path to file)
  var newMedia = new MediaFile { Filename = item.Value};
  using (var engine = new Engine(ffpmeg_Path))
  {
    // engine.Convert(oldMedia, newMedia); // works !
    engine.GetMetadata(oldMedia); // works !
  }
}

So for mac you need to download and specify the ffmpeg in the using (var engine(pathTo_ffmpeg))thats made for mac (https://evermeet.cx/ffmpeg/). Example listed below:

string ffpmeg_Path = "";

void Start() {
   ffpmeg_Path = Path.Combine (Application.streamingAssetsPath, "ffmpeg");
}

void ConvertFile(){
   // oldmedia = /Users/Sohail/Public/Temp/T_1.mp3 (path to file)
  var oldMedia = new MediaFile { Filename = f.FullName };
  // newmedia = /Users/Sohail/Public//Temp_new//T_1.ogg (path to file)
  var newMedia = new MediaFile { Filename = item.Value};
  using (var engine = new Engine(ffpmeg_Path))
  {
    // engine.Convert(oldMedia, newMedia); // works !
    engine.GetMetadata(oldMedia); // works !
  }
}

This solved it for me too!