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

[Bug]: WriteGear().write causes python process to terminate #413

Closed
3 tasks done
w4hns1nn opened this issue Jul 4, 2024 · 3 comments
Closed
3 tasks done

[Bug]: WriteGear().write causes python process to terminate #413

w4hns1nn opened this issue Jul 4, 2024 · 3 comments
Assignees
Labels
BUG 🐛 Vidgear api's error, flaw or fault BUG UNCONFIRMED 🙅 Bug is still uncomfirmed! INVALID 🛑 This doesn't seem right or non-applicable or missing information

Comments

@w4hns1nn
Copy link

w4hns1nn commented Jul 4, 2024

Description

The write method causes my entire python to crash:
Process finished with exit code -1073741819 (0xC0000005)

I use generator function to iteratively write images to a file with WriteGear.
The exception is never reached. The process just terminates.

Details in description below.

Would be awesome if somebody could look into it.
Thank you.

Issue Checklist

  • I have searched open or closed issues for my problem and found nothing related or helpful.
  • I have read the Documentation and found nothing related to my problem.
  • I've read the Issue Guidelines and wholeheartedly agree.

Expected behaviour

Writer writes to the file.

Actual behaviour

The write method causes my entire python to crash:
Process finished with exit code -1073741819 (0xC0000005)

Steps to reproduce

The write method causes my entire python to crash:
Process finished with exit code -1073741819 (0xC0000005)

I use generator function to iteratively write images to a file like:

output_params = {"-input_framerate": frame_rate}  # ffmpeg params
writer = WriteGear(output=save_path, compression_mode=True, **output_params)
for img in image_generator:
       try:
            if not isinstance(img, np.ndarray):
                raise ValueError("The image generator should yield images as numpy arrays or filepaths.")
            writer.write(img)
        except Exception as e:
            print(f"Error writting: {e}. Skipping frame")

However the writer.write(img) function causes the problem at line 430:

try:
   # try writing the frame bytes to the subprocess pipeline
     self.__process.stdin.write(frame.tobytes())
except (OSError, IOError):
     # log if something is wrong!
        logger.error(
          "BrokenPipeError caught, Wrong values passed to FFmpeg Pipe. Kindly Refer Docs!"
         )
        raise ValueError  # for testing purpose only

The exception is never reached. The process just terminates.

I found a related problem on Stack Overflow, but was not able to resolve the problem by myself.
If i use cv2.imwrite("problem_frame.png", frame) the image turns out normal.

Would be awesome if somebody could look into it.
Thank you.

Terminal log output

No response

Python Code(Optional)

No response

VidGear Version

0.3.3

Python version

3.8

OpenCV version

4.8

Operating System version

Windows

Any other Relevant Information?

No response

@w4hns1nn w4hns1nn added the BUG 🐛 Vidgear api's error, flaw or fault label Jul 4, 2024
Copy link

welcome bot commented Jul 4, 2024

Thanks for opening this issue, a maintainer will get back to you shortly!

In the meantime:

  • Read our Issue Guidelines, and update your issue accordingly. Please note that your issue will be fixed much faster if you spend about half an hour preparing it, including the exact reproduction steps and a demo.
  • Go comprehensively through our dedicated FAQ & Troubleshooting section.
  • For any quick questions and typos, please refrain from opening an issue, as you can reach us on Gitter community channel.

@abhiTronix
Copy link
Owner

Hey @w4hns1nn, Could you please enable verbose logging by running WriteGear with logging=True? Once you've done that, share the full terminal output here, up to the point where you encounter the bug. Thanks!

@abhiTronix abhiTronix added MISSING : INFORMATION 🔍 Requested proper information/evidence about the Issue/PR in context. WAITING FOR RESPONSE ⏳ Waiting for the user response. BUG UNCONFIRMED 🙅 Bug is still uncomfirmed! labels Jul 5, 2024
@w4hns1nn
Copy link
Author

w4hns1nn commented Jul 6, 2024

Hey abhiTronix! First of all thank you very much for responding; this is honorable!
Well this morning I uninstalled ffmpg and reinstalled it; rebootet my computer and after the error disappeared.
Misterious, however I hope I can help somebody else to resolve the issue with the answer.

I'm sorry that we can't look deeper into the issue, because obviously there's deeply nested a bug :D

I closed the report.
Thanks anyway

@w4hns1nn w4hns1nn closed this as completed Jul 6, 2024
@abhiTronix abhiTronix added INVALID 🛑 This doesn't seem right or non-applicable or missing information and removed MISSING : INFORMATION 🔍 Requested proper information/evidence about the Issue/PR in context. WAITING FOR RESPONSE ⏳ Waiting for the user response. labels Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG 🐛 Vidgear api's error, flaw or fault BUG UNCONFIRMED 🙅 Bug is still uncomfirmed! INVALID 🛑 This doesn't seem right or non-applicable or missing information
Projects
None yet
Development

No branches or pull requests

2 participants