ffmpeg

package
v0.0.0-...-38a1616 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package ffmpeg provides FFmpeg video transcoding related types and functions.

Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
<https://docs.photoprism.app/license/agpl>

This program 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 Affero General Public License for more details.

The AGPL is supplemented by our Trademark and Brand Guidelines,
which describe how our Brand Assets may be used:
<https://www.photoprism.app/trademark>

Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.

Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>

Index

Constants

View Source
const (
	DefaultBin      = "ffmpeg"
	MapVideoDefault = "0:v:0"
	MapAudioDefault = "0:a:0?"
)

Variables

AvcEncoders is the list of supported H.264 encoders with aliases.

Functions

func AvcConvertCommand

func AvcConvertCommand(fileName, avcName string, opt Options) (result *exec.Cmd, useMutex bool, err error)

AvcConvertCommand returns the command for converting video files to MPEG-4 AVC.

func PreviewTimeOffset

func PreviewTimeOffset(d time.Duration) string

PreviewTimeOffset returns an appropriate time offset depending on the duration for extracting a preview image.

Types

type AvcEncoder

type AvcEncoder string

AvcEncoder represents a supported FFmpeg AVC encoder name.

const (
	SoftwareEncoder    AvcEncoder = "libx264"           // SoftwareEncoder see https://trac.ffmpeg.org/wiki/HWAccelIntro.
	IntelEncoder       AvcEncoder = "h264_qsv"          // IntelEncoder is the Intel Quick Sync H.264 encoder.
	AppleEncoder       AvcEncoder = "h264_videotoolbox" // AppleEncoder is the Apple Video Toolbox H.264 encoder.
	VAAPIEncoder       AvcEncoder = "h264_vaapi"        // VAAPIEncoder is the Video Acceleration API H.264 encoder.
	NvidiaEncoder      AvcEncoder = "h264_nvenc"        // NvidiaEncoder is the NVIDIA H.264 encoder.
	Video4LinuxEncoder AvcEncoder = "h264_v4l2m2m"      // Video4LinuxEncoder is the Video4Linux H.264 encoder.
)

Supported FFmpeg AVC encoders.

func FindEncoder

func FindEncoder(s string) AvcEncoder

FindEncoder finds an FFmpeg encoder by name.

func (AvcEncoder) String

func (name AvcEncoder) String() string

String returns the FFmpeg AVC encoder name as string.

type Options

type Options struct {
	Bin      string
	Encoder  AvcEncoder
	Size     int
	Bitrate  string
	MapVideo string
	MapAudio string
}

Options represents transcoding options.

func (Options) VideoFilter

func (o Options) VideoFilter(format PixelFormat) string

VideoFilter returns the FFmpeg video filter string based on the size limit in pixels and the pixel format.

type PixelFormat

type PixelFormat string

PixelFormat represents a standard pixel format.

const (
	FormatYUV420P PixelFormat = "yuv420p"
	FormatNV12    PixelFormat = "nv12,hwupload"
	FormatQSV     PixelFormat = "qsv"
)

Standard pixel formats.

func (PixelFormat) String

func (f PixelFormat) String() string

String returns the pixel format as string.

Jump to

Keyboard shortcuts

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