cinema

package module
v0.0.0-...-661d6a2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2019 License: MIT Imports: 5 Imported by: 0

README

cinema : a lightweight video editor for golang

alt text

Overview GoDoc

cinema is a super simple video editor that supports video io, video trimming, and resizing. it is dependent on ffmpeg, an advanced command-line tool used for handling video, audio, and other multimedia files and streams. start programmatically editing videos with golang now!

Install

You must have FFMPEG installed on your machine! Make sure ffmpeg and ffprobe are available from the command line on your machine.

go get github.com/jtguibas/cinema

Example Usage

func main() { // cinema/test/test.go

	// loading the test video
	fmt.Println("Downloading Test Video...")
	video_url := "https://media.w3.org/2010/05/sintel/trailer.mp4"
	if err := DownloadFile("test_input.mp4", video_url); err != nil {
		panic(err)
	}

	// initializing the test video as a cinema video object
	v, err := cinema.MakeVideo("test_input.mp4")
	if err != nil {
		fmt.Println(err)
	}

	// testing all setters
	v.Trim(0, 10)
	v.SetStart(0)
	v.SetEnd(10)
	v.SetSize(400, 400)
	v.Render("test_output.mov") // notice how it can convert formats with ease

	// testing all getters
	fmt.Println(v.Filepath())
	fmt.Println(v.Start())
	fmt.Println(v.End())
	fmt.Println(v.Width())
	fmt.Println(v.Height())
	fmt.Println(v.Duration())
}

TODO

  • add concatenation support
  • improve godoc documentation
  • add cropping support
  • expand to audio
  • test windows and ubuntu support
  • implement fps support
  • implement bitrate support

Contact

jtguibas

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Video

type Video struct {
	// contains filtered or unexported fields
}

The structure that defines the Video structure. All the values in this structure will be filled when MakeVideo is called.

func MakeVideo

func MakeVideo(filepath string) (Video, error)

MakeVideo takes in the filepath of any videofile supported by FFMPEG. It will return a Video structure with all of the values parsed from FFPROBE. Note: This will not load the video into memory.

func (*Video) Duration

func (v *Video) Duration() float64

Get the duration of the current video struct

func (*Video) End

func (v *Video) End() float64

Get the end of the current video struct

func (*Video) Filepath

func (v *Video) Filepath() string

Get the filepath of the current video struct

func (*Video) Height

func (v *Video) Height() int64

Get the height of the current video struct

func (*Video) Render

func (v *Video) Render(output string)

This function will take the configuration set in the Video structure and properly apply it to the rendered video. Currently supports trimming, scaling, and video format conversion.

func (*Video) SetEnd

func (v *Video) SetEnd(end float64)

Trim the end of the video using seconds

func (*Video) SetHeight

func (v *Video) SetHeight(height int64)

Set the height of the video

func (*Video) SetSize

func (v *Video) SetSize(width int64, height int64)

Set the width and height of the video

func (*Video) SetStart

func (v *Video) SetStart(start float64)

Trim to the start of the video in seconds

func (*Video) SetWidth

func (v *Video) SetWidth(width int64)

Set the width of the video

func (*Video) Start

func (v *Video) Start() float64

Get the start of the current video struct

func (*Video) Trim

func (v *Video) Trim(start float64, end float64)

Trim the video in seconds

func (*Video) Width

func (v *Video) Width() int64

Get the width of the current video struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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