ffmpeg core for golang

go-ffmpeg-core

ffmpeg core for golang

基于ffmpeg命令封装简单功能,因此运行环境需事先安装有ffmpeg命令。

ffmpeg官方下载地址: http://ffmpeg.org/download.html

1. 剥离视频文件的音频/视频

package main

import (
  go_ffmepg_core "github.com/Resynz/go-ffmpeg-core"
  "log"
)

func main () {
  resourcePath:="./test.mp4" // 原视频路径
  outputPath:="./test-peel-audio.m4a" // 文件输出路径
  peel:=&go_ffmpeg_core.Peel{
    Command: "ffmpeg",
    ResourcePath: resourcePath,
    OutputPath: outputPath,
    Type: go_ffmpeg_core.PeelTypeAudio, // 指定剥离类型为音频/视频
    Stream: "", // 如果该视频文件中有存在多条音轨,可指定音轨编号
  }
  err:=peel.Execute()
  if err!=nil{
    log.Fatalf("peel failed! error:%s\n",err)
  }
  log.Println("peel done.")
}

2. 合并音频、视频

package main

import (
  go_ffmepg_core "github.com/Resynz/go-ffmpeg-core"
  "log"
)

func main () {
  merge:=&go_ffmpeg_core.MergeAV{
  	Command:    "ffmpeg",
	VideoPath:  "./test-v.mp4", // 纯视频文件路径
	AudioPath:  "./test-a.m4a", // 纯音频文件路径
	OutputPath: "./merge.mp4",  // 结果输出路径
  }
  if err:=merge.Execute();err!=nil{
	log.Fatalf("merge failed! error:%s\n",err.Error())
  }
  log.Println("merge done.")
}

3. 转换格式

package main

import (
  go_ffmepg_core "github.com/Resynz/go-ffmpeg-core"
  "log"
)

func main () {
  transform:=&go_ffmpeg_core.Transform{
		Command:      "ffmpeg",
		ResourcePath: "./test.mp4",
		OutputPath:   "./test.mkv",
  }
  if err:=transform.Execute();err!=nil{
	log.Fatalf("tranform failed! error:%s\n",err.Error())
  }
  log.Println("transform done.")
}
Similar Resources

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

Dec 22, 2021

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

Nov 19, 2022

golang library to read and write various subtitle formats

libgosubs Golang library to read and write subtitles in the following formats Advanced SubStation Alpha v4 SRT TTML v1.0 - This is based on the spec p

Sep 27, 2022

🔥 Golang live stream lib/client/server. support RTMP/RTSP/HLS/HTTP[S]-FLV/HTTP-TS, H264/H265/AAC, relay, cluster, record, HTTP API/Notify, GOP cache. 官方文档见 https://pengrl.com/lal

🔥 Golang live stream lib/client/server. support RTMP/RTSP/HLS/HTTP[S]-FLV/HTTP-TS, H264/H265/AAC, relay, cluster, record, HTTP API/Notify, GOP cache. 官方文档见 https://pengrl.com/lal

lal是一个开源GoLang直播流媒体网络传输项目,包含三个主要组成部分: lalserver:流媒体转发服务器。类似于nginx-rtmp-module等应用,但支持更多的协议,提供更丰富的功能。lalserver简介 demo:一些小应用,比如推、拉流客户端,压测工具,流分析工具,调度示例程序等

Jan 1, 2023

live video streaming server in golang

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

Jan 4, 2023

live streaming server in golang

live 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

Nov 10, 2022

golang library for mux and demux file containers such as mpeg-ts,mpeg-ps,flv

gomedia mpeg-ts,mpeg-ps,flv muxer/demuxer mpeg-ts muxer mpeg-ts demuxer mpeg-ps muxer mpeg-ps demuxer flv muxer flv demuxer mpeg-ps will be done in th

Jan 4, 2023

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

Sep 10, 2022

📽 MovieGo - Video Editing in Golang

📽 MovieGo - Video Editing in Golang MovieGo is a Golang library for video editing. The library is designed for fast processing of routine tasks relat

Dec 26, 2022
Related tags
ffmpeg core for golang

go-ffmpeg-core ffmpeg core for golang 基于ffmpeg命令封装简单功能,因此运行环境需事先安装有ffmpeg命令。 ffmpeg官方下载地址: http://ffmpeg.org/download.html 1. 剥离视频文件的音频/视频 package mai

Nov 26, 2021
Golang bindings for FFmpeg

goav Golang binding for FFmpeg A comprehensive binding to the ffmpeg video/audio manipulation library. Usage import "github.com/giorgisio/goav/avforma

Dec 27, 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

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

Aug 12, 2022
Live on-demand transcoding in go using ffmpeg. Also with NVIDIA GPU hardware acceleration.

Go live HTTP on-demand transcoding Transcoding is expensive and resource consuming operation on CPU and GPU. For big companies with thousands of custo

Dec 16, 2022
A Go implementation of fluent-ffmpeg

A Go implementation of fluent-ffmpeg

Dec 7, 2022
A small program in Go that efficiently compresses videos using ffmpeg.

discordcompressor A small program in Go that efficiently compresses videos using ffmpeg. Dependencies FFmpeg including FFprobe Usage discordcompressor

Dec 18, 2022
Stream video from ffmpeg to webrtc

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

Dec 28, 2022
Videncode - Media Encoder (with ffmpeg)

Videncode - Media Encoder (with ffmpeg) Powered by yellyoshua (With2 easy steps) - Build JSON with folder of videos > Process the videos to the new fo

Nov 19, 2022
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

May 9, 2022