Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openshot 2.4.4 incorrectly exports vertical video #2969

Closed
sknaumov opened this issue Sep 2, 2019 · 14 comments
Closed

Openshot 2.4.4 incorrectly exports vertical video #2969

sknaumov opened this issue Sep 2, 2019 · 14 comments
Labels
🐞 bug A bug, error, or breakage of any kind stale This issue has not had any activity in 60 days :(

Comments

@sknaumov
Copy link

sknaumov commented Sep 2, 2019

Describe the bug:
Vertical video looks very small, with big black frames around all edges. Original video has black frames only from left and right of the video and looks about 2 times bigger.

Steps to reproduce the behavior:

  1. Create custom profile with the following content:
description=Vertical 1080p 30fps
frame_rate_num=30000
frame_rate_den=1001
width=1080
height=1920
progressive=1
sample_aspect_num=1
sample_aspect_den=1
display_aspect_num=9
display_aspect_den=16
  1. Change OpenShot profile to the custom one, restart OpenShot.
  2. Import original video into new project.
  3. Export video with default settings.

Expected behavior:
Get the same video as original one.

System Details:

  • OpenShot Version 2.4.4
  • Windows 10

Screenshots:

Original:
vlcsnap-2019-09-03-01h03m47s966

Exported from OpenShot with default HD 1080p 1920x1080 profile.
vlcsnap-2019-09-03-01h12m46s894

Exported from OpenShot with custom vertical profile:
vlcsnap-2019-09-03-01h02m56s763

@sknaumov sknaumov added the 🐞 bug A bug, error, or breakage of any kind label Sep 2, 2019
@SuslikV
Copy link
Contributor

SuslikV commented Sep 3, 2019

Try to save your project file (.osp) and then load it again (use new empty folder for the project's file).

@sknaumov
Copy link
Author

sknaumov commented Sep 3, 2019

@SuslikV Just tried it. Unfortunately, it doesn't work, even if empty directory is used to save the project file.

@sknaumov
Copy link
Author

sknaumov commented Sep 3, 2019

It looks like I found the root cause: video file that came from my Huawei P30 has 1920x1080 dimensions even though it is oriented vertically. Somehow VLC and other media players still open it properly, but OpenShot can't detect this irregularity. I reencoded the file using ffmpeg.exe -i Orig.mp4 -vf scale=1080:1920 Out.mp4 and now I see proper video preview and proper exported video.

Could OpenShot automatically detect and apply a workaround for such cases?

@SuslikV
Copy link
Contributor

SuslikV commented Sep 4, 2019

Short file sample is needed to test it out (about 2 seconds is well enough).

@sknaumov
Copy link
Author

sknaumov commented Sep 4, 2019

Sample video attached.

VID_20190904_105737.mp4.gz

@SuslikV
Copy link
Contributor

SuslikV commented Sep 5, 2019

Without linked changes I can't find suitable workaround. (you can apply changes manually, just locate required file in your application's folder).

More over even if you apply the changes to classes/project_data.py you still need to perform next additional steps:

  1. Make sure that clip is added to the Timeline
  2. Set Scale property of the selected clip to None
  3. Resize (scale up or down) the Video Preview window by mouse - actual area of the movie should resize, not only window background. You may make the window float to drag it by the corner
  4. The image should update to cover the whole window.

There were number of optimizations in the rendering code, so it wasn't well tested and this caused the problem.

@ferdnyc
Copy link
Contributor

ferdnyc commented Sep 8, 2019

It looks like I found the root cause: video file that came from my Huawei P30 has 1920x1080 dimensions even though it is oriented vertically. Somehow VLC and other media players still open it properly, but OpenShot can't detect this irregularity. I reencoded the file using ffmpeg.exe -i Orig.mp4 -vf scale=1080:1920 Out.mp4 and now I see proper video preview and proper exported video.

Could OpenShot automatically detect and apply a workaround for such cases?

In a sense it does, in that if you import a vertical video in typical phone/tablet format (which is a horizontal video with metadata that defines an initial rotation), OpenShot will detect that and import the video already-rotated. (So, the video will load with Rotation = 90.0, for example.)

The problem is that a horizontal video rotated 90° isn't really the same thing as a video with swapped dimensions. OpenShot's rotation in general is currently quite naive, and doesn't account for how rotation (any rotation) alters the dimensions of the video image.

Even though the video is rotated, it still has width = 1920 and height = 1080 instead of vice versa, and OpenShot makes decisions for things like scaling based on the unrotated dimensions. That's why if you load a vertical video into a horizontal profile, the top and bottom are cropped off. But if you load it into a vertical profile, it only occupies around half of the frame.

If your output profile is the same size as your input video, as @SuslikV indicated setting Scale = None can prove a reasonable workaround. (And with PR #2975 merged to fix that render-setup bug, it'll even preview properly. Though even in OpenShot 2.4.4, the preview is only wrong initially. If you move the playhead around — or even better, move the clip around to force OpenShot to regenerate all of the cached preview frames — it sorts itself out.)

Still, it would be far better if libopenshot was smarter about rotation and how it affects the source video, which is the focus of OpenShot/libopenshot#322.

@SuslikV
Copy link
Contributor

SuslikV commented Sep 8, 2019

@ferdnyc I'm going to fix some Preview File bugs (so that it start acting same to the regular Video Preview) first. That will show number of optimization assumptions that was just dead code and do nothing good. I think these changes will be important, because the Painter transform related on geometry of the source and its currently visible size. Issues are not only in rotation but in whole transform. I need a bit more time for it to complete. Then, it would be nice to see new actual transform formulas and calculations.

@sknaumov
Copy link
Author

sknaumov commented Sep 8, 2019

@SuslikV BTW, maybe it deserves standalone issue, but I also had problems with inaccuracy of exported video dimensions when tried to merge it with 1080x1920 picture. You can see it at the very end of my resulting video when transformation from video to picture is in progress. IIRC I had to use 1082x1920 picture to minimize the effect and make it appear on up/down edges. With 1080x1920 picture the issue was on the left edge: https://www.youtube.com/watch?v=R6NvCqXmVJg It is hard to see on PC (you need to use full screen mode and you will see a stripe of video at the very top), but on my smartphone is it easily visible.

@ferdnyc
Copy link
Contributor

ferdnyc commented Sep 8, 2019

@sknaumov You're talking about the very end section, where it fades from video to the title card?

image

I'll be honest, I've gone over that fade several times, using different YouTube views, even at half speed, and I'm not really seeing the issue. So I guess it minimized pretty well! (Or I'm blind.)

If your image is exactly the size of your output frame, though, it's probably worth trying Scale = None on the image, as well. Especially when combined with a video that uses larger dimensions. (Because remember, OpenShot still thinks the video is 1920 × 1080.) OpenShot's auto-scaling may be messing itself up in that kind of situation.

But, using a slightly-larger-than-frame image as a workaround makes a lot of sense (and would be the next option anyway, if Scale = None failed), good call on that.

@SuslikV
Copy link
Contributor

SuslikV commented Sep 8, 2019

@ferdnyc I think, he says about two bright horizontal lines (1-2 pixels height) at top and at the bottom of the image, when transition is almost complete (you can notice that this bright lines is just background video that is still running behind the black image with the text that simply covers the video). YouTube player shades the top and bottom of the footage when playback controls are active, thus it is harder to notice them when you looking for it :)

Edit: Stretch may work better.

@ferdnyc
Copy link
Contributor

ferdnyc commented Sep 8, 2019

Ah, OK. I do see that. (Viewing the video in non-theater mode (which is actually better for vertical video, size-wise) didn't help either, since it uses a white background.) Maybe 2px on the top, and not even a full 1px on the bottom — it's more like half a line of pixels, at the bottom left edge.

The interesting thing about that is, I'd expect a 1082 x 1920 image to cause the problem, more than minimize it, since with Scale = Best Fit OpenShot would typically scale the image to be slightly shorter than 1920px tall. I'm curious what the 1080x1920 image looked like. (Or maybe it showed lines on the sides, instead?)

Yeah, I'm definitely leaning back towards Scale = None as a first choice. Scale = Stretch might also work, but if it distorted the image at all, text tends to look really bad when it deforms due to non-uniform scaling.

There's also another, simple workaround for the issue (not that it wouldn't be better to solve it, of course): If the title card were placed on the track below the video, and then the video faded out instead of the title card fading in, that would eliminate any bleed-through from under the image.

@sknaumov
Copy link
Author

sknaumov commented Sep 8, 2019

Yes, exactly, with 1080x1920 picture I had vertical bright line from the video on the side.

I created the picture using GIMP.

@stale
Copy link

stale bot commented Oct 26, 2020

Thank you so much for submitting an issue to help improve OpenShot Video Editor. We are sorry about this, but this particular issue has gone unnoticed for quite some time. To help keep the OpenShot GitHub Issue Tracker organized and focused, we must ensure that every issue is correctly labelled and triaged, to get the proper attention.
This issue will be closed, as it meets the following criteria: - No activity in the past 180 days - No one is assigned to this issue
We'd like to ask you to help us out and determine whether this issue should be reopened. - If this issue is reporting a bug, please can you attempt to reproduce on the latest daily build to help us to understand whether the bug still needs our attention. - If this issue is proposing a new feature, please can you verify whether the feature proposal is still relevant.
Thanks again for your help!

@stale stale bot added the stale This issue has not had any activity in 60 days :( label Oct 26, 2020
@stale stale bot closed this as completed Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug A bug, error, or breakage of any kind stale This issue has not had any activity in 60 days :(
Projects
None yet
Development

No branches or pull requests

3 participants