Collections functions
General functions
Render functions
Theme permission 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 8608 to 8623

Definition

 
function get_video_duration(string $file_path)
    {
        
// Escape file_path
        
$file_path_escaped escapeshellarg($file_path);

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

This article was last updated 26th September 2022 13:35 Europe/London time based on the source file dated 22nd September 2022 10:25 Europe/London time.