Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

get_video_duration()

Description

Get video duration

Parameters

ColumnTypeDefaultDescription
$file_path string Path to video file

Return

float

Location

include/resource_functions.php lines 9018 to 9033

Definition

 
function get_video_duration(string $file_path)
    {
    
$exiftool_fullpath get_utility_path("exiftool");
    
    
$duration_tag run_command($exiftool_fullpath "-n -duration %filepath"false, ["%filepath" => $file_path]);

    if(!empty(
$duration_tag))
        {
        
$duration str_replace(" s"""substr($duration_tagstrpos($duration_tag":") + 2));
        return 
floatval($duration);
        }
    else
        {
        return 
0;
        }
    }

This article was last updated 21st May 2024 21:35 Europe/London time based on the source file dated 20th May 2024 14:55 Europe/London time.