Closed GostGrimmy closed 10 months ago
The argument "path/source/video.mp4"
, is wrong, it needs to be absolute, "/path/source/video.mp4"
. This is not a Go bug.
func TestCmd(t *testing.T) {
var sss = make([]string, 0)
sss = append(sss,
"-re",
"-i", "/home/ubuntu/视频/1641278835_L0bLYHpw8vF8ODVAy_Source.mp4",
"-map", "0",
"-c:a", "aac",
"-c:v", "libx264",
"-b:v:0", "750k",
"-s:v:0", "640x360",
"-vf:v:0", "scale=-1:360",
//"filter:v", "fps=24",
"-profile:v:0", "main",
"-bf", "1",
"-keyint_min", "120",
"-g", "120",
"-sc_threshold", "0",
"-b_strategy", "0",
"-ar:a:0", "22050",
"-use_timeline", "1",
"-use_template", "1",
"-window_size", "5",
"-adaptation_sets", "\"id=0,streams=v id=1,streams=a\"",
"-f", "dash",
"/home/ubuntu/.svideo/data/video/out.mpd",
)
fmt.Println("command", sss)
command := exec.Command("ffmpeg",
sss...,
)
output, err := command.CombinedOutput()
fmt.Println(string(output))
if err != nil {
fmt.Println(err.Error())
}
}
Not the path problem, It also appears to the ffmpeg-go lib. That lib also use exec command lib.
@GostGrimmy what I'd check for first — try dropping quoting from your arguments, use
"-adaptation_sets", "id=0,streams=v id=1,streams=a",
instead of the current
"-adaptation_sets", "\"id=0,streams=v id=1,streams=a\"",
You don't need to quote things as in shell, ffmpeg in your case is handed the quoted string, so I suspect it fails on parsing it.
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
For questions please refer to https://github.com/golang/go/wiki/Questions
@GostGrimmy what I'd check for first — try dropping quoting from your arguments, use
"-adaptation_sets", "id=0,streams=v id=1,streams=a",
instead of the current
"-adaptation_sets", "\"id=0,streams=v id=1,streams=a\"",
You don't need to quote things as in shell, ffmpeg in your case is handed the quoted string, so I suspect it fails on parsing it.
Yes, you are right. Thanks for reply
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
For questions please refer to https://github.com/golang/go/wiki/Questions
Okay, Sorry about not know that.
Go version
go version go1.20.2 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
Bug:
Description
same command , use linux shell success. but failed in use goland exec lib
Test code
The exec command
What did you expect to see?
ffmpeg exec success
What did you see instead?