So i am running an ffmpeg command on my linux server using the php exec command :

exec("(nohup nice -n 19 " . $ffmpegPath . " -y -i " . $srcFile . " -f mp4 -pass 1 -passlogfile " . $video_pass_log . " -vcodec libx264 -cpu-used 0 -threads 1 -profile:v baseline -vf \"movie=/var/www/vhosts/examplesite.com/httpdocs/images/ae-ffmpeg.png [logo]; [in] scale=".$srcWidth.":floor(ow*(".$srcWidth."/ow)/dar/hsub)*hsub+2[scale]; [scale][logo] overlay=main_w-overlay_w-1:main_h-overlay_h-1 [out]\" ".$options." -r 25 -g 25 -keyint_min 25 -b:v ".$bitrate."k -an " . $destFile . ".mp4 && " . $ffmpegPath . " -y -i " . $srcFile . " -f mp4 -pass 2 -passlogfile " . $video_pass_log . " -vcodec libx264 -cpu-used 0 -threads 1 -profile:v baseline -ac 2 -ab 128k -vf \"movie=/var/www/vhosts/examplesite.com/httpdocs/images/ae-ffmpeg.png [logo]; [in] scale=".$srcWidth.":floor(ow*(".$width."/ow)/dar/hsub)*hsub+2[scale]; [scale][logo] overlay=main_w-overlay_w-1:main_h-overlay_h-1 [out]\" ".$options." -r 25 -g 25 -keyint_min 25 -b:v ".$bitrate."k " . $destFile . ".mp4 && " . $mp4boxpath . " -tmp /tmp -isma -inter 500 " . $destFile . ".mp4 && rm -f " . $video_pass_log . "* && " . $ffmpegPath . " -y -i " . $srcFile . "  -vcodec libvpx -cpu-used 0 -threads 1 -acodec libvorbis -vf \"movie=/var/www/vhosts/examplesite.com/httpdocs/images/ae-ffmpeg.png [logo]; [in] scale=".$srcWidth.":floor(ow*(".$srcWidth."/ow)/dar/hsub)*hsub+2[scale]; [scale][logo] overlay=main_w-overlay_w-1:main_h-overlay_h-1 [out]\" ".$options." -ac 2 -ab 128k -r 25 -g 25 -keyint_min 25 -b:v ".$bitrate."k -f webm " . $destFile . ".webm) > /dev/null 2>/dev/null &");

I am pretty sure that the ffmpeg exec command is fine because the strange thing is that if I change the destination path of the converted video to a 'normal' folder on my website then both files save which is good, but then when I change the destination path to where I have a mounted folder, only the webm file will save.

So my 'normal' folder is at http://examplesite.com/tmp/ and my mounted folder is http://examplesite.com/files/

It's quite strange that the webm video has no problems saving to the mounted folder yet the mp4 video does... and like I said, both files save to the 'tmp' folder

Permissions on both the normal and mounted folders are set to 777 for testing purposes and the mounted drive folders are chowned to be the same as all of the other folders on my site.

Any ideas on how I can fix this?

  • Delete this question please, it is solved – Jizbo Jonez Oct 8 '14 at 20:05
  • If you post how you solved it, that would be useful. – sysadmin1138 Oct 8 '14 at 20:28

After trying the exec command with two pass and mp4 box removed things worked fine. I then tried two pass by itself wondering if it was an issue with the pass log file and that also worked. So obviously it was MP4Box that caused the problem. After some reading I found out that MP4Box will not save from one partition to another.

WARNING: MP4Box may create a file in this temporary directory, and then renamed it to the output name. If the final destination folder and the temporary folder are not on the same partition of the drive MP4Box will fail renaming the file. This applies to all edit operations using an existing input file and saving the result to this same file (not using -out switch to specify a different output filename).

Source: http://gpac.wp.mines-telecom.fr/mp4box/mp4box-documentation/

The tmp folder I was using for the two pass ffmpeg command and also the MP4Box was on a different partion to my final destination folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.