Skip to content

Allan-Nava/go-ffmpeg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Ffmpeg

Go build Go Test workflow

Install

go get github.com/Paxx-RnD/go-ffmpeg

Simple Example

func main(){
   headers := []string{
		"-y",
		"-hide_banner",
		"-loglevel", "info",
	}
    
    configuration := configuration.NewConfiguration(
		"usr/bin/ffmpeg",
		"usr/bin/ffprobe",
		false)
        
    f := ffmpeg.NewFfmpeg(configuration, headers)
    
    args := f.
        Input("/path/to/video.mp4").
        Output("/path/to/output.mp4").
        Build()

    f.Run(args)
}

Example with bitrate and codecs

func main(){
    headers := []string{
		"-y",
		"-hide_banner",
		"-loglevel", "info",
	}
    
    configuration := configuration.NewConfiguration(
		"usr/bin/ffmpeg",
		"usr/bin/ffprobe",
		false)
        
    f := ffmpeg.NewFfmpeg(configuration, headers)

    args := f.
        Input("/path/to/video.mp4").
        BitrateVideo(common_bitrates.VideoBitrate100K).
        BitrateAudio(common_bitrates.AudioBitrate128K).
        CodecVideo(codec_video.LIBX264).
        CodecAudio(codec_audio.AAC).
        Output("/path/to/output.mp4").
        Build()

    f.Run(args)
}

Example with Filter Complex

func main(){
    headers := []string{
		"-y",
		"-hide_banner",
		"-loglevel", "info",
	}
    
    configuration := configuration.NewConfiguration(
		"usr/bin/ffmpeg",
		"usr/bin/ffprobe",
		false)
        
    f := ffmpeg.NewFfmpeg(configuration, headers)

    args := f.
        Input("/path/to/video.mp4").
        CodecVideo(codec_video.LIBX264).
        CodecAudio(codec_audio.AAC).
        FilterGraph().
        Fps("0:v", 15, "fps1").
        Scale("fps1", 100, 100, "scale").
        Map("scale").
        Output("/path/to/output.mp4").
        Build()
        
    f.Run(args)
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%