You are here

public function video_ffmpeg::get_dimensions in Video 7

Same name and namespace in other branches
  1. 6.4 transcoders/video_ffmpeg.inc \video_ffmpeg::get_dimensions()
1 method overrides video_ffmpeg::get_dimensions()
video_ffmpeg_php::get_dimensions in transcoders/video_ffmpeg_php.inc
Return the dimensions of a video

File

transcoders/video_ffmpeg.inc, line 253

Class

video_ffmpeg

Code

public function get_dimensions($video) {
  $ffmpeg_output = $this
    ->get_video_info($video);
  $res = array(
    'width' => 0,
    'height' => 0,
  );

  // Get dimensions
  $regex = preg_match('/([0-9]{1,5})x([0-9]{1,5})/', $ffmpeg_output, $regs);
  if (isset($regs[0])) {
    $dimensions = explode("x", $regs[0]);
    $res['width'] = $dimensions[0] ? $dimensions[0] : NULL;
    $res['height'] = $dimensions[1] ? $dimensions[1] : NULL;
  }
  return $res;
}