one_second_diary icon indicating copy to clipboard operation
one_second_diary copied to clipboard

Videos recorded upside down are not properly rotated

Open arcstur opened this issue 2 years ago • 16 comments
trafficstars

When I record a video, using the default camera app, with the phone upside down, the camera app auto-orientates it, and the gallery and other apps show it with the correct orientation. One Second Diary, however, shows the video upside down when adding from the calendar section, maybe this has somethind to do with video orientation metadata?

Basically, a normal video for all the apps (and my computer) appears upside down in the app.

arcstur avatar Apr 14 '23 01:04 arcstur

When I record a video, using the default camera app, with the phone upside down, the camera app auto-orientates it, and the gallery and other apps show it with the correct orientation. One Second Diary, however, shows the video upside down when adding from the calendar section, maybe this has somethind to do with video orientation metadata?

Basically, a normal video for all the apps (and my computer) appears upside down in the app.

Hey @arcstur , I tried to reproduce it but it worked normally on my device, so maybe this is device specific? I tried recording with default camera upside down, adding it from gallery, the preview appears correctly.

If possible, could you attach a screen recording showing how to reproduce? Thanks!

KyleKun avatar Apr 14 '23 04:04 KyleKun

I'm not sure whether it is the same or related but sometimes OSD gets the wrong orientation. It is recording the video in landscape mode but once the recording is finished and I check it in the recorded videos, it is turned by 90 degrees as you can see in the screenshot:

Screenshot_20230524_224018

alexanderadam avatar May 24 '23 20:05 alexanderadam

I'm not sure whether it is the same or related but sometimes OSD gets the wrong orientation. It is recording the video in landscape mode but once the recording is finished and I check it in the recorded videos, it is turned by 90 degrees as you can see in the screenshot:

Screenshot_20230524_224018

I have reproduced this on my side too and it's starting to annoy me when I have to re-record because of this lol, I'll try to fix it this weekend.

@arcstur is this the same problem you described?

KyleKun avatar May 24 '23 21:05 KyleKun

I have reproduced this on my side too and it's starting to annoy me when I have to re-record because of this lol, I'll try to fix it this weekend.

Sounds promising — obrigado @KyleKun! :raised_hands:

alexanderadam avatar May 24 '23 21:05 alexanderadam

Mine's actually a little bit different. When recording upside down (horizontally) with my camera app, it auto corrects it to save it to gallery, and gallery shows it in the right orientation.

When adding the video to OSD, it shows it upside down in the add section: image

However, when saving, it shows it in the correct orientation: image

arcstur avatar Jun 01 '23 22:06 arcstur

I have reproduced this on my side too and it's starting to annoy me when I have to re-record because of this lol, I'll try to fix it this weekend.

Do you have any update here, @KyleKun? :pleading_face:

alexanderadam avatar Jun 02 '23 05:06 alexanderadam

I have reproduced this on my side too and it's starting to annoy me when I have to re-record because of this lol, I'll try to fix it this weekend.

Do you have any update here, @KyleKun? :pleading_face:

Not yet :(, will try this week.

KyleKun avatar Jun 07 '23 13:06 KyleKun

I have the same or similar issue. Any video I record in landscape gets added in portrait (and therefore in the wrong orientation). Makes the app unusable for me because I only record in landscape.

KristjanLaane avatar Jul 10 '23 12:07 KristjanLaane

I have the same or similar issue. Any video I record in landscape gets added in portrait (and therefore in the wrong orientation). Makes the app unusable for me because I only record in landscape.

Do you mean even adding a landscape video from gallery ends up being treated as portrait? Or even with the "Force native camera" option enabled in preferences?

KyleKun avatar Jul 10 '23 12:07 KyleKun

Do you mean even adding a landscape video from gallery ends up being treated as portrait? Or even with the "Force native camera" option enabled in preferences?

I tried recording a video in landscape with the native Android Camera app and adding it to 1SecondDiary through Gallery and everything works fine then - it is correctly positioned in landscape and the correct way up.

However, with a video that has been recorded in landscape with 1SecondDiary own camera implementation, when I add that through the Gallery then the bug is evident.

I also just now tried the Force native camera setting ticked and recording the landscape video from 1SecondDiary then to add it to today, and that also works fine, no bug.

The bug is also evident as per my original report when making a recording for today with 1SecondDiary camera.

KristjanLaane avatar Jul 10 '23 15:07 KristjanLaane

Just pushed a fix (#70) for the issue with in-app recording. The library to get device orientation regardless of Device Rotation being enabled has some issues when the device is "flat", meaning the sensor doesn't output the right orientation if there's no inclination angle. With the new lock orientation button this shouldn't happen anymore. FYI @alexanderadam / @KristjanLaane

Will investigate the original issue reported by @arcstur.

A new version of the app with these and other fixes probably comes out next week.

KyleKun avatar Aug 30 '23 01:08 KyleKun

Turns out it was fixed in the video_player plugin (https://github.com/flutter/flutter/issues/60327) Should be okay in next version, closing this but feel free to re-open if needed.

KyleKun avatar Aug 30 '23 01:08 KyleKun

Hi @KyleKun

I'm still getting the wrong orientation every now and then in the current version 1.5.2

😔

alexanderadam avatar Dec 14 '23 22:12 alexanderadam

Hi @KyleKun

I'm still getting the wrong orientation every now and then in the current version 1.5.2

😔

Will take a look at it

Edit: yeah, still broken in the video player package (https://github.com/flutter/flutter/issues/122276). Guess I'll try ffprobe to get recording orientation and rotate it myself.

KyleKun avatar Dec 14 '23 23:12 KyleKun

Can report this is still an issue (landscape video upside down) - however it does save right way up so the fix can wait for a bit ;)

Flo-711 avatar Mar 26 '24 22:03 Flo-711

For folks that need to correct the wrongly rotated clips:

  1. install ffmpeg if you don't have it already
  2. download the YuseiMagic-Regular.ttf font from the repo
ffmpeg -i 2023-11-14.mp4 -vf "transpose=1,crop=1080:607,drawtext=fontfile='/path/to/the/font/YuseiMagic-Regular.ttf':text='2023-11-14':x=w-tw-22:y=22:fontsize=22:fontcolor=white:borderw=1" output.mp4

or if you want to add the location:

ffmpeg -i 2023-11-14_orig.mp4 -vf "transpose=1,crop=1080:607,drawtext=fontfile='../YuseiMagic-Regular.ttf':text='2023-11-14':x=w-tw-22:y=22:fontsize=22:fontcolor=white:borderw=1,drawtext=fontfile='../YuseiMagic-Regular.ttf':text='Zug, Switzerland':x=w-tw-22:y=h-th-22:fontsize=22:fontcolor=white:borderw=1" output.mp4

You have to change the name of the input file, the path to the font and the text.

This is for correcting the 90 degrees rotation.

It's not perfect but surely much better than before. :wink:

alexanderadam avatar Aug 02 '24 19:08 alexanderadam