ffmpeg

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT, Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const CommonCmd = ` -i "%s" -y `
View Source
const ConcatCmd = ` -f concat -safe 0  -i "%s" -c copy -y "%s"`
View Source
const GetFrameCmd = CommonCmd + `-vf "select=eq(pict_type\,%s)" -fps_mode vfr -qscale:v 2 -f image2 %s/%%03d.jpg`
View Source
const H264ToH265ByIntelGPUCmd = `ffmpeg -hwaccel qsv -c:v h264_qsv -i %s -c:v hevc_qsv -preset veryslow -g 60 -gpu_copy 1 -c:a copy "%s"`
View Source
const ImgToHeicCmd = CommonCmd + `-crf 20 -c:v libx265 -preset veryslow %s.mp4`
View Source
const ImgToHeicCmd2 = CommonCmd + `-hide_banner -r 1 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2,zscale=m=170m:r=pc" -pix_fmt yuv420p -frames 1 -c:v libx265 -preset veryslow -crf 20 -x265-params range=full:colorprim=smpte170m "%s.hevc"`
View Source
const ImgToHeicCmd3 = CommonCmd + `-hide_banner -r 1 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2,zscale=m=170m:r=pc" -pix_fmt yuv420p -frames 1 -c:v libx265 -preset veryslow -crf 20 -x265-params range=full:colorprim=smpte170m:aq-strength=1.2 -deblock -2:-2 "%s.hevc"
`
View Source
const ImgToJxlCmd = CommonCmd + `-c:v libjxl "%s.jxl"`
View Source
const ImgToTAvifCmd = CommonCmd + `-c:v libaom-av1 -crf %d -cpu-used %d -row-mt 1 "%s.avif"`
View Source
const ImgToWebpCmd = CommonCmd + `-c:v libwebp -quality %d "%s.webp"`
View Source
const ImgToWebpLosslessCmd = CommonCmd + `-c:v libwebp -lossless 1 -quality 100 -compression_level 6 "%s.webp"`

webp lossless mode

View Source
const ResizeCmd = CommonCmd + `-vf "scale=iw*.5:ih*.5" %s`
View Source
const ToAv1Libaomav1Cmd = CommonCmd + `-c:v libaom-av1 -crf %d -cpu-used %d -row-mt 1 -y "%s"`

libaom-av1

View Source
const ToH264Cmd = CommonCmd + `-c:v libx264 -profile high -preset %s -crf %d -y "%s"`

libx264

View Source
const ToH265Cmd = CommonCmd + `-c:v libx265 -preset %s -crf %d -y "%s"`

libx265

View Source
const TransferFormatCmd = CommonCmd + ` -c copy -y "%s"`
View Source
const TransferFormatGPUCmd = ` -hwaccel qsv -i "%s" -c copy -y "%s"`

Variables

View Source
var ExecPath = "ffmpeg"

Functions

func Concat

func Concat(dir, dst string) error

Concat performs the operation.

func ConcatByFile

func ConcatByFile(filePath, dst string) error

ConcatByFile performs the operation.

func GetFrame

func GetFrame(path, outPutDir string, f Frame) error

GetFrame returns the value.

func H264ToH265ByIntelGPU

func H264ToH265ByIntelGPU(filePath, dst string) error

H264ToH265ByIntelGPU performs the operation.

func ImgToAvif

func ImgToAvif(filePath, dst string, crf, cpuUsed int) error

ImgToAvif performs the operation.

func ImgToHeic

func ImgToHeic(filePath, dst string) error

ImgToHeic performs the operation.

func ImgToJxl

func ImgToJxl(filePath, dst string) error

ImgToJxl performs the operation.

func ImgToWebp

func ImgToWebp(filePath, dst string, quality int) error

ImgToWebp performs the operation.

func ImgToWebpLossless

func ImgToWebpLossless(filePath, dst string) error

ImgToWebpLossless performs the operation.

func Run

func Run(cmd string) error

Run executes the operation.

func ToAV1ByLibaomav1

func ToAV1ByLibaomav1(filePath, dst string, crf, cpuUsed int) error

ToAV1ByLibaomav1 converts the value.

func ToH264ByXlib264

func ToH264ByXlib264(filePath, dst string, crf int, perset PerSet) error

ToH264ByXlib264 converts the value.

func ToH265ByXlib265

func ToH265ByXlib265(filePath, dst string, crf int, perset PerSet) error

ToH265ByXlib265 converts the value.

func TransferFormat

func TransferFormat(filePath, dst string) error

TransferFormat performs the operation.

func TransferFormatGPU

func TransferFormatGPU(filePath, dst string) error

TransferFormatGPU performs the operation.

Types

type Config

type Config struct {
	Path string
}

type Frame

type Frame int
const (
	I Frame = iota
	P
	B
)

func (Frame) String

func (f Frame) String() string

String returns the string representation.

type PerSet

type PerSet string
const (
	Ultrafast PerSet = "ultrafast"
	SuperFast PerSet = "superfast"
	VeryFast  PerSet = "veryfast"
	Faster    PerSet = "faster"
	Fast      PerSet = "fast"
	Medium    PerSet = "medium"
	Slow      PerSet = "slow"
	Slower    PerSet = "slower"
	VerySlow  PerSet = "veryslow"
	Placebo   PerSet = "placebo"
)

Jump to

Keyboard shortcuts

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