1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-29 21:31:07 +02:00

ffmpeg outputs logs only to stderr

This commit is contained in:
Alexandre Iooss
2020-10-04 20:47:05 +02:00
parent 1576e391eb
commit f3d38dc10d
2 changed files with 8 additions and 35 deletions

View File

@ -63,10 +63,6 @@ func registerStream(name string, ffmpegInstances map[string]*exec.Cmd, ffmpegInp
if err != nil {
return err
}
output, err := ffmpeg.StdoutPipe()
if err != nil {
return err
}
errOutput, err := ffmpeg.StderrPipe()
if err != nil {
return err
@ -79,19 +75,11 @@ func registerStream(name string, ffmpegInstances map[string]*exec.Cmd, ffmpegInp
return err
}
// Log ffmpeg output
go func() {
scanner := bufio.NewScanner(output)
for scanner.Scan() {
log.Printf("[FFMPEG %s] %s", name, scanner.Text())
}
}()
// Log also error output
// Log standard error output
go func() {
scanner := bufio.NewScanner(errOutput)
for scanner.Scan() {
log.Printf("[FFMPEG ERR %s] %s", name, scanner.Text())
log.Printf("[FFMPEG %s] %s", name, scanner.Text())
}
}()