Converting Video files in a Azure Webjob with ffMpeg

有些话、适合烂在心里 提交于 2019-12-11 12:23:07

问题


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 !


回答1:


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.




回答2:


You may be running into some sandbox restrictions. To help isolate, I suggest trying to run your command directly from Kudu Console to take the WebJobs part out of the equation.



来源:https://stackoverflow.com/questions/34160480/converting-video-files-in-a-azure-webjob-with-ffmpeg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!