Skip to content
a lightweight video editing library for go (trimming, resizing, cropping, and more!)
Go
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Use time.Duration instead of float64 Aug 25, 2019
.gitattributes Initial commit Aug 16, 2019
.gitignore .gitignore update Aug 16, 2019
LICENSE Create LICENSE Aug 17, 2019
README.md added acknowledgments for contributors Aug 25, 2019
cinema.go Handle invalid trim times Aug 29, 2019

README.md

cinema : a lightweight video editing library for Go

alt text

Overview GoDoc

cinema is a simple video editing library based on ffmpeg. It supports trimming, resizing, cropping and more. Use it to create videos directly or let it generate command lines that use ffmpeg for you.

Installation

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

go get github.com/jtguibas/cinema

Example Usage

func main() {
	downloadTestVideo("example.mp4")

	video, err := cinema.Load("example.mp4")
	check(err)

	video.Trim(10*time.Second, 20*time.Second) // trim video from 10 to 20 seconds
	video.SetStart(1 * time.Second)            // trim first second of the video
	video.SetEnd(9 * time.Second)              // keep only up to 9 seconds
	video.SetSize(400, 300)                    // resize video to 400x300
	video.Crop(0, 0, 200, 200)                 // crop rectangle top-left (0,0) with size 200x200
	video.SetSize(400, 400)                    // resize cropped 200x200 video to a 400x400
	video.SetFPS(48)                           // set the output framerate to 48 frames per second
	video.Render("test_output.mov")            // note format conversion by file extension

	// you can also generate the command line instead of applying it directly
	fmt.Println("FFMPEG Command", video.CommandLine("test_output.mov"))
}

TODO

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

Feel free to open pull requests!

Acknowledgments

  • Big thanks to gonutz for contributing to this project!
You can’t perform that action at this time.