0

How to convert .ogg file to any supported AVPlayer file format so that I can play it in app. Now if I am uploading .ogg file the player shows its raw data so how to solve this?

NSPratik
  • 4,714
  • 7
  • 51
  • 81
Amey
  • 795
  • 8
  • 31
  • see this https://stackoverflow.com/questions/10804046/playing-an-ogg-stream-in-ios – Prashant Tukadiya Dec 22 '17 at 07:12
  • i want no external lib added. Just want to convert .ogg to playable file format while player remains AVplayer . if i add other player my other scenario would crash . So just any algorithm to convert the data and compress it using swift language . @Prashant Tukadiya – Amey Dec 22 '17 at 07:16
  • any Supported Apple Format for Audio Which i can play using AVplayer would work – Amey Dec 22 '17 at 07:19
  • Sorry i am not aware about that. I found link that i share with you. :( – Prashant Tukadiya Dec 22 '17 at 07:21
  • why you don't want to use any Library ? here is one https://github.com/lixing123/ExtAudioFileConverter – Prashant Tukadiya Dec 22 '17 at 07:22
  • it does not convert .ogg file i think and any lib in swift ? – Amey Dec 22 '17 at 07:23

1 Answers1

2

You can use mobile-ffmpeg!

  1. Import mobile-FFmpeg to your project. If you do not know how to import, you can read this
  2. Use this MobileFFmpeg.execute("-hide_banner -y -i [filename].ogg -c:a libmp3lame -qscale:a 2 [filename].mp3") (I found this from the sample code of mobile-FFmpeg)
  3. And you will get the converted mp3 file in your project.

*note: if your .ogg file is from the server, please download it first.