Coder Social home page Coder Social logo

icgvideotrimmer's Introduction

ICGVideoTrimmer

A library for quick video trimming based on SAVideoRangeSlider, mimicking the behavior of Instagram's.

Screenshot

Note

I've made this very quickly so here's a list of things to do for improvements (pull requests are very much appreciated!):

  • Make panning thumb views smoother
  • Make ruller view more customizable
  • Added video tracker, mimicking the behaviour of Instagram's - @FabKremer
  • Bug fixes if any
  • More and more, can't remember right now hahha.

Getting started

Using CocoaPods:

Just add the following line in to your pod file:

pod 'ICGVideoTrimmer'

Manually add ICGVideoTrimmer as a library:

Drag and drop the subfolder named Source in your project and you are done.

Usage

Create an instance of ICGVideoTrimmer using interface builder or programmatically. Give it an asset and set the delegate. You can select theme color for the trimmer view and decide whether to show the ruler view by setting the properties. Finally, don't forget to call resetSubviews!

 [self.trimmerView setThemeColor:[UIColor lightGrayColor]];
 [self.trimmerView setAsset:self.asset];
 [self.trimmerView setShowsRulerView:YES];
 [self.trimmerView setRulerLabelInterval:10];
 [self.trimmerView setTrackerColor:[UIColor cyanColor]];
 [self.trimmerView setDelegate:self];
 [self.trimmerView resetSubviews];

If necessary, you can also set your desired minimum and maximum length for your trimmed video by setting the properties minLength and maxLength for the trimmer view. By default, these properties are 3 and 15 (seconds) respectively.

You can also customize your thumb views by setting images for the left and right thumbs:

  [self.trimmerView setLeftThumbImage:[UIImage imageNamed:@"left-thumb"]];
  [self.trimmerView setRightThumbImage:[UIImage imageNamed:@"right-thumb"]];

See the project example to see how to manage the tracker on a video.

Requirements

ICGVideoTrimmer requires iOS 7 and MobileCoreServices and AVFoundation frameworks. Honestly I haven't tested it with iOS 6 and below so I can't be too sure if it's compatible.

ARC

ICGVideoTrimmer uses ARC. If you are using ICGVideoTrimmer in a non-arc project, you will need to set a -fobjc-arc compiler flag on every ICGVideoTrimmer source files. To set a compiler flag in Xcode, go to your active target and select the "Build Phases" tab. Then select ICGVideoTrimmer source files, press Enter, insert -fobjc-arc and then "Done" to enable ARC for ICGVideoTrimmer.

Contributing

Contributions for bug fixing or improvements are welcome. Feel free to submit a pull request.

Licence

ICGVideoTrimmer is available under the MIT license. See the LICENSE file for more info.

icgvideotrimmer's People

Contributors

fabkremer avatar igor-palaguta avatar itsmeichigo avatar jasondinh avatar likaihere avatar stanmots avatar streeter avatar tkburbidge 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

icgvideotrimmer's Issues

Too little thumbnails

I have a 8 minutes video, and my maximum trim size is 40 seconds. However I am seeing too little thumbnails to trim correctly. I am getting 1 thumb per each 30 seconds. I have tried to change thumbwidth but it doesn't change it.

Any ideas?

Positioning the thumb

Is it possible to programmatically position the left and right thumb to some fixed timeline of the video?

About TrimerView's scale function

Hi there,
i've using your trimmer and try to use it on my video editing project demo, but I've notice that , trimmer's left n right slider will only work 'on sight' ,witch means within frame that trimmer view was displayed, if set a video which length might be 1:00,you might lost video data which out of range,is there any possible way to make it resizable ? like make a transform so let thumbimgs can be displayed fully? so that the user will not losing video clips due to thumbs was out of range?

Start Video From Seconds other than 0

Is it possible that the we'll set the position of left and right slider on the seconds we want. For example the video is of 15 seconds and I want the left to be on 5th seconds and right to be on 10th seconds when the view is loaded.

I found a bug..

Thank you for sharing great sources!!
I found a bug so I report it..

If user selects a video which is shorter than _minLength, rightOverlayView moved weird..
Please fix it.. I tried to fix, but too complicated for me..

load frame slow

I have solved the problem only displays the first frame, but if the video is not compressed, and a long time would be very slow to load frame, recommend using UITableView lazy load each frame

Not adding the images for a small video

When there are only 2 count for the images then the following code not getting executed.

dispatch_async(dispatch_get_main_queue(), ^{
UIImageView *imageView = (UIImageView *)[self.frameView viewWithTag:i];
[imageView setImage:videoScreen];

        });

Video preview is not working

On iOS13, video player preview is not working. UIView is there, play is called, but no video... Added AVPlayerLayer manually solves the problem.

AVPlayerLayer *avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player]; avPlayerLayer.frame = CGRectMake(0, 100, self.view.frame.size.width, 400); [avPlayerLayer setBackgroundColor:[UIColor clearColor].CGColor]; [self.view.layer addSublayer:avPlayerLayer];

How to change maxLength of the trimmer view.

Hi, I am using the ICGVideoTrimmer in my project. I am using two trimmer views in a view for playing two videos. I want adjust the trimmer view max length of one trimmer view while changing other automatically. how to know the trimming video length without saving in seconds

Ruler Video Frame Not matching with Video player

Hi ,
I am trying to using your video trim library into the demo project,
But i have noticed the getting issue like Ruler frame is not matching with the Playing video,
Can you guide me to resolve this?

Instantiation with SnapKit/AutoLayout from Code

I tried to build an interface from a UI perspective, using SnapKit. When I try to instantiate my ICGVideoTrimmer, the component does not initialize correctly when the videos are longer than one frame. I've tried multiple approaches here, and verified that it works correctly when using a storyboard. Any thoughts on why this could be occurring?

Max time

Is it possible to set the max period of time
eg: 1min maximum

ICGThumbView hit area is too small

trying to move the right thumb from the left side of it or to move the left thumb from the right side of it is not working.
checking the code ICGThumbView:pointInside is not being called with the above scenario.

How can I fix the width per second?

I tried to set minLength and maxLength to both 1 second, but then the trimmer between the two thumbnails becomes full width. In other words, I couldn't see the overlay views anymore?

How should I set this correctly?

Thanks

Porting to Swift

I don't think github has a "discussion" secion, so I'm putting this here...

The Objective-C-ness of this is driving me crazy. And to a lesser extent, the non-autolayout-ness. I'm rewriting to Swift in a...new project I guess? I guess it doesn't make sense to fork it since it will be all new code? Has anyone already done this, or is there any reason I shouldn't?

I can't trim the video with type of mp4. How to resolve it?

Hello,
Thank you for providing us so good open source code. I met with a problem and help you could help me.
My video type is mp4, and when run to code " Float64 duration = CMTimeGetSeconds([self.asset duration]);". It said that asset can't count mp4's duration. So how can I do? Must I transfer Mp4 to .mov?
Thanks a lot!

trackerColor assign or strong?

Hi,
just a question, why the trackerColor property is not strong in ICGVideoTrimmerView.h?
I got crash reports for ICGVideoTrimmerView.m line 129
self.trackerView.backgroundColor = self.trackerColor ? self.trackerColor : [UIColor whiteColor];
Am I correct?

Can scroll vertically trimbar

Hi, for some reason I am able to scroll vertically on my trimmer. I attached an image below showing where the thumbnails have been scrolled out of the trimbar. I am not sure what I did wrong since the example project works for me. The only thing I'm doing differently is that I've implemented the trimmer in Swift.

img_0023

How to display the time scale for videos played from localpath Videos.

Hi I am using ICGVideoTrimmer. Actually I download the videos and saved in localpath with .mp4 and playing the localpath videos. For the localpath videos the scale is not displaying at the bottom of the trimmer View. While getting the videos from the albums Scale is displaying. How to display the scale while getting and playing the videos from the local paths.

Thank you

startTime

How to change startTime and endtime when i create ICGVideoTrimmer

How to restrict the left and Right thumbview moving when max length is reached.

Hi,
How to restrict moving the left thumbview and right thumbview when particular time is set i.e when i set the length to 15 seconds , while moving the left thumbview and right thumbview is moving it is restricted to 15 seconds only. is it possible to implement this feature.

Is it possible to move the scroll the images from outside like coub App. we are scrolling the images between the left and right thumb views.

Thank you

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.