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 8948 to 8963

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 19th March 2024 05:35 Europe/London time based on the source file dated 11th March 2024 14:25 Europe/London time.