|
Carlos Castillo |
at Apr 27, 2014 at 4:34 pm
|
⇧ |
| |
For #3, you can simply assign the response.Body (an io.Reader) to the
cmd.Stdin field (also io.Reader) instead of getting a pipe, and writing a
processing loop or using io.Copy.
eg:
cmd := exec.Cmd(<ffmpeg command>)
cmd.Stdin = request.Body
cmd.Run() //
On Sunday, April 27, 2014 5:16:58 AM UTC-7, Ahmed Waheed wrote:I'm not very awake yet so I might be wrong but what you'd roughly need to
do is :
1. Get a reader from `req.FormFile<
http://golang.org/pkg/net/http/#Request.FormFile>
`
2. Execute `ffmpeg -i pipe:0<
http://www.ffmpeg.org/ffmpeg-protocols.html#pipe>`
using `exec.Cmd`
3. Pass the reader from #1 to `Cmd.StdinPipe<
http://golang.org/pkg/os/exec/#Cmd.StdinPipe>
()`
4. Profit.
On Sunday, April 27, 2014 12:06:07 PM UTC+2, nvcnvn wrote:
I buliding an web app that allow user upload the video (mp4) and then
resize/compress/extract audio from it.
Now after save the video in disk, I use os package to call ffmpeg do the
function.
Is there any go package that allow me to work directly with the
request.Body?
Will it be faster, equal or atleast just 30% slower than my old way?
P/s: this is the first time I work with video/audio stuff :D
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.