使用ffMpeg在Azure Webjob中转换视频文件 [英] Converting Video files in a Azure Webjob with ffMpeg
问题描述
我发现以下文章(
run.cmd
只是:
del output.mp4
ffmpeg -i screencast.wmv -c:v libx264 -r 15 output.mp4
这适用于我的个人机器,但是作为一个webjob运行我得到结果如下。
[12/08/2015 15:42:39> bf9dd6:SYS INFO]状态更改为初始化
[12/08/2015 15:42:39> bf9dd6:SYS INFO]检测到作业目录更改:作业文件'ffmpegtest\output.mp4'存在于源目录中,但不在工作目录中。
[12/08/2015 15:42:47> bf9dd6:SYS INFO]使用脚本主机运行脚本'run.cmd' - 'WindowsScriptHost'
[12/08/2015 15:42:48> bf9dd6:SYS INFO]状态更改为运行< br />
[12/08/2015 15:42:48> bf9dd6:INFO]
[12/08/2015 15:42:48> bf9dd6:INFO] D:\local\Temp\jobs\triggered\ffMpeg\y1bdnb1e.03k\ffmpegtest> del output.mp4
[12/08/2015 15:42:48> ; bf9dd6:INFO]
[12/08/2015 15:42:48> bf9dd6:INFO] D:\local\Temp\jobs\triggered\ffMpeg\y1bdnb1e.03k\ffmpegtest> ffmpeg -i screencast.wmv -c:v libx264 -r 15 output.mp4
[12/08/2015 15:42:49> bf9dd6:SYS INFO]状态更改为失败
[12/08/2015 15:42:49> bf9dd6:SYS ERR]由于退出代码,作业失败-1073741515
编辑:
另外,有人建议我使用Kudu控制台。仍然没有运气:
解决方案:
我结束了需要运行32版本的ffMpeg而不是64位。非常感谢@mathewc!
您的问题是您需要将您的输入/输出文件名称引入 run.cmd
文件,以便它们正确扩展。
ffmpeg -i .wmv-c:v libx264 -r 15output.mp4
将来,诊断这些类型问题的最佳方法是在您的 Kudu控制台中运行命令从你的exe获得详细的输出信息。这样可以让您在本地进行测试,并解决在Azure环境中运行时可能存在的任何轻微差异。
I'm having trouble using ffMpeg in an Azure webjob.
I found the following article (How to call ffmpeg.exe to convert audio files on Windows Azure?) and it is exactly what I want to do, however, I cannot get ffMpeg to execute and it gives no error message.
To diagnose the problem, I have boiled it down to its essentials by uploading ffMpeg, a video file to convert, and batch file to run it:
The script in run.cmd
is simply:
del output.mp4
ffmpeg -i screencast.wmv -c:v libx264 -r 15 output.mp4
This works on my personal machine, but ran as a webjob I get results below.
[12/08/2015 15:42:39 > bf9dd6: SYS INFO] Status changed to Initializing
[12/08/2015 15:42:39 > bf9dd6: SYS INFO] Job directory change detected: Job file 'ffmpegtest\output.mp4' exists in source directory but not in working directory.
[12/08/2015 15:42:47 > bf9dd6: SYS INFO] Run script 'run.cmd' with script host - 'WindowsScriptHost'
[12/08/2015 15:42:48 > bf9dd6: SYS INFO] Status changed to Running<br />
[12/08/2015 15:42:48 > bf9dd6: INFO]
[12/08/2015 15:42:48 > bf9dd6: INFO] D:\local\Temp\jobs\triggered\ffMpeg\y1bdnb1e.03k\ffmpegtest>del output.mp4
[12/08/2015 15:42:48 > bf9dd6: INFO]
[12/08/2015 15:42:48 > bf9dd6: INFO] D:\local\Temp\jobs\triggered\ffMpeg\y1bdnb1e.03k\ffmpegtest>ffmpeg -i screencast.wmv -c:v libx264 -r 15 output.mp4
[12/08/2015 15:42:49 > bf9dd6: SYS INFO] Status changed to Failed
[12/08/2015 15:42:49 > bf9dd6: SYS ERR ] Job failed due to exit code -1073741515
Edit:
Additionally, it was suggested that I run using Kudu console. Still no luck:
Solution:
I ended up needing to run the 32 version of ffMpeg and not the 64 bit. Thanks so much @mathewc !
Your issue is that you need to enclose your input/output file names in quotes in your run.cmd
file so they expand properly.
ffmpeg -i "screencast.wmv" -c:v libx264 -r 15 "output.mp4"
For the future, the best way to diagnose these types of problems is to run your commands in your Kudu Console to get detailed output info from your exe. That allows you to test things as you would locally, and to address any slight discrepancies that may exist when running in the Azure environment.
这篇关于使用ffMpeg在Azure Webjob中转换视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!