I'm trying to add subtitles for a video. Both video file and subtitles files are downloaded on iphone (*in both vtt and srt format)
Example paths:
subtitle: file:///private/var/mobile/Containers/Data/Application/384B1E38-7536-4F52-A9E1-B7D8E5A1490B/Documents/1_665ba05feee690141b7_english.vtt*).
video file: file:///private/var/mobile/Containers/Data/Application/384B1E38-7536-4F52-A9E1-B7D8E5A1490B/Library/com.apple.UserManagedAssets.q1zdd9/1_665ba05f2b5aa225440dc840690141b7_4CD8B29737842BA5.movpkg
I have absolutely no idea how i should create or prepare those files to have a AVMediaSelectionGroup and be able to select a proper AVMediaCharacteristic on
Unfortunately most of tutorials contains only examples for hls streaming, but im not sure if it is valid for offline player.
How should i use AVAssetResourceLoaderDelegate or AVAssetResourceLoader and how should i create a single AVURLAsset with all subtitles?
Could you help me somehow and describe what should i do? I am aware that the question is imprecise, but in fact i do not know where should i start (describing a path - what i should do in steps would be appreciated).
Kind regards.
Related
I'm working with libffmpeg in an iOS app. My goal is to connect to an RTSP source and write the media out to a file that can later be used with the iOS media player. Ideally I'd like to do this without transcoding the incoming data. I also want to be able to later re-encode the media with AVAssetExportSession if the user chooses to do so.
Because I want to create a file that is compatible with iOS, I'm limited (I believe) to mpeg, mp4 or quicktime (mov) formats.
Whenever I try to use one of these formats, I see the following warnings during my call to avformat_write_header:
[mov # 0x16401c00] Codec for stream 0 does not use global headers but container format requires global headers
[mov # 0x16401c00] Codec for stream 1 does not use global headers but container format requires global headers
My understanding is that the header wants to know the ultimate file size, which I do not know (the RTSP server is live streaming a camera, and the user stops the recording whenever they want). I guess that makes sense, but I know that others have successfully done this using the ffmpeg command line, so I'm confused as to what else I need to do here.
If I ignore the warning, I can still proceed with writing the file. If I choose mpeg or mp4 formats, my app crashes when I call av_write_trailer. If I use mov, I can successfully close the file, and the file does play back, but usually fails when I try to hand it to the AVAssetExportSession.
I would appreciate any insight into this. Thanks.
Frank
I found what appears to be a solution -- at least, it eliminates the warning. I had to set the CODEC_FLAG_GLOBAL_HEADER on both the audio and video codecs, before calling avcodec_open2.
I have got multiple audio files on server.
I want to download all audio files first, and then when all are downloaded, i need to play them one after another.
What will be the best approach to achieve this?
Thanks!
Is there any way to set metadata like artist, title, genre etc. for an AAC file recorded with AVAudioRecorder?
For MP3 files there is the ID3 tag. However, I haven't been able to find an equivalent for AAC files. I have searched through the Apple Developer Docs without success but there must be some way to set those attributes because when playing an AAC file downloaded from iTunes in an audio player like VLC or foobar2000 it does recognize the metadata and even the album art.
(For recording the AAC files I use the code from Apple's Multimedia Programming Guide.)
I don't think you can add metadata to your audio file when using AVAudioRecorder. I think you will have to use an extra AVAssetExportSession pass to do that, like is done in this question
I am making an application which should be able to play any videos embedded in a PPTx. Currently using Quicklook Framework for iOS I am able to see the text or any images but not able to play the video. I thought of one solution as, Converting the PPTx to zip and then parse the XML files to give the video and then play, which doesn't look very practical as it needs to be done for every file where the structure keeps changing with very slide/PPT Slideshark is able to play videos embedded in a PPT. Any Ideas on how to achieve this ?
Converting PPTs into HTML5 is one of the solution.
I have a case where i need to get audio out from video file. Is this possible in iOS ??
I need only the output file as an audio any type. I have the video file in my documents directory which I record earlier in application.
1.Convert Video Reverse
2.Extract audio from a video file
3.Add Audio & Video Together
Download Code From Here
may be helpful to you.
Yes, it can be done. See Extract audio from video file for ideas.
Extracting is probably the more accurate term.