pydub icon indicating copy to clipboard operation
pydub copied to clipboard

Fix a bug in `parameters` variable

Open farisalasmary opened this issue 2 years ago • 1 comments

I was trying to read a very large MP4 file and convert to WAV so I provided some parameters to from_file function in the argument parameters. My parameters were:

parameters = ['-ac', '1', '-ar', '16000']

which means that the resultant audio file should have 16K sample rate and the number of channels should be 1 (mono) but that did not work! After investigation, I found that the parameters are added it the end of the command and the command will be something like:

ffmpeg -y -i my_video.mp4 -acodec pcm_s16le -vn -f wav - -ac 1 -ar 16000

I changed it to add parameters in the middle where the command should look like this:

ffmpeg -y -i my_video.mp4 -ac 1 -ar 16000 -acodec pcm_s16le -vn -f wav -

and it worked!!

farisalasmary avatar Dec 11 '22 06:12 farisalasmary

Hi @jiaaro,

Can you kindly merge this pull request as it is heavily used in my current projects?

farisalasmary avatar Feb 02 '23 09:02 farisalasmary