mediatool

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TelegramMaxPhotoFileSize        int = 10 * 1024 * 1024
	TelegramMaxPhotoTotalSideLength int = 10000
	TelegramMaxPhotoSideLength      int = 2560
)

Variables

This section is empty.

Functions

func CompressImg

func CompressImg(inputPath, outputPath, format string, maxEdgeLength int) error

CompressImg compresses the image at inputPath and saves the result to outputPath.

The input image will be resized so that its longest edge does not exceed maxEdgeLength,

If the maxEdgeLength <= 0, no resizing will be performed.

func CompressImgForTelegram

func CompressImgForTelegram(input []byte) ([]byte, error)

func CompressImgForTelegramFromFile

func CompressImgForTelegramFromFile(filePath string) (*osutil.TempFile, error)

func ExtractVideoThumbFrame

func ExtractVideoThumbFrame(r io.Reader) ([]byte, error)

func FFmpegAvailable

func FFmpegAvailable() bool

func GetImagePhash

func GetImagePhash(img image.Image) (string, error)

func GetImagePhashFromReader

func GetImagePhashFromReader(r io.Reader) (string, error)

func GetImageThumbHash

func GetImageThumbHash(img image.Image) (string, error)

func GetImgSize

func GetImgSize(img image.Image) (int, int, error)

func GetImgSizeFromReader

func GetImgSizeFromReader(r io.Reader) (int, int, error)

func UgoiraZipToMp4

func UgoiraZipToMp4(zipPath string, frames []shared.UgoiraFrame, outputPath string) (string, error)

UgoiraZipToMp4 从 ugoira 的 zip 解压并转换为 mp4

返回生成的 mp4 路径(可能与 outputPath 不同,会自动添加 .mp4 后缀)

Types

type VideoMetadata

type VideoMetadata struct {
	Duration uint // in milliseconds
	Width    uint
	Height   uint
}

func GetMP4Meta

func GetMP4Meta(rs io.ReadSeeker) (*VideoMetadata, error)

a go native way to get mp4 video metadata

func GetVideoMetadata

func GetVideoMetadata(rs io.ReadSeeker) (*VideoMetadata, error)

GetVideoMetadata uses ffprobe to get video metadata

Jump to

Keyboard shortcuts

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