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

problem when running decode sample #106

Open
incomingflyingbrick opened this issue Sep 18, 2024 · 8 comments
Open

problem when running decode sample #106

incomingflyingbrick opened this issue Sep 18, 2024 · 8 comments

Comments

@incomingflyingbrick
Copy link

I am trying to decode a video using a sample, but I got the error saying source and output dimention mismatch at this line
# Copy pixels to numpy ndarray success, details = pyDwn.Run(surf_dst, frame)
decode sample
Is this a software bug of the library ?

@RomanArzumanyan
Copy link
Owner

Hi @incomingflyingbrick

What input do you use ? Is it same as in sample or did you change it ?
This may happen if video change it's resolution in the middle. Then PySurfaceDownloader will scold incoming numpy ndarray because it no longer matches the updated Surface resolution.

@incomingflyingbrick
Copy link
Author

@RomanArzumanyan Hi, I tried different videos with mp4 format, including the video in the test folder named test.mp4, but none of them worked, still showing the following error.
TaskExecInfo.SRC_DST_SIZE_MISMATCH Traceback (most recent call last): File "/storage/ongoing/new/test_decord/test_vali.py", line 78, in <module> raise StopExecution StopExecution

@RomanArzumanyan
Copy link
Owner

RomanArzumanyan commented Sep 18, 2024

@incomingflyingbrick

That's very strange.
Can you modify the sample to output both surf_dst and frame shape ?
It can be done like this:

print(frame.shape)
print(surf_dst.__cuda_array_interface__)

# Copy pixels to numpy ndarray
success, details = pyDwn.Run(surf_dst, frame)
if not success:
    print(details)
    raise StopExecution

When working properly, the output shall be like this (for test.mp4 video of resolution 848x464):

(1180416,)
{'shape': (464, 848, 3}, ...

848x464 RGB Surface requires 848x464x3 == 1180416 bytes.

@incomingflyingbrick
Copy link
Author

@RomanArzumanyan
Hi, I changed the code and got the following output
(2764800,) {'shape': (1280, 720, 3), 'typestr': '<u1', 'data': (139942994903040, False), 'version': 3, 'strides': (2560, 3, 1), 'stream': 36464064} TaskExecInfo.SRC_DST_SIZE_MISMATCH Traceback (most recent call last): File "/storage/ongoing/new/test_decord/test_vali.py", line 79, in <module> raise StopExecution StopExecution

It seems the shape is correct, but still unable to obtain a successful result.

RomanArzumanyan added a commit that referenced this issue Sep 19, 2024
@RomanArzumanyan
Copy link
Owner

Hi @incomingflyingbrick

It looks like something is happening in the C++ land although I'm not sure what.
Can you build VALI from branch issue_106 and run the same decoding sample ? It adds more verbose debug output like this:

/home/roman/git/VALI/src/python_vali/src/PySurfaceDownloader.cpp::Run
array size:   1180416
buffer size:  1180416
surface size: 1180416
/home/roman/git/VALI/src/TC/src/TaskCudaDownloadSurface.cpp::Run
buffer size:  1180416
surface size: 1180416

Building from source is not difficult, you just check out the feature branch and run pip isntall . in console.

@incomingflyingbrick
Copy link
Author

@RomanArzumanyan I got the following output using the issue_106 branch build from the source.
array size: 0 buffer size: 0 surface size: 230400 /storage/ongoing/new/test_decord/VALI/src/TC/src/TaskCudaDownloadSurface.cpp::Run buffer size: 0 surface size: 230400 TaskExecInfo.SRC_DST_SIZE_MISMATCH Traceback (most recent call last): File "/storage/ongoing/new/test_decord/test_vali.py", line 79, in <module> raise StopExecution StopExecution

@RomanArzumanyan
Copy link
Owner

RomanArzumanyan commented Sep 20, 2024

Thanks for the update @incomingflyingbrick

It means that ndarray was created on the python side with size of 230400 but those changes aren't seen on C++ side for some reason.

Need to google on this. Looks like some sort of lazy init of ndarray. Didn't face that before.
I'll come back as I find something.

P. S.
Meanwhile may I ask you to check the lazy init suggestion by initializing ndarray with zeroes ?

# Numpy array which contains decoded RGB Surface
frame = np.ndarray(
    dtype=np.uint8,
    shape=surf_dst.HostSize)
frame[:]=0

@incomingflyingbrick
Copy link
Author

@RomanArzumanyan
Hi I got the same error again after I changed to lazy init.

/storage/ongoing/new/test_decord/VALI/src/python_vali/src/PySurfaceDownloader.cpp::Run
array size: 0
buffer size: 0
surface size: 230400
/storage/ongoing/new/test_decord/VALI/src/TC/src/TaskCudaDownloadSurface.cpp::Run
buffer size: 0
surface size: 230400
TaskExecInfo.SRC_DST_SIZE_MISMATCH
Traceback (most recent call last):
File "/storage/ongoing/new/test_decord/test_vali.py", line 80, in
raise StopExecution
StopExecution

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

2 participants