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

Loading 8-bit audio will result in silence #2397

Open
fladd opened this issue Mar 14, 2025 · 0 comments
Open

Loading 8-bit audio will result in silence #2397

fladd opened this issue Mar 14, 2025 · 0 comments
Labels
bug Issues that report (apparent) bugs.

Comments

@fladd
Copy link

fladd commented Mar 14, 2025

from moviepy.video.io import VideoFileClip

video = VideoFileClip("/path/to/video.mp4", audio_nbytes=1)

This will result in silent audio. The reason for this might be that moviepy tries to ask the format "s8le" from ffmpeg (

self.format = "s%dle" % (8 * nbytes)
), which ffmpeg does not seem to support (see ffmpeg -formats; there is "s8" though).

Expected Behavior

The audio clip contains audio.

Actual Behavior

The audio clip contains only silence.

Steps and code to Reproduce the Problem

from moviepy.video.io import VideoFileClip

video = VideoFileClip("/path/to/video.mp4", audio_nbytes=1)

Used medias

https://download.blender.org/demo/movies/BBB/bbb_sunflower_1080p_30fps_normal.mp4.zip

Specifications

  • Python Version: 3.13.0
  • MoviePy Version: 2.1.1
  • Platform Name: MacOS
  • Platform Version: 11.7.10
@fladd fladd added the bug Issues that report (apparent) bugs. label Mar 14, 2025
fladd added a commit to fladd/python-mediadecoder that referenced this issue Mar 14, 2025
- cleaned up accessibility of Decoder attributes
- added option to ask for custom audio_fps and audio_nbytes when loading media from file
- added option to set Moviepy VideoFileClip directly (for custom external clip processing before playing with mediadecoder)
- added parameter `pygame_buffersize` to PygameSoundrenderer init (for using a Pygame mixer buffersize smaller than the size of one video frame, which will improve video/audio synchronization)
- added conversion of audio to unsigned int if Pygame mixer uses this format
- added conversion of 32 bit in to 32 bit float if Pygame mixer uses this format
- fix/hack for 8-bit audio bug in MoviePy (see Zulko/moviepy#2397)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

No branches or pull requests

1 participant