-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/xfrr/goffmpeg
- Loading branch information
Showing
1 changed file
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,66 @@ | ||
# goffmpeg | ||
# Goffmpeg | ||
FFMPEG wrapper written in GO | ||
|
||
> Building | ||
|
||
# Dependencies | ||
- [FFmpeg](https://www.ffmpeg.org/) | ||
|
||
# Getting started | ||
How to transcode a media file | ||
```go | ||
package main | ||
|
||
import ( | ||
"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 | ||
done, err := trans.Run() | ||
|
||
// This channel is used to wait for the process to end | ||
<-done | ||
|
||
} | ||
``` | ||
How to get the transcoding progress | ||
```go | ||
... | ||
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 | ||
done, err := trans.Run() | ||
|
||
// Returns a channel to get the transcoding progress | ||
progress, err := 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 | ||
<-done | ||
|
||
} | ||
``` | ||
Manipulating media file | ||
> Building |