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

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?

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.

Related

Convert .caf audio file to .wav audio file swift

I have recorded audio and saved in .caf format in document directory. I need to convert the .caf to .wav file to upload the file to server. I researched and didn't get much input in swift. Please help me out to find a solution?
Did you try AudioKit?
Maybe you can use AKConverter https://audiokit.io/docs/Classes/AKConverter.html

How to: Playm3u8 files offline in VLC

I'm using an offline terminal to create an .m3u8 file but I would like to play it using VLC. Every example so far has shown examples of using m3u8 online but this isn't an option for me. If you can play it offline using VLC how do you do so?
You have to download the playlist from m3u8 to watch it offline and to do that you have to either use youtube-dl or ffmpeg
i would recommend ffmpeg , and the command for downloading the m3u8 file goes like this :-
ffmpeg -i "here your m3u8 link" -c copy Output.mp4
This will download the highest quality video available in that m3u8 file.
To change quality you can use map command or simply download the m3u8 file and open it with notepad and there you will find links for other resolution.
m3u8 files are just playlists without actual contents, but just URL pointers. Those files are mostly being used these days for HLS.
While you can play the files while offline, you won't see anything unless you are also hosting the referenced Contents.

Getting .mp4 from .f4m stream url

Currently I have the following url
http://vpl.rtl.be/z//2018/08/21/CA00001318626_,400,600,800,1200,1800,.mp4.csmil/manifest.f4m?hdcore=1
which contains an .f4m file, which directs to an mp4 file.
I can't find a way to get that mp4 from that file (i just need the direct mp4 url or file).
How should I proceed? I have tried using ffmpeg or simply reading the file, with no luck.
I'm not much familiar with FFMpeg but you can try livestreamer :-)
Command line:
livestreamer "hds://http://vpl.rtl.be/z//2018/08/21/CA00001318626_,400,600,800,1200,1800,.mp4.csmil/manifest.f4m?hdcore=1" best -o video.ts
I tried in .mp4 format but it didn't like that, the file header shows FLV, you can use VLC Media Player to open the video.ts file.
Good luck!

Do I need to convert audio files to .wav first before converting to .caf?

I have several audio files which all of them are in .mp3 format. But playing .mp3 won't maximize the efficiency of audio playing on iOS. From one of research, .wav or .caf is a go for short loop or sound effect audio file used in game. Thus I need to convert this .mp3 file into those two formats.
Currently I use the following command to convert .mp3 to .caf.
afconvert -f caff -d LEI16 kick_sfx.mp3
However, I see that .caf is a container format thus I have a bad feeling that it's still not so efficient. According to that, I think I need to convert those .mp3 files to .wav first in order to maximize efficiency in playing audio file.
Do I need to really convert those (.mp3) files to .wav first before convert them again to .caf? Or using that command alone will do the work for me ?
Any additional info is welcome.

playing m4a files on finch

I have tried putting in the decoding options in the decoder file with finch in order to get .m4a files to play, but it when it actually plays the sounds, it comes out static. Any ideas on how to get this work?
Thanks
You can't play m4a files with Finch, because OpenAL doesn't load m4a files.
And it doesn't decode them either.
To play m4a files, you must use AVAudioPlayer.

Resources