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
Loading audio tensors fails: ValueError: all input arrays must have the same shape #1875
Comments
ValueError: all input arrays must have the same shape
If this is something I could contribute please let me know. |
If u have an idea of how this could be contributed, it would definitely be great |
@JoanFM Created a pull request for this (#1880). The fix applies to audio from video only, since sometimes tools like FFMPEG downsample blank frames when they create subclips, which is what I was doing when I ran into this error. Please let me know if I should resolve the failed check for signed commits in the PR. |
Hey @chrisammon3000 , Nice to see the contribution. I already added some comments there |
Initial Checks
Description
I have created subclips of a video in .mp4 using ffmpeg (through moviepy):
Output:
The subclip path is passed to
VideoUrl
:Trying to load the tensors fails:
Stepping through the code shows that the first audio frame has a sample rate of 16:
The second and all subsequent frames have 1024 samples:
So this results in arrays with different shapes for the audio.
What Ive tried:
If there is a way to handle the shape mismatch inside DocArray that would be great because it would let me create the subclips and model them as quickly as possible. It would need to be added to this block:
docarray/docarray/typing/bytes/video_bytes.py
Lines 83 to 86 in f71a5e6
Example Code
Python, DocArray & OS Version
Affected Components
The text was updated successfully, but these errors were encountered: