NFVideo

package
v0.0.0-...-6b2d15a Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Scale240  scale = "240"
	Scale360  scale = "360"
	Scale720  scale = "720"
	Scale1080 scale = "1080"
)

Variables

View Source
var AudioTrack *NFAudio.SpeakerTrack
View Source
var FfmpegPath string
View Source
var ProbePath string

Functions

func CheckBinaries

func CheckBinaries() error

CheckBinaries checks if the binaries are present in the location

func CreateGifFromExtractedFrames

func CreateGifFromExtractedFrames(absPath string, fps float64, loopCount int, outputPath string) error

func CreateGifFromVideo

func CreateGifFromVideo(absPath string, fps float64, scale scale) (*gif.GIF, error)

func ExtractAudioToMP3

func ExtractAudioToMP3(videoPath string, outputPath string) error

func FormatVideo

func FormatVideo(path string, maxFPS float64, loopCount int, scale scale) error

FormatVideo formats the video into a gif and mp3

TODO: Set up an editor integration to allow doing this automatically at build time(No loops) or manually at any time allowing the user to set the loop count

func SaveGifWithLoopCount

func SaveGifWithLoopCount(g *gif.GIF, loopCount int, outputPath string) error

func UnpackBinaries

func UnpackBinaries(location string) error

Types

type FFProbeOutput

type FFProbeOutput struct {
	Format  FormatDetails   `json:"format"`
	Streams []StreamDetails `json:"streams"`
}

func ProbeVideo

func ProbeVideo(file string) (FFProbeOutput, error)

type FormatDetails

type FormatDetails struct {
	Filename       string     `json:"filename"`
	NbStreams      int        `json:"nb_streams"`
	NbPrograms     int        `json:"nb_programs"`
	NbStreamGroups int        `json:"nb_stream_groups"`
	FormatName     string     `json:"format_name"`
	FormatLongName string     `json:"format_long_name"`
	StartTime      string     `json:"start_time"`
	Duration       string     `json:"duration"`
	Size           string     `json:"size"`
	BitRate        string     `json:"bit_rate"`
	ProbeScore     int        `json:"probe_score"`
	Tags           FormatTags `json:"tags"`
}

type FormatTags

type FormatTags struct {
	MajorBrand       string    `json:"major_brand"`
	MinorVersion     string    `json:"minor_version"`
	CompatibleBrands string    `json:"compatible_brands"`
	CreationTime     time.Time `json:"creation_time"`
}

type GifPlayer

type GifPlayer struct {
	LoopCount       int
	AudioPath       string
	AudioFileConfig NFFS.Configuration
	// contains filtered or unexported fields
}

func NewGifPlayer

func NewGifPlayer(path string, usePreciseTiming bool, fileConfig NFFS.Configuration) (*GifPlayer, error)

NewGifPlayer creates a new gif player from the given path.

func (*GifPlayer) AddFrameHandler

func (g *GifPlayer) AddFrameHandler(frame int, handler func())

AddFrameHandler adds a function to be called when a specific frame is reached

func (*GifPlayer) Player

func (g *GifPlayer) Player() *ModifiedAnimatedGif

func (*GifPlayer) Start

func (g *GifPlayer) Start()

func (*GifPlayer) Stop

func (g *GifPlayer) Stop()

type ModifiedAnimatedGif

type ModifiedAnimatedGif struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

ModifiedAnimatedGif is a modified version of the AnimatedGif widget from the fyne x package. This version will allow for frame handlers and precise timing.

func NewModifiedAnimatedGif

func NewModifiedAnimatedGif(inGif *gif.GIF, usePreciseTiming bool) (*ModifiedAnimatedGif, error)

func (*ModifiedAnimatedGif) AddFrameHandler

func (g *ModifiedAnimatedGif) AddFrameHandler(frame int, handler func())

func (*ModifiedAnimatedGif) CreateRenderer

func (g *ModifiedAnimatedGif) CreateRenderer() fyne.WidgetRenderer

func (*ModifiedAnimatedGif) HandleFrame

func (g *ModifiedAnimatedGif) HandleFrame(c int)

func (*ModifiedAnimatedGif) LoadGif

func (g *ModifiedAnimatedGif) LoadGif(inGif *gif.GIF) error

func (*ModifiedAnimatedGif) MinSize

func (g *ModifiedAnimatedGif) MinSize() fyne.Size

func (*ModifiedAnimatedGif) SetMinSize

func (g *ModifiedAnimatedGif) SetMinSize(size fyne.Size)

func (*ModifiedAnimatedGif) Start

func (g *ModifiedAnimatedGif) Start()

Start begins the animation. The speed of the transition is controlled by the loaded gif file.

func (*ModifiedAnimatedGif) Stop

func (g *ModifiedAnimatedGif) Stop()

Stop will request that the animation stops running, the last frame will remain visible

type StreamDetails

type StreamDetails struct {
	Index              int               `json:"index"`
	CodecName          string            `json:"codec_name"`
	CodecLongName      string            `json:"codec_long_name"`
	Profile            string            `json:"profile"`
	CodecType          string            `json:"codec_type"`
	CodecTagString     string            `json:"codec_tag_string"`
	CodecTag           string            `json:"codec_tag"`
	Width              int               `json:"width"`
	Height             int               `json:"height"`
	CodedWidth         int               `json:"coded_width"`
	CodedHeight        int               `json:"coded_height"`
	ClosedCaptions     int               `json:"closed_captions"`
	FilmGrain          int               `json:"film_grain"`
	HasBFrames         int               `json:"has_b_frames"`
	SampleAspectRatio  string            `json:"sample_aspect_ratio"`
	DisplayAspectRatio string            `json:"display_aspect_ratio"`
	PixFmt             string            `json:"pix_fmt"`
	Level              int               `json:"level"`
	ColorRange         string            `json:"color_range"`
	ColorSpace         string            `json:"color_space"`
	ColorTransfer      string            `json:"color_transfer"`
	ColorPrimaries     string            `json:"color_primaries"`
	ChromaLocation     string            `json:"chroma_location"`
	FieldOrder         string            `json:"field_order"`
	Refs               int               `json:"refs"`
	IsAvc              string            `json:"is_avc"`
	NalLengthSize      string            `json:"nal_length_size"`
	Id                 string            `json:"id"`
	RFrameRate         string            `json:"r_frame_rate"`
	AvgFrameRate       string            `json:"avg_frame_rate"`
	TimeBase           string            `json:"time_base"`
	StartPts           int               `json:"start_pts"`
	StartTime          string            `json:"start_time"`
	DurationTs         int               `json:"duration_ts"`
	Duration           string            `json:"duration"`
	BitRate            string            `json:"bit_rate"`
	BitsPerRawSample   string            `json:"bits_per_raw_sample"`
	NbFrames           string            `json:"nb_frames"`
	ExtradataSize      int               `json:"extradata_size"`
	Disposition        StreamDisposition `json:"disposition"`
	Tags               StreamTags        `json:"tags"`
}

type StreamDisposition

type StreamDisposition struct {
	Default         int `json:"default"`
	Dub             int `json:"dub"`
	Original        int `json:"original"`
	Comment         int `json:"comment"`
	Lyrics          int `json:"lyrics"`
	Karaoke         int `json:"karaoke"`
	Forced          int `json:"forced"`
	HearingImpaired int `json:"hearing_impaired"`
	VisualImpaired  int `json:"visual_impaired"`
	CleanEffects    int `json:"clean_effects"`
	AttachedPic     int `json:"attached_pic"`
	TimedThumbnails int `json:"timed_thumbnails"`
	NonDiegetic     int `json:"non_diegetic"`
	Captions        int `json:"captions"`
	Descriptions    int `json:"descriptions"`
	Metadata        int `json:"metadata"`
	Dependent       int `json:"dependent"`
	StillImage      int `json:"still_image"`
}

type StreamTags

type StreamTags struct {
	CreationTime time.Time `json:"creation_time"`
	Language     string    `json:"language"`
	HandlerName  string    `json:"handler_name"`
	VendorId     string    `json:"vendor_id"`
}

Jump to

Keyboard shortcuts

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