ffmpeg shell输出进入php头


ffmpeg shell output goes to php header?

我正在尝试使用php脚本中的ffmpeg,例如:

exec('ffmpeg -i input.mp4 -f ogg -y output.ogv >out.txt')

让我们假设它有效,但由于多种原因,它实际上不起作用,但它将由托管提供商解决,因为我无法更改任何配置。

奇怪的是out.txt一直是0kb,相反,在php脚本完成工作后,我得到的输出如下:

Malformed header from CGI script:
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers built on May 10 2013 16:31:05 with gcc 4.8.0 (GCC) 20130502 (prerelease) configurati
(......)
Press [q] to stop, [?] for help
[vp8 @ 0x13e8d00] alloc_buffer: av_image_alloc() failed
[vp8 @ 0x13e8d00] get_buffer() failed!
sh: line 1: 1540 Segmentation fault ffmpeg -i ../uploads/videomod_m_7/433c3f8b9b0cc0f6cbdebba5263ff71809811c20o.webm -f ogg -y ../uploads/videomod_m_7/test2.ogv > out.txt
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html 

可能ffmpeg输出标准错误,请尝试

exec('ffmpeg -i input.mp4 -f ogg -y output.ogv &>out.txt')

还将stderr重定向到out.txt。