All Projects → xfrr → Goffmpeg

xfrr / Goffmpeg

Licence: mit
FFMPEG wrapper written in GO

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Goffmpeg

Vidgear
A High-performance cross-platform Video Processing Python framework powerpacked with unique trailblazing features 🔥
Stars: ✭ 2,048 (+336.67%)
Mutual labels:  ffmpeg, streaming
Jaffree
Java ffmpeg and ffprobe command-line wrapper
Stars: ✭ 184 (-60.77%)
Mutual labels:  wrapper, ffmpeg
Videostreamer
Stream video (e.g. RTSP) to an HTML5 video element (MP4)
Stars: ✭ 208 (-55.65%)
Mutual labels:  ffmpeg, streaming
Node Tcp Streaming Server
Experimental TCP video streaming server written in node.js. Streaming over TCP and redistributing using WebSockets.
Stars: ✭ 100 (-78.68%)
Mutual labels:  ffmpeg, streaming
ffmpeg-progressbar-cli
A colored progress bar for FFmpeg.
Stars: ✭ 140 (-70.15%)
Mutual labels:  wrapper, ffmpeg
Ffplayout Engine
python and ffmpeg based playout
Stars: ✭ 128 (-72.71%)
Mutual labels:  ffmpeg, streaming
Rcloneexplorer
rclone GUI for Windows
Stars: ✭ 129 (-72.49%)
Mutual labels:  wrapper, streaming
Streaming Room
Streaming room in Node.js, rtmp, hsl, html5 videojs player
Stars: ✭ 106 (-77.4%)
Mutual labels:  ffmpeg, streaming
dji-ryze-tello
Pythonic DJI Ryze Tello Workbench
Stars: ✭ 17 (-96.38%)
Mutual labels:  streaming, ffmpeg
TLightFileStream
Implements a lightweight, high-performance, non-allocating advanced-record-based wrapper around the SysUtils file handling routines as an alternative to Classes.TFileStream.
Stars: ✭ 21 (-95.52%)
Mutual labels:  wrapper, streaming
Ffmpeg
Mirror of https://git.ffmpeg.org/ffmpeg.git
Stars: ✭ 27,382 (+5738.38%)
Mutual labels:  ffmpeg, streaming
Ffmpy
Pythonic interface for FFmpeg/FFprobe command line
Stars: ✭ 360 (-23.24%)
Mutual labels:  wrapper, ffmpeg
Hls Vod
HTTP Live Streaming with on-the-fly encoding of any video file for Web/Apple TV/iPhone/iPad/iPod
Stars: ✭ 221 (-52.88%)
Mutual labels:  ffmpeg, streaming
jsmpeg-stream-go
MPEG1 streaming demo with jsmpeg implemented by Go
Stars: ✭ 14 (-97.01%)
Mutual labels:  streaming, ffmpeg
acinerella
FFmpeg wrapper library for audio/video decoding
Stars: ✭ 18 (-96.16%)
Mutual labels:  wrapper, ffmpeg
Awesome Video
A curated list of awesome streaming video tools, frameworks, libraries, and learning resources.
Stars: ✭ 397 (-15.35%)
Mutual labels:  ffmpeg, streaming
Ffmpegcore
A .NET FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your C# applications
Stars: ✭ 429 (-8.53%)
Mutual labels:  ffmpeg
Pylivestream
Pure Python FFmpeg-based live video / audio streaming to YouTube, Facebook, Periscope, Twitch, and more
Stars: ✭ 442 (-5.76%)
Mutual labels:  ffmpeg
Jsstore
A complete IndexedDB wrapper with SQL like syntax.
Stars: ✭ 430 (-8.32%)
Mutual labels:  wrapper
Io
Dataset, streaming, and file system extensions maintained by TensorFlow SIG-IO
Stars: ✭ 427 (-8.96%)
Mutual labels:  streaming

Goffmpeg

Codacy Badge

FFMPEG wrapper written in GO which allows to obtain the progress.

V2

New implementation with an easy-to-use API and interfaces to extend the transcoding capabilities.

https://github.com/floostack/transcoder

Dependencies

Supported platforms

  • Linux
  • OS X
  • Windows

Getting started

How to transcode a media file

go get github.com/xfrr/goffmpeg
package main

import (
    "github.com/xfrr/goffmpeg/transcoder"
)

var inputPath = "/data/testmov"
var outputPath = "/data/testmp4.mp4"

func main() {

	// Create new instance of transcoder
    trans := new(transcoder.Transcoder)

	// Initialize transcoder passing the input file path and output file path
    err := trans.Initialize( inputPath, outputPath )
    // Handle error...

	// Start transcoder process without checking progress
	done := trans.Run(false)

	// This channel is used to wait for the process to end
	err = <-done
	// Handle error...

}

How to get the transcoding progress

...
func main() {

	// Create new instance of transcoder
    trans := new(transcoder.Transcoder)

	// Initialize transcoder passing the input file path and output file path
    err := trans.Initialize( inputPath, outputPath )
    // Handle error...

	// Start transcoder process with progress checking
	done := trans.Run(true)

	// Returns a channel to get the transcoding progress
	progress := trans.Output()

	// Example of printing transcoding progress
	for msg := range progress {
		fmt.Println(msg)
	}

	// This channel is used to wait for the transcoding process to end
	err = <-done

}

How to pipe in data using the pipe protocol

Creating an input pipe will return *io.PipeReader, and creating an output pipe will return *io.PipeWriter. An example is shown which uses cat to pipe in data, and ioutil.ReadAll to read data as bytes from the pipe.

func main() {

	// Create new instance of transcoder
    trans := new(transcoder.Transcoder)

	// Initialize an empty transcoder
    err := trans.InitializeEmptyTranscoder()
    // Handle error...

	// Create a command such that its output should be passed as stdin to ffmpeg
	cmd := exec.Command("cat", "/path/to/file")

	// Create an input pipe to write to, which will return *io.PipeWriter
	w, err := trans.CreateInputPipe()

	cmd.Stdout = w

	// Create an output pipe to read from, which will return *io.PipeReader.
	// Must also specify the output container format
	r, err := trans.CreateOutputPipe("mp4")

	wg := &sync.WaitGroup{}
	wg.Add(1)
	go func() {
		defer r.Close()
		defer wg.Done()

		// Read data from output pipe
		data, err := ioutil.ReadAll(r)
		// Handle error and data...
	}()

	go func() {
		defer w.Close()
		err := cmd.Run()
		// Handle error...
	}()

	// Start transcoder process without checking progress
	done := trans.Run(false)

	// This channel is used to wait for the transcoding process to end
	err = <-done
	// Handle error...

	wg.Wait()
}

Progress properties

type Progress struct {
	FramesProcessed string
	CurrentTime     string
	CurrentBitrate  string
	Progress        float64
	Speed           string
}

Media setters

Those options can be set before starting the transcoding.

SetAspect
SetResolution
SetVideoBitRate
SetVideoBitRateTolerance
SetVideoMaxBitrate
SetVideoMinBitRate
SetVideoCodec
SetVframes
SetFrameRate
SetAudioRate
SetSkipAudio
SetSkipVideo
SetMaxKeyFrame
SetMinKeyFrame
SetKeyframeInterval
SetAudioCodec
SetAudioBitRate
SetAudioChannels
SetBufferSize
SetThreads
SetPreset
SetTune
SetAudioProfile
SetVideoProfile
SetDuration
SetDurationInput
SetSeekTime
SetSeekTimeInput
SetSeekUsingTsInput
SetQuality
SetStrict
SetCopyTs
SetMuxDelay
SetHideBanner
SetInputPath
SetNativeFramerateInput
SetRtmpLive
SetHlsListSize
SetHlsSegmentDuration
SetHlsPlaylistType
SetHlsMasterPlaylistName
SetHlsSegmentFilename
SetHttpMethod
SetHttpKeepAlive
SetOutputPath
SetOutputFormat
SetAudioFilter
SetAudioVariableBitrate
SetCompressionLevel
SetFilter
SetInputInitialOffset
SetInputPipeCommand
SetMapMetadata
SetMetadata
SetStreamIds
SetTags
SetVideoFilter

Example

func main() {

	// Create new instance of transcoder
	trans := new(transcoder.Transcoder)

	// Initialize transcoder passing the input file path and output file path
	err := trans.Initialize( inputPath, outputPath )
	// Handle error...

	// SET FRAME RATE TO MEDIAFILE
	trans.MediaFile().SetFrameRate(70)
	// SET ULTRAFAST PRESET TO MEDIAFILE
	trans.MediaFile().SetPreset("ultrafast")

	// Start transcoder process to check progress
	done := trans.Run(true)

	// Returns a channel to get the transcoding progress
	progress := trans.Output()

	// Example of printing transcoding progress
	for msg := range progress {
		fmt.Println(msg)
	}

	// This channel is used to wait for the transcoding process to end
	err = <-done

}

Example with AES encryption :

More information about HLS encryption with FFMPEG

# Generate key
openssl rand 16 > enc.key

Create key file info :

Key URI
Path to key file
func main() {

	trans := new(transcoder.Transcoder)

	err := trans.Initialize(inputPath, outputPath)

	trans.MediaFile().SetVideoCodec("libx264")
	
	trans.MediaFile().SetHlsSegmentDuration(4)

	trans.MediaFile().SetEncryptionKey(keyinfoPath)

	progress := trans.Output()
	
	err = <-done
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].