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?
Asked
Active
Viewed 1,194 times
0
-
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 Answers
2
You can use mobile-ffmpeg!
- Import mobile-FFmpeg to your project. If you do not know how to import, you can read this
- 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) - And you will get the converted mp3 file in your project.
*note: if your .ogg
file is from the server, please download it first.

Yenting Chen
- 21
- 3