Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14215

ValueError: Unexpected numpy array shape `(2, 47)`

$
0
0

imports

import jsonimport avimport numpy as npimport structcontainer = av.open('./webcam/friday.mp3',format='mp3')for stream in container.streams:if stream.type == 'audio':format = stream.format.namebreakfor frame in container.decode(audio=0):sia = frame.to_ndarray(format='s16', layout='stereo')siai = (sia \*32767).astype(np.int16)si = siai.tobytes()soa = np.frombuffer(si, dtype=siai.dtype)soar = soa.reshape(2,-1)  so = av.AudioFrame.from_ndarray(soar)

#Above is my Code and Below is my error

Traceback (most recent call last):  File "/media/eizen/HDD2/srinivas/cv/github/aiortc/examples/webcam/producer.py", line 67, in <module>    so = av.AudioFrame.from_ndarray(soara)  File "av/audio/frame.pyx", line 125, in av.audio.frame.AudioFrame.from_ndarray  File "av/utils.pyx", line 80, in av.utils.check_ndarray_shapeValueError: Unexpected numpy array shape `(2, 47)`

Even after providing array in required format as input to av.AudioFrame, I receiving unexpected numpy array, Can you please help me in how to address this issue?


Viewing all articles
Browse latest Browse all 14215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>