How to measure the band width in swift [closed] - ios

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a video and audio streaming urls.I want to check the user's band width if its slow it should play the audio. If its fast enough should play the video. How can I check whether the bandwidth is slow or fast in swift
m3u8 Structure
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM- INF:BANDWIDTH=814508,CODECS="avc1.66.51,mp4a.40.34",RESOLUTION=720x576
chunklist_w247403833.m3u8

If your video and audio files are of the same content, then you should be able to configure a m3u8 file for your needs. I've not done this in practice but you should be able to create a m3u8 file like the example below and Apple's media streamer should then automatically detect the bandwidth and play the appropriate file, and as the bandwidth changes Apple should automatically switch files to provide the best experience
(you'll need to tweak the file below but this should give you a head start)
#EXTM3U
 
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=216000,RESOLUTION=400x300
amazingVideo.m3u8
 
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=100000,RESOLUTION=400x300
justAudio.m3u8

Related

WebRTC iOS: Audio/Video stream recording [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am trying to record incoming/outgoing audio/video streams in my iOS app that uses GoogleWebRTC pod. so far I haven't found any api that allows us to record Audio/Video streams. I tried to record local video feed from the camera using AVCaptureSession, but doing this freezes the outgoing video stream. this happens probably because multiple AVCaptureSession instances cannot use the same input device.
Is there any other way to record local and/or remote streams from WebRTC in iOS?
Replay kit, but that has limitations.
The alternative method is using the actual lib, no the cocoa pods, and extract audio/video from each incoming stream.
Once you have the actual video/audio currently being displayed/played you can combine and mux as you see fit.
Very complex though

How can live video be streamed from an iOS device to a server? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to be able to stream live video from an iOS device to a server. I tried to use an AVCaptureOutput that captures each frame as a CMSampleBuffer and appends it using an AVAssetWriter, but I don't know when or how to take the input from the file and send it to the server. How should it be formatted? How do I know when to send it?
Though i am not sharing any code with you, I am sharing my logic with you what i have done in one of my app.
First way(The easy one): There are lots of low cost third party library available for your use.
Second way(The hard one): Create small chunk of video for example 2sec or less, keep them in queue and upload it on the server(don't use afnetworking or http method it will slow down the process use some chat server like node.js or other). And keep one text file or db entry where you keep the track of the chunk file and its sequence. And once your first chunk is uploaded you can use ffmpg to make a video from the actual chunk, the more chunk you got add them in the main video file, and if you play the actual video on the device you don't have to do any more modification it will automatically fetch the new part once it is changed on the server.
Thank You. Hope it helps you.

How to get Fingerprint value of audio file in iphone? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
If i record audio in noisy background and then compare recorded audio file with local saved audio file to check both are same song are not ? In iPhone
How Shazam and Sound Hound app works to generate Fingerprint of recorded audio in iPhone?
can anyone explore knowledge on algorithm to generate Fingerprint from audio file in ios.
Thanks
The fast (but possibly not very helpful) answer is: They probably do a Fourier Transform of the audio and compare. If you have never heard of Fourier before, you may want to find an API for it - the transform itself is not a programming problem, it's a math/signals problem.

How to convert CAF file to MP3 programmatically [duplicate]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I realize this question has been asked before, but I haven't seen an answer that works for my needs. Basically I have full length songs in .caf format but I need to be able to upload/download them from a server. Is it viable to do compression (to something like .mp3 or .wav) on the iPhone and then send them to the server? How would I go about doing this?
Refer to AudioConverterServices.. the function that does the magic trick is AudioConverterNew.. however note that you can only convert from a variable bit rate (VBR) file to PCM (lossless format), and from PCM to VBR.. so in your case you will have to convert the file from .caf to PCM, then from PCM to .mp3 or whatever format you want.
For a comprehensive example that illustrates all the steps necessary in doing an audio conversion.. download the free sample code for the book Learning Core Audio. You want chapter 6 sample code for audio conversion. (anyone who is serious about core audio should buy that book).
Mp3 encoding on an iPhone requires finding and using a non-Apple-provided library. There is nothing built-in that will do mp3 encoding, only AAC.
Using Lame, you can do this. Ther is no default function for this. It will also reduce the file size also. For 60 second audio file .caf will take approx 5mb - 10mb but after converting to .mp3 it will take 0.6mb to 0.7mb. Set 'Enable Bitcode' to 'NO' in build setting for new xocde, otherwise you will get error.
For sample code use this LINK.

Convert .caf to .mp3 on iPhone [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I realize this question has been asked before, but I haven't seen an answer that works for my needs. Basically I have full length songs in .caf format but I need to be able to upload/download them from a server. Is it viable to do compression (to something like .mp3 or .wav) on the iPhone and then send them to the server? How would I go about doing this?
Refer to AudioConverterServices.. the function that does the magic trick is AudioConverterNew.. however note that you can only convert from a variable bit rate (VBR) file to PCM (lossless format), and from PCM to VBR.. so in your case you will have to convert the file from .caf to PCM, then from PCM to .mp3 or whatever format you want.
For a comprehensive example that illustrates all the steps necessary in doing an audio conversion.. download the free sample code for the book Learning Core Audio. You want chapter 6 sample code for audio conversion. (anyone who is serious about core audio should buy that book).
Mp3 encoding on an iPhone requires finding and using a non-Apple-provided library. There is nothing built-in that will do mp3 encoding, only AAC.
Using Lame, you can do this. Ther is no default function for this. It will also reduce the file size also. For 60 second audio file .caf will take approx 5mb - 10mb but after converting to .mp3 it will take 0.6mb to 0.7mb. Set 'Enable Bitcode' to 'NO' in build setting for new xocde, otherwise you will get error.
For sample code use this LINK.

Resources