Amey
Amey

Reputation: 815

How to convert .ogg file to .mp3/.caf to play in AVPlayer?

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?

Upvotes: 1

Views: 1288

Answers (1)

Yenting Chen
Yenting Chen

Reputation: 31

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.

Upvotes: 3

Related Questions