[GH-ISSUE #719] Rotated mp4 files are warped in importing with ffmpeg #584

Closed
opened 2026-02-26 09:31:58 +03:00 by kerem · 4 comments
Owner

Originally created by @JJKylee on GitHub (Sep 11, 2020).
Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/719

Originally assigned to: @NickeManarin on GitHub.

OS: Windows 10 Home x64 19041.508
Program: ScreenToGif 2.27 portable

I recorded my iPad screen in the landscape mode, and the resulting mp4 file has a rotate tag of 270 degrees and a display aspect ratio of 3:4. Any normal player plays it as expected: the video is exactly the same as when it was recorded in the landscape mode.

But while trying to import the mp4 file in ScreenToGif, I found two weird behaviors.

  1. FFmpeg rotates the video but the display aspect ratio(DAR) is warped: it still remains 3:4.
  2. MediaPlayer does not respect the rotate tag.

Well, 2) doesn't matter since I can always rotate the frames within ScreenToGif. But 1) is a big problem.

In an attempt to fix this problem, I remuxed the mp4 file with a new DAR tag as follows:

ffmpeg -hide_banner -i INPUT.mp4 -aspect 4:3 -c copy OUTPUT.mp4

But there was no change. ScreenToGif does not respect this new DAR and just rotates the video with a warped aspect ratio as before.

So this time I just removed the rotate tag without aspect ratio change as follows:

ffmpeg -hide_banner -i INPUT.mp4 -c copy -metadata:s:v:0 rotate=0 OUTPUT.mp4

And as expected, this worked the same as 2), and I just needed to rotate the frames in ScreenToGif.

Well, IMHO, this seems like a bug.

Originally created by @JJKylee on GitHub (Sep 11, 2020). Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/719 Originally assigned to: @NickeManarin on GitHub. **OS**: Windows 10 Home x64 19041.508 **Program**: ScreenToGif 2.27 portable I recorded my iPad screen in the landscape mode, and the resulting mp4 file has a rotate tag of 270 degrees and a display aspect ratio of 3:4. Any normal player plays it as expected: the video is exactly the same as when it was recorded in the landscape mode. But while trying to import the mp4 file in ScreenToGif, I found two weird behaviors. 1) FFmpeg rotates the video but the display aspect ratio(DAR) is warped: it still remains 3:4. 2) MediaPlayer does not respect the rotate tag. Well, 2) doesn't matter since I can always rotate the frames within ScreenToGif. But 1) is a big problem. In an attempt to fix this problem, I remuxed the mp4 file with a new DAR tag as follows: `ffmpeg -hide_banner -i INPUT.mp4 -aspect 4:3 -c copy OUTPUT.mp4` But there was no change. ScreenToGif does not respect this new DAR and just rotates the video with a warped aspect ratio as before. So this time I just removed the rotate tag without aspect ratio change as follows: `ffmpeg -hide_banner -i INPUT.mp4 -c copy -metadata:s:v:0 rotate=0 OUTPUT.mp4` And as expected, this worked the same as 2), and I just needed to rotate the frames in ScreenToGif. Well, IMHO, this seems like a bug.
kerem 2026-02-26 09:31:58 +03:00
Author
Owner

@NickeManarin commented on GitHub (Sep 14, 2020):

Hi, do you have a sample video that you can share?
Like 1-3 seconds long.

<!-- gh-comment-id:691771419 --> @NickeManarin commented on GitHub (Sep 14, 2020): Hi, do you have a sample video that you can share? Like 1-3 seconds long.
Author
Owner

@JJKylee commented on GitHub (Sep 14, 2020):

Here's the link: here.
This clip will be removed in two days.

<!-- gh-comment-id:691788151 --> @JJKylee commented on GitHub (Sep 14, 2020): Here's the link: [here](https://drive.google.com/drive/folders/1Fv96A-qk4wyeJ2HEqAvT-Mklu9SlS1Bl?usp=sharing). This clip will be removed in two days.
Author
Owner

@NickeManarin commented on GitHub (Sep 14, 2020):

Thanks. I downloaded it.

<!-- gh-comment-id:691788442 --> @NickeManarin commented on GitHub (Sep 14, 2020): Thanks. I downloaded it.
Author
Owner

@NickeManarin commented on GitHub (Sep 21, 2020):

I fixed the FFmpeg importer.

image

<!-- gh-comment-id:696126974 --> @NickeManarin commented on GitHub (Sep 21, 2020): I fixed the FFmpeg importer. ![image](https://user-images.githubusercontent.com/14798947/93772416-3603cf00-fbf5-11ea-9a0d-1712eef7fe2c.png)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenToGif#584
No description provided.