matham / ffpyplayer

A cython implementation of an ffmpeg based player.
GNU Lesser General Public License v3.0
134 stars 38 forks source link

'volume' argument in ff_opts not working #145

Open mak8kammerer opened 1 year ago

mak8kammerer commented 1 year ago

Hello everyone! I am trying write a simple audio player using MediaPlayer class. Here is my code:

from ffpyplayer.player import MediaPlayer
player = MediaPlayer('audio.mp3', ff_opts={'volume': 0})
while True:
    pass

The sound is playing, but the volume is not 0! This command work perfectly: ffplay -af "volume=0.0" audio.mp3 Some additional info:

mak8kammerer commented 1 year ago

The problem was solved by manual compilation on the computer. I downloaded the source code of the ffpyplayer, then downloaded the SDL2 and ffmpeg (from here; the archive name looked like this: ffmpeg-n6.0-latest-win64-gpl-shared-6.0.zip) binaries. Then I unpacked the archive and added the paths to them in the environment variables at the top of setup.py (FFMPEG_ROOT and SDL_ROOT).

In the SDL2 folder there is a lib folder with two folders x64 and x86. You need to transfer the contents of the folder with the architecture of your processor (for example: x64) to the lib folder.

Compilation is done with the command: python setup.py build_ext