Monday 20 January 2020

How to Get Video Details Including Orientation Duration Using FFMPEG

Here I am going to get details related to FFMPEG including orientation, duration.

image

Step to get details related to FFMPEGincluding orientation, duration.
1. Get Video duration:
$ffmpeg_path = “/usr/bin/ffmpeg”; //Path to your FFMPEG
$video_path = “/vidoes/myvideo.mov”; // Path to your Video $command = $ffmpeg_path . ‘ -i “‘ . $video_path . ‘” -vstats 2>&1’; $output = shell_exec($command);$regex_duration = “/Duration: ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}).([0-9]{1,2})/”;if (preg_match($regex_duration, $output, $regs)) {$hours = $regs [1] ? $regs [1] : null;$mins = $regs [2] ? $regs [2] : null;$secs = $regs [3] ? $regs [3] : null;} $video_Length = $hours . “:” . $mins . “:” . $secs;

No comments:

Post a Comment