📽 MovieGo - Video Editing in Golang

Overview

📽 MovieGo - Video Editing in Golang

MovieGo is a Golang library for video editing. The library is designed for fast processing of routine tasks related to video editing. The main core of the project is the ffmpeg-go package, which simplifies working with the ffmpeg library.

⬇️ Instalation

go get github.com/mowshon/moviego

🎥 Resize video in Golang

Currently there are three methods in the package that help you resize the video:

  • ResizeByWidth( new width )
  • ResizeByHeight( new height )
  • Resize( new width, new height )
package main

import (
    "github.com/mowshon/moviego"
)

func main() {
    first, _ := moviego.Load("forest.mp4")

    first.ResizeByWidth(500).Output("resized-by-width.mp4").Run()
    first.ResizeByWidth(150).Output("resized-by-height.mp4").Run()
    first.Resize(1000, 500).Output("resized.mp4").Run()
}

These commands in ffmpeg:

ffmpeg -i forest.mp4 -vf scale=500:210 resized-by-width.mp4 -y
ffmpeg -i forest.mp4 -vf scale=150:62 resized-by-height.mp4 -y
ffmpeg -i forest.mp4 -vf scale=1000:500 resized.mp4 -y

🎥 Cut video in Golang

The Video structure has a SubClip method which can trim the video by specifying the beginning and end of the video segment.

package main

import (
    "github.com/mowshon/moviego"
    "log"
)

func main() {
    first, _ := moviego.Load("forest.mp4")

    // Cut video from second 3 to second 5.
    err := first.SubClip(3, 5).Output("final.mp4").Run()
    if err != nil {
        log.Fatal(err)
    }
}

🎥 Combine multiple videos into one in Golang

Having several videos you can combine them into one. You can apply different effects to video clips from a slice at the same time.

func main() {
    first, _ := moviego.Load("forest.mp4")
    second, _ := moviego.Load("sky.mp4")

    // Combine multiple videos into one.
    finalVideo, err := moviego.Concat([]moviego.Video{
        first,
        second,
        first.SubClip(1, 3),
        second.SubClip(5.3, 10.5),
        first.FadeIn(0, 5).FadeOut(5),
    })

    if err != nil {
        log.Fatal(err)
    }

    renderErr := finalVideo.Output("final.mp4").Run()
    if err != nil {
        log.Fatal(renderErr)
    }
}

🎥 Add a fade-in or fade-out transition for Video and Audio

Here we have 4 methods for working with Fade effects. Two for video and two for audio tracks from the video.

  • .FadeIn(start, duration) - The video fade-in from the beginning (the screen is black) to the specified time interval.
  • .FadeOut(seconds before the end) - Fading video into a completely black screen. You need to specify in seconds from the end of the video when to start fading.
  • .AudioFadeIn(start, duration) - If you want the audio track to be completely muted at the beginning, you can specify the beginning at 0.5 seconds.
  • .AudioFadeOut(seconds before the end) - The audio track will fade out at the end depending on the specified interval in seconds to the end of the video.
func main() {
    first, _ := moviego.Load("forest.mp4")

    // Add fade-in and fade-out
    first.FadeIn(0, 3).FadeOut(5).Output("fade-in-with-fade-out.mp4").Run()

    // Cut video and add Fade-in
    first.SubClip(5.20, 10).FadeIn(0, 3).Output("cut-fade-in.mp4").Run()

    // Mute the sound for the first 0.5 seconds and then
    // turn the sound on with the fade in.
    first.AudioFadeIn(0.5, 4).Output("audio-fade-in.mp4").Run()

    // Add video fade-out with audio fade-out.
    first.FadeOut(5).AudioFadeOut(5).Output("fade-out.mp4").Run()
}

🖼️ Screenshot - Saving a Frame of Video Clip in Golang

You can make a screenshot by specifying the desired time from the video in seconds.

func main() {
    first, _ := moviego.Load("forest.mp4")

    // A simple screenshot from the video.
    first.Screenshot(5, "simple-screen.png")

    // Take a screenshot after applying the effects.
    first.FadeIn(0, 3).FadeOut(5).Screenshot(0.4, "screen.png")
}
You might also like...
A simple library to extract video and audio frames from media containers (based on libav).
A simple library to extract video and audio frames from media containers (based on libav).

Reisen A simple library to extract video and audio frames from media containers (based on libav, i.e. ffmpeg). Dependencies The library requires libav

Stream video from ffmpeg to webrtc

ffmpeg-to-webrtc demonstrates how to send video from ffmpeg to your browser using pion.

Project to get Youtube video descriptions and search those videos as required

FamPayProject Project to get Youtube video descriptions and search those videos as required Prerequisities Postgres DB for persisting data Youtube Dat

Synthetic media is a realistic transformation of audio and video using artificial intelligence.

Synthetic media is a realistic transformation of audio and video using artificial intelligence.

ffcommander - An easy frontend to FFmpeg and Imagemagick to automatically process video and manipulate subtitles.

% FFCOMMANDER(1) ffcommander 2.39 % Mikael Hartzell (C) 2018 % 2021 Name ffcommander - An easy frontend to FFmpeg and Imagemagick to automatically pro

A go program that relies on back-end ffmpeg to process video-related content

Video Compress A go program that relies on back-end ffmpeg to process video-related content Installation v-go You can download the corresponding v-go

 👾 Annie is a fast, simple and clean video downloader built with Go.
👾 Annie is a fast, simple and clean video downloader built with Go.

👾 Annie is a fast, simple and clean video downloader built with Go. Installation Prerequisites Install via go install Homebrew (macOS only) Arch Linu

SlideXtract - A tool to help extract slides from a video file.

SlideXtract A tool to help extract slides from a video file. Slides are output in the out folder. Features I didn't find any other piece of code that

Parse and generate m3u8 playlists for Apple HTTP Live Streaming (HLS) in Golang (ported from gem https://github.com/sethdeckard/m3u8)

go-m3u8 Golang package for m3u8 (ported m3u8 gem https://github.com/sethdeckard/m3u8) go-m3u8 provides easy generation and parsing of m3u8 playlists d

Releases(v1.0.0)
  • v1.0.0(Apr 19, 2022)

    This is the first and hopefully not the last version of the Golang video editing package. The following functionality has been implemented so far:

    • Video size editing
    • Video cutting
    • Video concatenation
    • Frame screenshot
    • Fade-in and Fade-out for video and audio
    Source code(tar.gz)
    Source code(zip)
Owner
Student B.
Student B.
live video streaming server in golang

中文 Simple and efficient live broadcast server: Very simple to install and use; Pure Golang, high performance, and cross-platform; Supports commonly us

浩麟 8.5k Dec 2, 2022
Video converter with golang

Requirements Debian-like system (ubuntu, mint, etc...) with apt package manager Golang >1.15 Command tool make (use sudo apt install make -y to instal

Anaxita 2 Sep 10, 2022
golang function that download a video from youtube, and convert it to a mp3 file using ffmpeg

echedwnmp3 echedwnmp3 is a function that download a video from youtube, and convert it to a mp3 file using ffmpeg example package main import(echedwn

pai 4 Dec 7, 2021
lmmp3 is a little golang library that download a video from youtube, and convert it to a mp3 file using ffmpeg

lmmp3 lmmp3 is a function that download a video from youtube, and convert it to a mp3 file using ffmpeg You need to have installed ffmpeg in your syst

pai 8 Aug 12, 2022
Personal video streaming server.

tube This is a Golang project to build a self hosted "tube"-style video player for watching your own video collection over HTTP or hosting your own ch

davy wybiral 238 Dec 6, 2022
Short video direct link acquisition 短视频直连获取工具

Glink 短视频去水印一键解析应用 Short video direct link acquisition 短视频直连获取工具 Glink是一款基于go语言开发的短视频解析应用,前端使用vue+argon主题,后端使用go-fiber框架,支持web在线模式、客户端模式。

佰阅 156 Dec 7, 2022
Quik.do is a video conferencing tool.

Quik.do is a video conferencing tool.

Bora Tanrıkulu 118 Dec 1, 2022
Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Take control over your content and stream it yourself. Explore the docs » View Demo · Use Our Server for Testing · FAQ · Report Bug Table of Contents

Owncast 6.7k Dec 1, 2022
LiveKit - Open source, distributed video/audio rooms over WebRTC

LiveKit is an open source project that provides scalable, multi-user conferencing over WebRTC. It's designed to give you everything you need to build real time video/audio capabilities in your applications.

LiveKit 4.3k Dec 5, 2022
Go4vl is Go library for working with the Video for Linux API (V4L2) natively, without any C bindings.

go4vl A Go library for working with the Video for Linux user API (V4L2). Gov4l hides all the complexities of working with V4L2 and exposes idiomatic G

Vladimir Vivien 130 Nov 28, 2022