haha array_filter preserves keys
This commit is contained in:
parent
930518f046
commit
f5a2a9faf0
1 changed files with 9 additions and 3 deletions
10
pack-vid
10
pack-vid
|
@ -95,9 +95,15 @@ function convert( $src, $dest, $options ) {
|
|||
|
||||
$probe = ffprobe( $src );
|
||||
|
||||
$videoTracks = array_filter( $probe->streams, function ( $stream ) {
|
||||
$videoTracks = array_values(
|
||||
array_filter( $probe->streams, function ( $stream ) {
|
||||
return $stream->codec_type === 'video';
|
||||
} );
|
||||
} )
|
||||
);
|
||||
if ( count( $videoTracks ) == 0 ) {
|
||||
var_dump( $probe );
|
||||
die("oh no\n");
|
||||
}
|
||||
$track = $videoTracks[0];
|
||||
|
||||
$duration = floatval( $track->duration );
|
||||
|
|
Loading…
Reference in a new issue