seratools

package
v1.2.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateTimecode

func CalculateTimecode(currentFrame int, fps float64, totalFrames int) string

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

func DivideFrameRange(startFrame int, endFrame int, segments int) []int

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

type ExifData

type ExifData struct {
	ExifData *exif.Exif
}

ExifData represents the exif data of an image.

func (ExifData) ToJson

func (e ExifData) ToJson() ([]byte, error)

convert the exif data to json

func (ExifData) ToString

func (e ExifData) ToString() string

convert the exif data to a string

type ScanResult

type ScanResult struct {
	Timecodes []string
	Frames    []int
	VideoInfo VideoInfo
}

ScanResult represents the result of a video scan.

func (ScanResult) Json

func (s ScanResult) Json() (string, error)

ToJson returns a JSON string representation of the ScanResult struct.

func (ScanResult) JsonBeatuify

func (s ScanResult) JsonBeatuify() (string, error)

ToJsonBeatuify returns a JSON string representation of the ScanResult struct with indentation for readability.

func (ScanResult) String

func (s ScanResult) String() string

ToString returns a string representation of the ScanResult struct.

type VideoInfo

type VideoInfo struct {
	TotalFrames int     `json:"totalFrames"`
	FPS         int     `json:"fps"`
	Duration    string  `json:"duration"`
	Filename    string  `json:"filename"`
	Codec       string  `json:"codec"`
	Width       int     `json:"width"`
	Height      int     `json:"height"`
	AspectRatio float64 `json:"aspectRatio"`
}

VideoInfo represents information about a video file.

func (VideoInfo) JsonBeatuify

func (s VideoInfo) JsonBeatuify() (string, error)

ToJsonBeatuify returns a JSON string representation of the VideoInfo struct with indentation for readability.

func (VideoInfo) ToJson

func (s VideoInfo) ToJson() (string, error)

ToJson returns a JSON string representation of the VideoInfo struct.

func (VideoInfo) ToString

func (s VideoInfo) ToString() string

ToString returns a string representation of the VideoInfo struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL