I want to play a sequence of videos and images (like Snapchat does). By playing an image I mean having it show on the screen for a certain amount of time. I am using AVFoundation for media capture and playback, and I am using swift to develop this application.
I have .mp4 videos and .jpg images, and I was trying to think of the easiest way to convert the .jpg images to videos such that I could simply add everything to the array of assets that will be passed in as a parameter to the AVQueuePlayer initializer.
Does anybody have any insight on how to do this?
Related
I want to play video (.mp4 format) in background continuously(on loop). I tried using the MediaPlayer,AVFoundation but i didn't get the desired result.
I used another method after converting mp4 to gif, .gif worked for me but the quality was low. So please help me find the best method to solve my problem.
For what purpose is this? If you're trying to have a video background for a login screen or something of that sort, its better to stick with lower res GIFs. It will save you memory, infact you can get really high quality GIFs from .mp4 files using photoshop but the resolution and frames will eat up iPhone's memory.
You can create AVPlayer object in AppDelegate.
Then register its "MovieFinished" observer. In that notification, you can restart the video playing.
Hope this helps.
I want to implement such a function that enable users to make GIF directly from their camera.
In detail, I want to show users a camera view, and a record button. When the button is tapped, the camera starts to record video. In fact, however, behind the scene the camera is actually taking photos at constant speed, say 1 shot per 0.5 second. When the record ends, we got an array of images and then connect them into a GIF.
I think there might be 2 approaches:
1、Directly taking images: Use AVCaptureStillImageOutput's -captureStillImageAsynchronouslyFromConnection method. But it will block UI every time it is called.
2、Take a video and extract several images from it. I have checked video taking libraries such as PBJVision and SCRecorder, and noticed that taking video is typically writing data to a mp4 file locally. I cannot figure out how to extract images at specific time intervals from a video file. Also, is there a way to store the video in memory?
Could anyone help?
Creating Gif
Create and and export an animated gif via iOS?
Convert Images to gif using ios
Extract Images from Video
Get a particular frame by time value using AVAssetReader
Similar here Creating a Movie from Images
How do I export UIImage array as a movie?
You can use a library called 'Regift' by Matthew Palmer, which will convert video to GIF.
Here it is: https://github.com/matthewpalmer/Regift
You can also check out the following answer here on SO:
https://stackoverflow.com/a/28150109/3288936
Hope this will help! :)
In my app I want to give effect to audio and video file like it is given to Pheed Application. I want to mix audio recorded sound with predefine clips. And also want to give sound different effect like echo , surrounding Normal , And with video file I want to add different effects like sepia,.. I don't know which class library I have to use to implement6 this . Can any one suggest me any library for that or any way how to do that?
Here are a pair of libraries you can try:
For audio filters and effects you can try with The Amazing Audio Engine. It is build on top of Core Audio.
For video effects try GPUImage. I haven't tried it but it is supposed to work better than Core Image when handling videos.
I'm using AVMutableComposition and AVAssetExportSession to composite several discrete audio clips/files together into a single file, similarly to this post but there will be no "video" track. I'd like to give the track some visual appeal using a still image so that when the user plays the clip they don't just see a generic quicktime icon, ideally I'd replace the image with branding or something relevant to the audio content. How would I go about doing it and is there a way to do it without dramatically increasing file size(ie some way to have a really slow framerate or just something so its not generating 30 fps for what is non moving art.) Appreciate any help on this.
AVAssetWriter will allow you to create video from a still image. This question provides a great example of how to do so.
I want to play four videos on the same view within a small rectangular area, is that possible ?
I think you can do this with AVPlayer and using AVMutableComposition.
With AVMutableComposition you can combine multiple sources into one combined playback source - I'm currently working on an Application where i use this to combine different audio and video sources and play it back as a single track even though they come from seperate files.