You are here

function ffmpeg_auto_resolution in Video 6.3

Return the video resolution

File

plugins/ffmpeg.inc, line 70
Provide a api for video conversion and auto thumbnailing using ffmpeg.

Code

function ffmpeg_auto_resolution(&$node) {
  if (!variable_get('video_ffmpeg_helper_auto_resolution', false)) {

    // call ffmpeg -i
    $ffmpeg_output = ffmpeg_get_video_info($node);

    // get resolution
    $pattern = '/Video: .*, ([0-9]{2,4}x[0-9]{2,4})/';
    preg_match_all($pattern, $ffmpeg_output, $matches, PREG_PATTERN_ORDER);
    $resolution = $matches[1][0];
    return explode("x", $resolution);
  }
  return null;
}