Skip to content

Commit

Permalink
Merge pull request mifi#211 from mattkibbler/rotation-fix
Browse files Browse the repository at this point in the history
Rotation fix
  • Loading branch information
mifi authored Oct 10, 2022
2 parents 33e1823 + c62c72b commit d3d3a71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion parseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default async function parseConfig({ defaults: defaultsIn = {}, clips, ar

const inputDuration = cutTo - cutFrom;

const isRotated = rotation === 90 || rotation === 270;
const isRotated = [-90, 90, 270, -270].includes(rotation);
const inputWidth = isRotated ? heightIn : widthIn;
const inputHeight = isRotated ? widthIn : heightIn;

Expand Down
8 changes: 7 additions & 1 deletion util.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ export async function readVideoFileInfo(ffprobePath, p) {

const duration = await readDuration(ffprobePath, p);

const rotation = stream.tags && stream.tags.rotate && parseInt(stream.tags.rotate, 10);
let rotation = parseInt(stream.tags && stream.tags.rotate, 10);

// If we can't find rotation, try side_data_list
if (Number.isNaN(rotation) && Array.isArray(stream.side_data_list) && stream.side_data_list[0] && stream.side_data_list[0].rotation) {
rotation = parseInt(stream.side_data_list[0].rotation, 10);
}

return {
// numFrames: parseInt(stream.nb_frames, 10),
duration,
Expand Down

0 comments on commit d3d3a71

Please sign in to comment.