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

Mismatching Source Profile Shenanigans #5684

Open
Pixelz22 opened this issue Jan 3, 2025 · 8 comments
Open

Mismatching Source Profile Shenanigans #5684

Pixelz22 opened this issue Jan 3, 2025 · 8 comments
Assignees

Comments

@Pixelz22
Copy link

Pixelz22 commented Jan 3, 2025

Describe the bug:
I have two source files of different framerates, 30 and 60. After putting them both in the timeline, the preview handles it fine. However, when looking at the exported video, the 30 fps clip loops where the 60 fps clip should be playing.

Steps to reproduce the behavior:

  1. Create a blank new project
  2. Get two different videos files of separate framerates
  3. Place both consecutively into the timeline
  4. Use the live preview to ensure that works properly
  5. Export the video on the default settings
  6. See error

Expected behavior:
The exported video should match the preview.

System Details:

  • Operating System / Distro: Windows 10
  • OpenShot Version 3.3.0

I've done a little bit of research into why this might be happening, and I think it might be tied to previous issue #1438. I have a good amount of experience in C and a little less in C++, so I dug around the lipopenshot repo and found the frame# dependency that was mentioned. TLDR for that thread: Keyframe points are positioned via their frame#, so changing project framerates after placing the keyframes was ruining the timings.

I wonder if perhaps a similar problem is going on here. Maybe it's not directly tied to the keyframes, but if something else were linked to frame#, that could easily screw things up when mix and matching different framerates together. Clip starts seem to be seconds-based, so I'm not sure where that problem would lie.

However, the problem might not be the framerate at all. The clips also have different quality, one at 720p, the other at 1080p. When I tried reducing the framerate of the second clip with VLC, the problem didn't go away, so it's possible that the quality is the cause. Haven't gotten around to trying a manual fix for that part yet, just thought I'd mention it. Seems less likely that image quality would be causing this big of a hiccup, but who could say?

Honestly, the biggest thing confusing me here is that it works in the preview. If it works there, is there really a reason it can't be working in the export as well?

As a sidenote/potential fix, I'm actually kinda curious if changing the keyframes to be time-based rather than frame-based would be that hard. I know one of the guys in that thread I mentioned earlier was saying it would bring up more problems, but surely converting from time to frames would be as simple as converting to a fractional frame# and rounding? Consecutive clips would still work correctly because the end of one and the stat of the other would round to the same frame. And if you really wanted manual control over the frames, you could create a little button in the UI that calculated the exact number of milliseconds to move to the next frame and added it to the keyframe time. It's just an interesting thought, perhaps one worth exploring. Heck, I'd consider doing it myself, wouldn't mind working on this one fix (though I'm not nearly familiar enough with the codebase to be aware of the extending consequences any of my changes may have).

@Colorjet3
Copy link
Collaborator

Hello @Pixelz22 Please provide some additional information so I can try and replicate this in my environment as well.

  1. Please provide me more details of each of your imported files:
    a. What are the file types (.mp4, .mov, .mkv, etc)?
    b. Are both input files the same file type?
    c. What are the exact profile of each (i.e. 1920 x 1080 30fps, 1280 x 720 24 fps, etc.)?
  2. What is the default profile of your project set to (Edit | Preferences | Preview tab: Default Profile) when you import your files?
  3. Did you change the profile to something else? If yes, what did you change it to?
  4. When you are Exporting what is the "Video Profile:" set to?
  5. If it was set to the same profile while editing, was it the 30 fps or the 60 fps? Did you try to change to one or the other and Export again?
  6. Anything else you would like to share so I can test as close as possible to your situation.

Some of the information you have provided is more suited for the lead developer since I am not a dev person and just a regular user and a volunteer trying to help others.

@Pixelz22
Copy link
Author

Pixelz22 commented Jan 5, 2025

The files are both mp4s and 1920x1080. However, it turns out I had the original framerates wrong. The first clip, the first one that I imported to the project and was recorded through OBS, is running at 60 fps (I guess I had assumed it was 30 fps since it was working fine). The second clip, which I downloaded from the internet, is actually running at 59.94 fps. I only discovered this after looking at the file data with the inspector. This is what I getting for trusting internet descriptions. My bad. This explains why changing the second clip to 30 fps didn't fix the problem: it still wasn't matching the original clip.

My default profile on OpenShot is HD 720p 30fps (1280x720), and the Video Export profile is the same. I have not changed either profile over the course of any of my projects.

The second clip was a static tv background I was gonna use for a transition between two clips. I downloaded it from the description of this video.

Upon further testing from a blank project, it would appear that the second clip does eventually play if you leave it running for long enough, but the audio is desync'd and the beginning still loops the last couple frames of the previous clip.

@Colorjet3
Copy link
Collaborator

Thank you @Pixelz22 for this information.

Please provide me some details about how you have your project setup so I can try and replicate your issue. Please be as specific as possible with your edits in OpenShot.

One thing you can also try is to run both of your .mp4 files through a converter like VLC, HandBrake, or ShutterEncoder and convert them both to .mp4 files again, but with different names.
Now Import those two new files into a new project, perform your edits, and Export and see how it works.

@Pixelz22
Copy link
Author

Pixelz22 commented Jan 5, 2025

I tried recreating the issue myself from a blank project, and it still occurred. Here's what I did:

  1. Create a new project on the aforementioned default profile.
  2. Import any mp4 file that runs at 60 fps (I suggest a short one so the export takes less time), and import the mp4 downloaded from the above link.
  3. Put the first mp4 into the timeline, followed immediately by the TV static.
  4. (Optional) Trim down the TV static clip, again to save on export time.
  5. Export the video with the aforementioned profile.

@Colorjet3
Copy link
Collaborator

Colorjet3 commented Jan 5, 2025

  1. Did you try running both of your .mp4 files through a converter like I suggested? If yes, what was the result?

  2. Thank you for the steps. Couple of clarifications so I can be testing comparing apples to apples.
    a. You have both clips snapped together on the same track. If not, please tell me exactly how the clips are positioned on the timeline.
    b. The OBS recorded 60fps clip is first and then the 30 fps clip is second.
    c. What exactly is happening or not happening? In your original post you mention "....the 30 fps clip loops where the 60 fps clip should be playing." What exactly does this mean?

Here is what I tested so you can further confirm if I am testing like you are:

  1. I recorded a video (.mp4 at 60 FPS) using OBS. It is a 1 min 36 second video.
  2. I downloaded the TV static from the link you provided.
  3. I imported both files into OpenShot.
  4. I dragged the OBS file on Track 5 starting at position 0:00.
  5. I dragged the TV static .mp4 file onto Track 5 snapped with the OBS video.
  6. The default profile while previewing is the default HD 720p 30 fps).
  7. I then Exported at the same default HD 720p 30 fps.
  8. When I look at the Export it all looks good. What am I missing? What should I be looking for?

A screen shot of what you are seeing that is wrong will help as well.

@Pixelz22
Copy link
Author

Pixelz22 commented Jan 5, 2025

Sorry, I had meant to mention that I had already tried running it through VLC or other convertors. Funnily enough, VLC didn't change the framerate at all. I found an online one that did, however. Still no luck, error was still present.

So the export looks completely fine? Very strange. All this leads me to think it might not be the framerates that's screwing this up. Perhaps there's some other factor here that I'm missing. I can try to record a clip of the error when I get home tonight, though it will be late.

@Colorjet3
Copy link
Collaborator

No worries. I can look at whatever you provide tomorrow when time permits. Hopefully we can get to the bottom of it.

@Pixelz22
Copy link
Author

Pixelz22 commented Jan 7, 2025

static.frame.tearing.mp4

Here's a recording of the error, sorry I wasn't able to get it in this morning. Things ended up being a lot busier than I expected. This is an export of a video after following the exact steps listed above. As you can see, when switching between the two clips at around 0:09, the video sorta fights between which clip it's showing for a while, despite using the audio from the TV Static clip. I'll admit, this is slightly different behavior than the looping I was seeing on the original project, but clearly something is still going wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants