/    Sign up×
Community /Pin to ProfileBookmark

exec() Command Not Working – FFMPEG

I am having a problem with exec() not working properly and I can’t figure out why.

If I enter the output directly in the terminal it works fine. However, when I try and execute the command via PHP exec() it does not work.

Can anyone tell me why this is not working?

[code=php]
$config[‘ffmpeg’] = ‘/usr/bin/ffmpeg’;
$watermark = ‘/home/mydomain/public_html/watermark.png’;
$src = ‘/home/mydomain/public_html/input.flv’;
$dst = ‘/home/mydomain/public_html/output.flv’;
$cmd = $config[‘ffmpeg’]. ‘ -i ‘ .$src. ‘ -vf “movie=’ .$watermark. ‘ [wm]; [in][wm] overlay=main_w-overlay_w-10:10 [out]”‘ .$dst;
exec($cmd);
[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@Master00authorMar 05.2013 — Looks like this has to do with a permissions issue. It shows a 'Permission Denied' error for the input file. The file is set to 0775 and I have also tried to chown the file and it's directory without any luck.

Any idea how to fix this permission problem?

[CODE]Array ( [0] => ffmpeg version N-50471-g7992bdb Copyright (c) 2000-2013 the FFmpeg developers [1] => built on Mar 4 2013 19:03:13 with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-54) [2] => configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 [3] => libavutil 52. 17.103 / 52. 17.103 [4] => libavcodec 54. 92.100 / 54. 92.100 [5] => libavformat 54. 63.102 / 54. 63.102 [6] => libavdevice 54. 3.103 / 54. 3.103 [7] => libavfilter 3. 41.100 / 3. 41.100 [8] => libswscale 2. 2.100 / 2. 2.100 [9] => libswresample 0. 17.102 / 0. 17.102 [10] => libpostproc 52. 2.100 / 52. 2.100 [11] => /home/mydomain/public_html/input.flv: Permission denied ) /usr/bin/ffmpeg -i /home/mydomain/public_html/input.flv -vf "movie=/home/mydomain/public_html/watermark.png [wm]; [in][wm] overlay=main_w-overlay_w-10:10 [out]" /home/mydomain/public_html/output.flv -y 2>&1[/CODE]
Copy linkTweet thisAlerts:
@Master00authorMar 05.2013 — I got this to work by setting both the file and the directory to 0777

I also had to add 2>&1 to the end of the command
×

Success!

Help @Master00 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...