image

Video frames to Time Code PHP

[<Back>] [<Edit>]

convert frames to timecode

function framesToTC($frames, $framerate) {
    $hours = floor( $frames / ( $framerate * 60 * 60 ) );
    $framesleft = $frames - ($hours * $framerate * 60 * 60);
    $minutes = floor( $framesleft / ( $framerate * 60 ) );
    $framesleft -= ( $minutes * $framerate * 60 );
    $seconds = floor( $framesleft / ( $framerate ) );
    $framesleft -= ( $seconds * $framerate );
    $tc = sprintf("%02d:%02d:%02d:%02d", $hours, $minutes, $seconds, $framesleft );
    return $tc;
}


By: Ted Simbajon





 
Instagram Stats
pinoy
my Kung Fu