Skip to content

Conversation

@Rahul-1100
Copy link

Removes unnecessary 'shortest=1' option. The filter works correctly without it, which resolves the 'options were provided' error.

Copy link
Author

@Rahul-1100 Rahul-1100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deadlock occurs due to one less frame present, hence if total_frame = total_frame -1, will solve the issue

@nadermx
Copy link
Owner

nadermx commented Oct 29, 2025

Thank you for this submission! I've reviewed your PR and found the following:

✅ Already Fixed: alphamerge=shortest Issue

The alphamerge=shortest=1 issue appears to have been fixed in an earlier commit (likely ec83dfb: Fix EXIF orientation and ffmpeg alphamerge compatibility). I've verified that the current codebase no longer has alphamerge=shortest anywhere - all alphamerge filters are now correctly written without the shortest parameter.

❓ Needs Verification: Framerate Decrement

Your second fix adds framerate = framerate - 1 to address a deadlock caused by moviepy outputting one fewer frame than expected. This part is NOT currently in the codebase.

Questions:

  1. Are you still experiencing this deadlock issue on the latest main branch?
  2. Can you provide reproduction steps or a test case that demonstrates the issue?
  3. Have you tested this fix to confirm it resolves the issue without introducing other problems?

The framerate decrement seems like a workaround rather than addressing the root cause. If this is still an issue, I'd like to understand:

  • Why is moviepy outputting one less frame?
  • Could this be a frame counting logic issue elsewhere?
  • Does this affect all videos or only specific cases?

Please test against the current main branch and let me know if the issue persists. If it does, providing a minimal reproduction case would help us evaluate the best fix. Thanks!

Copy link
Owner

@nadermx nadermx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! A few observations:

  1. The alphamerge=shortest=1 removal is already in main - Looking at the current codebase, this fix was already applied. The current code uses alphamerge without the shortest=1 option.

  2. Concern about framerate = framerate - 1 - This change seems like a workaround that could cause issues:

    • It would change the actual framerate of output videos
    • A video detected at 30fps would be processed at 29fps
    • This could cause A/V sync issues or stuttering

Can you explain what issue the framerate decrement is solving? Is there a specific error message or behavior you're trying to fix?

The -shortest flag on the ffmpeg command should handle any mismatch between the main video and matte durations.

FFMEG frame can cause frame mismatch with that of moviepy due to different frames calculation hence sticking with moviepy frames as later moviepy is used to yield frames
@Rahul-1100
Copy link
Author

Rahul-1100 commented Dec 10, 2025

Extremly sorry for replying late I have attached below the video clip which causes deadlock

video.mp4

as well as an ss why it happens
Basically fffmpeg calculates total frames differently than moviepy which in most cases results in lesser frames(tried with multiple videos, however i wasnt able to retrieve them) hence thats why -1 frame.
I realised that - 1 is really a very stupid and quick fix hence i added the fix where it now doesnt use ffmpeg but instead uses moviepy n_frame as this should fix any frames mismatchaes as later on moviepy is used to yiled frames
Uploading WhatsApp Image 2025-10-31 at 3.42.09 PM.jpeg…

@Rahul-1100
Copy link
Author

also regarding, alpamerge=shortest=1, yes it was working using latest branch

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

Successfully merging this pull request may close these issues.

3 participants