





















dzdh · 2024 年 5 月 27 日 · 3958 次点击
这是一个创建于 748 天前的主题,其中的信息可能已经有所发展或是发生改变。
伪代码如下:
func main() {
url := "http://a.mp4"
args := strings.Split("ffmpeg -y -i pipe:0 -f mpegts pipe:1", " ")
ctx, cancel := context.WithCancel(context.Background())
cmd := exec.CommandContext(ctx, args[0], args[1:]...)
pipe0, _ := cmd.StdinPipe()
pipe1, _ := cmd.StdoutPipe()
cmd.Start()
go func () {
cmd.Wait()
}
go func () {
file := os.Openfile....
io.Copy(file, pipe1)
}
io.Copy(pipe0, http.resp.body)
}
问题是,write 完成了,但是我不确定转码完成了没。去监听 stderr 吗?看 stderr 的已完成转码时长是不是等于预期?
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。