Get the latest tech news
A Golang pipeline abomination
In this compelling exploration of Go's concurrency toolkit, we tackle the messy challenge of overlaying a looping music track onto a lengthy voice soundtrack—an abomination many face! 🎶💻 Using ffmpeg, io.Pipe, and io.TeeReader, we navigate the complexities of streaming data and show how to transform chaos into seamless audio processing. If you find yourself grappling with similar issues, click to learn how I can help fix your audio nightmares and streamline your Golang projects! 🔍✨
However, ffmpeg cannot seek back to the beginning of the pipe and does not maintain an internal buffer of the entire input in memory, causing it to stop encoding music. This behavior allows any errors to propagate to Write calls, enabling us to identify when ffmpeg has reached the end of voice (remember,-shortest flag), and terminated. This approach is significantly more scalable and robust than previous iterations, as io.Copy blocks when the internal buffer between our application and ffmpeg is full, preventing endless data transmission.
Or read this on Hacker News