func (g Generator) generateOutput(lockCtx *fsutil.LockContext, args []string) ([]byte, error) {
	cmd := g.Encoder.Command(lockCtx, args)

	var stdout bytes.Buffer
	cmd.Stdout = &stdout

	var stderr bytes.Buffer
	cmd.Stderr = &stderr

	if err := cmd.Start(); err != nil {
		return nil, fmt.Errorf("error starting command: %w", err)
	}

	lockCtx.AttachCommand(cmd)

	if err := cmd.Wait(); err != nil {
		var exitErr *exec.ExitError
		if errors.As(err, &exitErr) {
			exitErr.Stderr = stderr.Bytes()
			err = exitErr
		}
		return nil, fmt.Errorf("error running ffmpeg command <%s>: %w", strings.Join(args, " "), err)
	}

	return stdout.Bytes(), nil
}
// GenerateOutput runs ffmpeg with the given args and returns it standard output.
GenerateOutput runs ffmpeg with the given args and returns it standard output.
// GenerateOutput runs ffmpeg with the given args and returns it standard output .
func (g Generator) generateOutput(lockCtx *fsutil.LockContext, args []string) ([]byte, error) {
	cmd := g.Encoder.Command(lockCtx, args)
	var stdout bytes.Buffer
	cmd.Stdout = &stdout
	var stderr bytes.Buffer
	cmd.Stderr = &stderr
	if err := cmd.Start(); err != nil {
		return nil, fmt.Errorf("error starting command: %w", err)
	}
	lockCtx.AttachCommand(cmd)
	if err := cmd.Wait(); err != nil {
		var exitErr *exec.ExitError
		if errors.As(err, &exitErr) {
			exitErr.Stderr = stderr.Bytes()
			err = exitErr
		}
		return nil, fmt.Errorf("error running ffmpeg command <%s>: %w", strings.Join(args, " "), err)
	}
	return stdout.Bytes(), nil
}
func ( g Generator ) generateOutput ( lockCtx * fsutil . LockContext , args [ ] string ) ( [ ] byte , error ) { cmd := g . Encoder . Command ( lockCtx , args ) var stdout bytes . Buffer cmd . Stdout = & stdout var stderr bytes . Buffer cmd . Stderr = & stderr if err := cmd . Start ( ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } lockCtx . AttachCommand ( cmd ) if err := cmd . Wait ( ) ; err != nil { var exitErr * exec . ExitError if errors . As ( err , & exitErr ) { exitErr . Stderr = stderr . Bytes ( ) err = exitErr } return nil , fmt . Errorf ( " " , strings . Join ( args , " " ) , err ) } return stdout . Bytes ( ) , nil }
GenerateOutput runs ffmpeg with the given args and returns it standard output.
GenerateOutput runs ffmpeg with the given args and returns it standard output .