forked from lajos/iFrameExtractor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
59 lines (36 loc) · 2.52 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
This project extracts frames from video recorded by iPhone 3Gs
using the LGPL FFmpeg libraries.
This software is licensed under the GNU-LGPL version 2.1 or later.
Copyright 2010 Lajos Kamocsay
lajos at codza dot com
iFrameExtractor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
iFrameExtractor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
To compile and run the project on your iPhone:
1. open Terminal
2. clone the repository: git clone git://github.com/lajos/iFrameExtractor.git
3. go to the ffmpeg folder in the project: cd iFrameExtractor/ffmpeg
4. build the ffmpeg libraries: ./build_universal
5. open the xcode project and run it on your iPhone device
The build_universal shell script creates libraries that work on both armv6 and armv7 processors. If you need libraries for pre-3Gs devices (iPhone 2g, iPhone3G, iPod Touch), use the build_armv6 script. For iPhone 3Gs only libraries, use build_armv7.
iFrameExtractorAppDelegate creates an instance of VideoFrameExtractor (the class that grabs images from the video). When you press the play button, iFrameExtractorAppDelegate sets up a loop and displays all the images from the video until it reaches the end of the movie.
The VideoFrameExtractor class is based on Martin Böhme’s tutorial, upgraded to use swscale. Initialize this class with the full path of the movie:
VideoFrameExtractor *video = [[VideoFrameExtractor alloc]
initWithVideo:@"/full/path/to/movie.mov"];
By default, the output size will match the movie’s size. You can set outputWidth and outputHeight to change the dimensions:
video.outputWidth = 426;
video.outputHeight = 320;
Use stepFrame to grab the next frame. This method returns false if there are no more frames (reached the end of video):
BOOL result = [video stepFrame];
The processed frame can be accessed as a UIImage on the currentImage property:
UIImage *myImage = video.currentImage;
You can seek to a specific time (in seconds) using the seekTime: method:
[video seekTime:1.0];
The movie’s length can be queried by checking the duration property:
NSLog(@"video duration: %f",video.duration);
http://www.codza.com/extracting-frames-from-movies-on-iphone