Documentation ¶
Index ¶
- func CalculateTimecode(currentFrame int, fps float64, totalFrames int) string
- func DivideFrameRange(startFrame int, endFrame int, segments int) []int
- func ExtractFrames(videoPath string, frameNumbers []int, totalFrames int, fps int, ...) error
- func RemoveDuplicates(slice []interface{}) []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateTimecode ¶
CalculateTimecode calculates the timecode of a given frame based on the frames per second and total frames. It takes three parameters: - currentFrame: The current frame number. - fps: The number of frames per second. - totalFrames: The total number of frames in the video. It returns the timecode in the format "hh:mm:ss".
func DivideFrameRange ¶
DivideFrameRange divides a range of frames into segments and returns the middle frame of each segment. It takes three parameters: - startFrame: The first frame of the range. - endFrame: The last frame of the range. - segments: The number of segments to divide the range into. It returns a slice of integers representing the middle frame of each segment.
func ExtractFrames ¶
func ExtractFrames(videoPath string, frameNumbers []int, totalFrames int, fps int, outputPath string) error
ExtractFrames extracts specific frames from a video file and saves them as images. It takes the path to the video file, a slice of frame numbers to extract, the total number of frames in the video, the frames per second of the video, and the output path where the images will be saved. It uses a progress bar to show the progress of the frame extraction. For each frame number in the slice, it reads the frame from the video and writes it to a file. The files are named using the timecode of the frame in the video. If it encounters an error while opening the video file, reading a frame, or writing a frame to a file, it returns the error. Otherwise, it returns nil.
func RemoveDuplicates ¶
func RemoveDuplicates(slice []interface{}) []interface{}
RemoveDuplicates removes duplicate values from a slice. It takes a slice of empty interfaces as a parameter and returns a new slice with duplicates removed.
Types ¶
This section is empty.