package main import ( "context" "fmt" "os/exec" ) func GetStreamsFromFile(path string) (string, error) { cmd := exec.Command( "ffprobe", "-loglevel", "error", "-show_entries", "stream=codec_type", "-of", "csv=p=0", path, ) data, err := cmd.CombinedOutput() return string(data), err } func ConvertToAudio(ctx context.Context, videoFile, targetPath string) error { cmd := exec.CommandContext( ctx, "ffmpeg", "-i", videoFile, "-y", // overwrite existing file "-vn", // no video "-ar", "44100", // sample rate "-ac", "2", // audio channels "-ab", "192k", // dont know dont care "-f", "mp3", // output format targetPath, ) data, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("error during process execution: %w\nOutput:\n%s", err, string(data)) } return nil }