Code Monkey home page Code Monkey logo

timelapsebuilder-swift's Introduction

TimeLapseBuilder

This is a reference implementation for building time lapse videos from still images using Swift.

The core of the library is designed to be portable across iOS and macOS, and there is a sample application for each platform.

Getting started

  1. Clone this repository
  2. Open TimeLapseBuilder.xcodeproj with Xcode
  3. Select one of the sample applications from the schema list and select Product > Run

If you need help adapting this code to use in your app, I recommend posting your questions on Stack Overflow. Please open an issue if you find a bug.

Notables

  • @seanmcneil has built a Cocoapod called Spitfire based on this code.
  • Various contributors have helped to fix bugs and port this code to newer versions of Swift. You can find their comments and code on the original gist.

Contributing

If you found a bug, open an issue.

If you have a feature request, open an issue.

If you want to contribute (yay!), submit a pull request.

License

MIT license. Please see the LICENSE file for the particulars.

timelapsebuilder-swift's People

Contributors

acj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

timelapsebuilder-swift's Issues

TimeLapseBuilder build not running?

Good day,

I'm currently trying to use TimeLapseBuilder in my project, but it seems like it's not running.
I have the following function that runs when the user taps a button:

private func exportSpinsToVideo() {
    let timelapseBuilder = TimeLapseBuilder(photoURLs: spinURLs)
    timelapseBuilder.build({ progress in
      print(progress)
    }, success: { url in
      print(url)
    }, failure: { error in
      print(error)
    })
  }

When I tap the button I'm not getting any feedback from progress, success or failure.
The spinURLs String Array contains locations of images saved in the DocumentsDirectory.

Any idea as to what could be going wrong?

how to set duration on picture frames?

Hi,

thanks for the nice piece of code. Just want to implement a parameter to set the duration between picture frame switch.

So I want to see a picture for 3 seconds but the framerate of the video file should be still 30 fps.

Is there a little tweak to make this possible?

Many thanks!

Support for PNG with Alpha channel

This library works really well for JPG images but when trying to generate video with PNG images have some transparent pixels. The area with transparent pixels have artifacts in the final export.

I tried using HEVC encoding with Alpha support but did not work.

Has anyone tried this with PNG images with transparency?

Is there any simple way to loop over the image array ?

I like the small size of this code especially since I don't have a lot of experience using the AVAssetWriter. I was just wondering if you would know where I would start modifying the class so that it would loop over the array of images until it reached a certain time/maxFrames ?

I'm looking to modify this to convert an array of photos displayed in the same way as a gif into a 15 second video for instagram sharing.

Any help would be appreciated thanks !

Video content start from left.

Hey
I am creating the video from the number of image's URL. I am able to do that but I am facing a problem that when I have created the video that video content start from the top left and remaining screen shows black .
Thanks
Vijendra

Frame time calculation is a tiny bit out of whack

Since my videos can have very low frame rates (down to 1fps), I noticed that the first frame of the finished video was lasting for 2 seconds when I changed the fps to 1. This is because the 2nd frame gets added at 2 seconds, not at 1 second. Only the lastFrameTime is needed:

let lastFrameTime = CMTimeMake(value: frameCount, timescale: fps)

if !self.appendPixelBufferForImageAtURL(nextPhotoURL, pixelBufferAdaptor: pixelBufferAdaptor, presentationTime: lastFrameTime) {

This correctly produces a video where the 1st and every frame truly lasts 1 second.

The frameDuration variable is also not needed with this change.

Thanks for this code, BTW. I was going to try to tackle it, but good grief! Why they didn't allow image types to be used with AVURLAsset is beyond common sense.

Video is too fast

when i play video video running too fast
please help me to solve this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.