In Linux server, the FLV recorded by FlashCom, file permission by default is 0660 (rw-rw—-). Tonight, I did some jpg screen capture from the video frame using FFmpeg through exec in PHP. It is so strange the conversion never success. Firstly, I thought it is PHP permission problem, I found I can run exec on FFmpeg -version without problem. Next, I thought it was the jpg saved folder forgot to set a write permission, I checked that I have done. Thirdly, I wondered is it FlashCom locks the just created FLV, but after restart FlashCom, it was still not work.

So, I try to use php exec FFmpeg on some FLV encoded in video encoder. Oh, the conversion is work without any problem. Therefore, I sure it was the problem on the FlashCom recorded FLV, I thought may be the file ownership problem but finally find out it is the file permission problem, “Other” has no right to read the file.

My immediate reaction was using chmod in php to change it to 664 (rw-rw-r–), but it come out php error said it does not have such right to chmod on the file. I think FlashCom should not such stubborn cannot change file permission. I scan through all the XML configuration files. I find Server.xml: <Mask>017</Mask> for setting the file permission. It is octal format, by 666 – x = wanted permission. I want 664, so 666-664, x=2, I change that line to:
<Mask>002</Mask>

Save and restart FlashCom, all the problems solved :)