[wp-trac] [WordPress Trac] #53944: Video resolution in portrait orientation
WordPress Trac
noreply at wordpress.org
Tue Aug 17 14:17:33 UTC 2021
#53944: Video resolution in portrait orientation
--------------------------+-----------------------------
Reporter: mazursv | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.8
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Hi!
I uploaded mp4 video file having portrait orientation and found that
attachment metadata contains swapped width and height parameters. I see
that WP is using getID3 library to read video metadata and found that it
can detect when video is rotated.
I used following filter to fix that:
{{{#!php
<?php
add_filter('wp_read_video_metadata', [$this, 'wp_read_video_metadata'],
20, 4);
...
public function wp_read_video_metadata( $metadata, $file, $file_format,
$id3_data ) {
if( !empty( $id3_data['video']['rotate'] ) ) {
if( $id3_data['video']['rotate'] === 90 ||
$id3_data['video']['rotate'] === 270 ) {
$metadata['width'] =
$id3_data['video']['resolution_y'];
$metadata['height'] =
$id3_data['video']['resolution_x'];
}
}
return $metadata;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53944>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list