extracting mp3 file duration using AudioQueueServices - iphone

I have implemented a streaming mp3 player using AudioQueueServices, that downloads mp3s over an NSURLConnection. Playback, pausing, and seeking work great, however I can't figure out how to extract the duration of the audio from the mp3 files while they are still being downloaded. I'd like to be able to pull the info from the id3 tags but am clueless as to how to do that. Any thoughts?

You cant directly view the duration of the Mp3 file, but you can work it out by file size, a song that is 3 minuets long is between 1 megabyte.

Related

How to play video while it is downloading using AVPro video in unity3D?

I want to play the video simultaneously while it is downloading via unitywebrequest. Will AVPro video support this? If so please provide me some guidance, as i am new to unity and avpro video. I can able to play the video which is downloaded fully through FullscreenVideo.prefab in AVPro demo. Any help will be much appreciated.
There are two main options you could use for displaying the video while it is still downloading.
Through livestream
You can stream a video to AVPro video using the "absolute path or URL" option on the media player component, then linking this to a stream in rtsp, MPEG-DASH, HLS, or HTTP progressive streaming format. Depending on what platforms you will be targeting some of these options will work better than others
A table of which file format supports what platform can be found in the AVProVideo Usermanual that is included with AVProVideo from page 12 and onwards.
If you want to use streaming you also need to set the "internet access" option to "required" in the player settings, as a video cannot stream without internet access.
A video that is being streamed will automatically start/resume playing when enough video is buffered.
This does however require a constant internet connection which may not be ideal if you're targeting mobile devices, or unnecessary if you're planning to play videos in a loop.
HLS m3u8
HTTP Live Streaming (HLS) works by cutting the overall stream into shorter, manageable hunks of data. These chunks will then get downloaded in sequence regardless of how long the stream is. m3u8 is a file format that works with playlists that keeps information on the location of multiple media files instead of an entire video, this can then be fed into a HLS player that will play the small media files in sequence as dictated in the m3u8 file.
using this method is usefull if you're planning to play smaller videos on repeat as the user will only have to download each chunk of the video once, which you can then store for later use.
You can also make these chunks of video as long or short as you want, and set a buffer of how many chunks you want to have pre-loaded. if for example you set the chunk size to 5 seconds, with a buffer of 5 videos the only loading time you'll have is when loading the first 25 seconds of the video. once these first 5 chunks are loaded it will start playing the video and load the rest of the chunks in the background, without interrupting the video (given your internet speed can handle it)
a con to this would be that you have to convert all your videos to m3u8 yourself. a tool such as FFMPEG can help with this though.
references
HLS
m3u8
AVPro documentation

Saving m3u8 video to disk in swift cocoa

I am trying to save any m3u8 stream playlist as video to disk as 1 complete video file, similar to vlc. I can create an AVAsset and play it in an AVPlayer fine, however the m3u8 links i have tried all return false from asset.isExportable so using AVAssetExportSession does not work. I thought it might be possible opening the link as an InputStream and then writing it to an OutputStream but was lost on how to do this. Is this a viable option or will it only return the actual m3u8 file instead of the .ts video links? Any guidance in the right direction would be appreciated. I am fine doing the research on how to use the different classes, i'm just kinda lost on where to go from here.
Thank you,
Phil
Building a single video from all the streams in a m3u8 playlist may not actually give you what you want, depending on the m3u8 file.
This is because m3u8 playlists can contain multiple bit rate versions for a single video - so if you added them all together you would get the same video with different quality levels (bit rates) one after another.
Its also worth noting that some videos streams will be encrypted, in fact most high value streams such as Netflix etc will be, so downloading them will not allow you to play them back unless you do it as part of the providers own 'download and go' service.
Finally, some services may make it hard for you to access the streams by requiring some form of authentication in parallel with the video stream URL.
Assuming all the above is fine or does not apply in your case, then the video files themselves can be downloaded as files using a HTTP downloading function. Good examples of these exist such as: https://stackoverflow.com/a/35510812/334402

Video Karaoke Development on iPhone

I have a karaoke app that takes mp3+g files and mixes in the mic (using audio units)... and is able to record the final results to a raw pcm file.
I have potential clients asking me if I can do the same with a karaoke video file. So, can I...
1) playback a video and mix in the microphone audio?
2) take #1 and record it to a video file?
3) possibly even take the video camera and microphone inputs, and video audio... and save this to a file?
Thinking about this can I... take an mp3, camera and microphone inputs and mix all of these to a video file?
Thanks for any feedback!
Brian
Yes, all of these are possible. With the CD+G format, you will be a lot better off converting those to h.264 on the desktop and then loading them as movies with an AAC audio track. Attempting to write a CD+G parser for iOS would be a nightmare since so many CD+G files are badly broken. Also, CD+G files are shocking large, much larger than the MP3 files because CD+G is dumb uncompressed video from the 80's. It is a silly format.

How to play large duration video files in iPhone/iPad

I am developing a video app. Some video files having a long (43 minuite) duration and some files are less than 10 min duration.
Apple suggested if video duration is more than 10 min they want me use Httplive streaming. I am placing video control in web view and am loading the URL.
If I used large video files in MP4 format, will I get any problems? And what video size do I need to use that both iPhone and iPad orientates.
Can you suggest me video size, duration, and formats. Thanks in advance.
Apple will reject any app that doesn't use HTTP Live Streaming for videos longer than 10 minutes. So if you're using the native video player then you'll have to encode your video files accordingly.

Flv file set thumbnail from frame

I have many videos in .flv and .mp4 formats. I store then in one Windows folder and re-name after downloading so that it becomes easy to find one that I want to play.
It would be best if I can create thumbnail from one of the frames of video file.
Is there a program/utility in which I can open the .flv or .mp4 file, play, pause and take the screen/frame and set it as thumbnail of that file?
I did my best to find it on internet but failed hence thought to reach out to Gurus.
Thanks in advance,
Jay
I think ffmpeg and mencoder can do this