Skip to content

[Bug] iOS Simulator VideoWriter not working correctly #213

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

Closed
kreazyme opened this issue Aug 14, 2024 · 6 comments
Closed

[Bug] iOS Simulator VideoWriter not working correctly #213

kreazyme opened this issue Aug 14, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@kreazyme
Copy link

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:
I want to save a video to document directory by this code:


    final video1 = cv.VideoCapture.create(file1!.path);
    final double frameWidth = video1.get(3);
    final double frameHeight = video1.get(4);
    final double fps = video1.get(5);
    final path = await getApplicationDocumentsDirectory();
    final outputPath = '${path.path}${Platform.pathSeparator}videotest.mp4';
    final outputVideo = cv.VideoWriter.open(
      outputPath,
      'MJPG',
      fps,
      (
        frameWidth.toInt(),
        frameHeight.toInt(),
      ),
    );

I try to use imwrite inside video1.read(), the result is perfectly.
But when i try to using outputVideo.write(frame), the video size is zero

Expected behavior
Video save correctly

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Mac M1 14.4 Simulator

Smartphone (please complete the following information):

  • Device: [e.g. Android 11]
  • ABI Version [e.g. arm64-v8a]

Additional context
Add any other context about the problem here.

@kreazyme kreazyme added the bug Something isn't working label Aug 14, 2024
@kreazyme
Copy link
Author

I tried to import both .MOV and .MP4 file, but nothing difference :(

@kreazyme
Copy link
Author

kreazyme commented Aug 14, 2024

The same issues in Android 13 Samsung physic device.
I try to run VideoWriter many time but this code was not created this path.
It seem like VideoWriter's bug

Evidence:

image

@rainyl
Copy link
Owner

rainyl commented Aug 14, 2024

get it. I finally managed to reproduce it. take a look at https://github.com/rainyl/awesome-opencv_dart/tree/main/examples/videoio first please.

image

I am not very familiar with android development, but I think it's because the permissions.

In the above example, when the destination path dst was selected manually from external storage (by clicking Save to), opencv complained that it cant find the path, but if we save to source file's parent directory directly, it worked fine.

@rainyl
Copy link
Owner

rainyl commented Aug 14, 2024

The same issues in Android 13 Samsung physic device. I try to run VideoWriter many time but this code was not created this path. It seem like VideoWriter's bug

Does the directory cache exists?

@kreazyme
Copy link
Author

@rainyl In some minutes, I think the error like that. Then, I changed to download Directory, give permission,... but nothing happen.
After that, I try to use cv.imwrite() to save an image and this working fine. I think the permission and directory has no problem.
Thank for your reply :D and have nice day

@rainyl
Copy link
Owner

rainyl commented Aug 14, 2024

@kreazyme thx~

but i still have 2 questions:

  • did you solved it?
  • have you tried .avi format? since i just noticed that you are writing to .mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants