500-video-processing

command
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

500-video-processing

In this example, we will extract audio (mp3) from a YouTube video using youtubbe-dl and ffmpeg.

However instead of downloading the entire video to our computer and keeping our CPU busy, we can offload this work to cloud using dexec:

youtube-dl [url] -o - | ffmpeg -i pipe:0 -f mp3 pipe:1

Then, we save the STDOUT of this command to music.mp3.

Sorry for teaching you how to pirate music, I couldn’t find a better example.

To run this example:

$ docker pull vimagick/youtube-dl
$ go run main.go
(play music.mp3)

Migration from os/exec

Again, just 5 lines (after 4 examples, you’re not surprised, right?):

> 	cl, _ := docker.NewClientFromEnv()
> 	d := dexec.Docker{cl}
> 
> 	m, _ := dexec.ByCreatingContainer(docker.CreateContainerOptions{
> 		Config: &docker.Config{Image: "vimagick/youtube-dl"}})
< 	cmd := exec.Command("sh", "-c", fmt.Sprintf("youtube-dl %s -o - | ffmpeg -i pipe:0 -f mp3 pipe:1", url))
> 	cmd := d.Command(m, "sh", "-c", fmt.Sprintf("youtube-dl %s -o - | ffmpeg -i pipe:0 -f mp3 pipe:1", url))

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL