0

This is probably a dumb question, im trying to get the duration from a video using FFMpeg: Video Duration Time = 1m:47s

My function

$ffmpeg = \FFMpeg\FFProbe::create();
$duration = $ffmpeg->format($videos[0]->real_path)->get('duration');

Now if i print $duration : "109.713333"

How can i get the video duration time from $duration??

Note:

I Tried this

 109.713333 / 60 = 1.82 
 82/60 = 1.36 and 82-36 = 46
Eliott
  • 252
  • 3
  • 18
  • 2
    Possible duplicate of [How to extract duration time from ffmpeg output?](http://stackoverflow.com/questions/6239350/how-to-extract-duration-time-from-ffmpeg-output) – Pedro Lobito Aug 10 '16 at 21:21

1 Answers1

1

If you still need it try :

$totalSecs = $ffmpeg->format($videos[0]->real_path)->get('duration');
$tempSecs['s'] = $totalSecs;
$duration = gmdate("H:i:s", (int)$tempSecs['s']);

echo "video duration : " . $duration;

PS : Where is this Duration Time = 1m:47s amount coming from? 109 seconds should give 1 minute and 49 secs. Think about it. So this means one of your feedbacks is wrong...

VC.One
  • 14,790
  • 4
  • 25
  • 57