ffmpeg - Duration of an uploaded video in PHP -
i need know duration of video have uploaded page. have written php script doing this:
<?php $command = "ffmpeg -i video.mp4 2>&1 | grep duration | awk '{print $2}' | tr -d ,; "; $cm = shell_exec($command) ; echo "$cm"; ?>
when execute program via terminal shows duration, on calling in php page not give output. please provide me solution....
thanks in advance.
function shell_exec returns output in string. exec returns last line.
try this
<?php $command = "ffmpeg -i video.mp4 2>&1 | grep duration | awk '{print $2}' | tr -d ,; "; echo exec($command) ; ?>
Comments
Post a Comment