Giter Site home page Giter Site logo

metasmile / nsgif2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nsrare/nsgif

82.0 82.0 12.0 1 MB

Convert live photos and videos into animated GIFs in iOS, or extract frames from them.

License: MIT License

Objective-C 96.41% Ruby 3.59%
animated-gif gif gif-library

nsgif2's People

Contributors

hboon avatar jacobrosenthal avatar khappucino avatar metasmile avatar samuelbeek avatar sean-howard avatar sebyddd avatar tonku 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

Watchers

 avatar  avatar  avatar  avatar  avatar

nsgif2's Issues

How to achieve the same time duration as the video file ?

I'm encountered with playing video files in UICollectionViewCells, as the AVPlayer of AVPlayerLayer in a cell is slow and choppy, I've turned to use GIF and SDImageCache in UIImageView.
I'd like to know if the GIF could be the same time length of playing like the video, e.g. I'm going to get five seconds of video playing while the GIF is five seconds too?
How to adjust the framesPerSecond, delayTime or frameCount to get this. Thanks.

Error on DemoProject

Hi,
When i try to build the demoProject with Xcode 8.2.1 i get the attachd error,
screen shot 2017-03-08 at 12 26 01

HUGE memory spike causes crash even for 1 frame per second on a 60 second long mp4 video

I have a 3.9 MB 60 second long mp4 video which I am trying to convert to GIF. Testing on iOS 9.3.
Even when I have set the request.framesPerSecond to 1 which should only have 60 total frames in the entire GIF, my app memory spikes to around 270 MB.

Looking further, the memory spike occurs at the if (!CGImageDestinationFinalize(destination)) {
line of the createGIFforTimePoints method. Any clue what can be done to fix this?

NSURL *videoURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"clip" ofType:@"mp4"]];
    NSString *destinationPath = [[self applicationDocumentsDirectory].path
                                 stringByAppendingPathComponent:@"mygif.txt"];

    NSGIFRequest * request = [NSGIFRequest requestWithSourceVideo:videoURL destination:[NSURL fileURLWithPath:destinationPath]];
    request.framesPerSecond=1;
    request.scalePreset=NSGIFScaleOptimize;
    request.progressHandler = ^(double progress, NSUInteger position, NSUInteger length, CMTime time, BOOL *stop, NSDictionary *frameProperties) {
        NSLog(@"%f - %lu - %lu - %lld - %@", progress, (unsigned long)position, (unsigned long)length, time.value, frameProperties);
    };

    [NSGIF create:request completion:^(NSURL *GifURL) {
        //GifURL is to nil if it failed or stopped.
    }];

New roadmap : NSGIF2 -> UIGIF

  • Performance improvements + Memory leak fixes and optimization.
  • Swift3 Support
  • Support ending for macos.
  • iOS/tvOS/watchOS support only.

Not releasing Source ImageRef

Please add this line " CGImageRelease(sourceRef)" to release memory.

  • (UIImage*)imageByScalingToFill:(UIImage *)image size:(CGSize)fillSize rescaleTo:(CGFloat)scaleToRescale{
    CGImageRef sourceRef = image.CGImage;
    .
    .
    .

    CGImageRelease(destRef);
    CGImageRelease(sourceRef);
    return destImage;

}

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.