-
Notifications
You must be signed in to change notification settings - Fork 4
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
Comments
What input do you use ? Is it same as in sample or did you change it ? |
@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. |
That's very strange. 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):
848x464 RGB |
@RomanArzumanyan
It seems the shape is correct, but still unable to obtain a successful result. |
It looks like something is happening in the C++ land although I'm not sure what.
Building from source is not difficult, you just check out the feature branch and run |
@RomanArzumanyan I got the following output using the issue_106 branch build from the source.
|
Thanks for the update @incomingflyingbrick It means that Need to google on this. Looks like some sort of lazy init of P. S. # Numpy array which contains decoded RGB Surface
frame = np.ndarray(
dtype=np.uint8,
shape=surf_dst.HostSize)
frame[:]=0 |
@RomanArzumanyan
|
I am trying to decode a rtsp using a sample, but I got the error saying source and output dimention mismatch at this line VALI/samples/sample_decode_show.ipynb Lines 118 to 122 in 3889a79
Is this a software bug of the library ? import numpy as np
from PIL import Image
import python_vali as vali
url = "rtsp://xxx:xxx@xx/cam/realmonitor?channel=1&subtype=0"
class StopExecution(Exception):
def _render_traceback_(self):
return []
if __name__ == '__main__':
# GPU-accelerated decoder
pyDec = vali.PyDecoder(
url,
{'rtsp_transport': 'tcp'},
gpu_id=0)
print("# GPU-accelerated decoder")
# GPU-accelerated converter
pyCvt = vali.PySurfaceConverter(
pyDec.Format,
vali.PixelFormat.RGB,
gpu_id=0)
# GPU-accelerated Surface downloader
pyDwn = vali.PySurfaceDownloader(gpu_id=0)
# Raw decoded Surface
print(pyDec.Format, pyDec.Width, pyDec.Height) # PixelFormat.NV12 3840 2160
# Raw decoded Surface
surf_src = vali.Surface.Make(
format=pyDec.Format,
width=pyDec.Width,
height=pyDec.Height,
gpu_id=0)
# Raw Surface, converted to RGB
surf_dst = vali.Surface.Make(
format=vali.PixelFormat.RGB,
width=pyDec.Width,
height=pyDec.Height,
gpu_id=0)
# Numpy array which contains decoded RGB Surface
# frame = np.ndarray(
# dtype=np.uint8,
# shape=surf_dst.HostSize)
frame = np.ndarray(
dtype=np.uint8,
shape=surf_dst.HostSize)
print('surf_dst.HostSize', surf_dst.HostSize)
# Packet data
pkt_data = vali.PacketData()
print("frame", frame.shape) # frame (24883200,)
print("surf_src", surf_src.__cuda_array_interface__) # surf_src {'shape': (3240, 3840, 0), 'typestr': '<u1', 'data': (139628011061248, False), 'version': 3, 'strides': (4096, 1, 0), 'stream': 94450176927296}
print("surf_dst", surf_dst.__cuda_array_interface__) # surf_dst {'shape': (2160, 3840, 3), 'typestr': '<u1', 'data': (139627977506816, False), 'version': 3, 'strides': (11776, 3, 1), 'stream': 94450176927296}
# Packet data
pkt_data = vali.PacketData()
for i in range(1):
# Decode single Surface
success, details = pyDec.DecodeSingleSurface(surf_src, pkt_data)
if not success:
print(details)
raise StopExecution
print('pkt_data', pkt_data.dts, pkt_data.pts)
# Convert to RGB
success, details = pyCvt.Run(surf_src, surf_dst)
print('# Convert to RGB', details)
if not success:
print(details)
raise StopExecution
# Copy pixels to numpy ndarray
success, details = pyDwn.Run(surf_dst, frame)
if not success:
print(details)
raise StopExecution
# Reshape to proper dimensions
res_frame = np.reshape(
frame,
(pyDec.Height, pyDec.Width, 3))
# Save the image
image = Image.fromarray(res_frame)
image.save('./test.jpg')
# Output packet data
print(pkt_data) |
Could you please check this small patch: # Numpy array which contains decoded RGB Surface
frame = np.ndarray(
dtype=np.uint8,
shape=(surf_dst.HostSize)) Looks like I'm passing a single value to constructor instead of tuple. Lines 116 to 119 in 3889a79
|
Tagging for better visibility. |
success, details = pyDwn.Run(surf_dst, frame), # Convert to RGB TaskExecInfo.SUCCESS |
Sorry, I don't understand your reply. Could you please explain ? # Numpy array which contains decoded RGB Surface
frame = np.ndarray(
dtype=np.uint8,
shape=(surf_dst.HostSize)) |
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 ?
The text was updated successfully, but these errors were encountered: