[英]How to convert the sample rate with ffmpeg-python
I'm using ffmpeg-python .我正在使用ffmpeg-python 。 I would like to change the sample rate of the audio file.
我想更改音频文件的采样率。
In ffmpeg-, it seems that you can change the sample rate as follows.在 ffmpeg- 中,您似乎可以按如下方式更改采样率。
ffmpeg -i" movie.mp3 "-y" movie.flac "-ar 44100
-ar
is sample rate. -ar
是采样率。
How do I change the sample rate by ffmpeg-python?如何通过 ffmpeg-python 更改采样率?
This is my source code that is currently being written.这是我目前正在编写的源代码。
stream = ffmpeg.input(input_file_path)
audio = stream.audio
stream = ffmpeg.output(audio, output_file_path)
ffmpeg.run(stream, capture_stdout=True, capture_stderr=True)
I soleved.我解决了。
I can set **kwargs like this.我可以像这样设置 **kwargs。
stream = ffmpeg.output(audio, output_file_path, **{'ar': '16000','acodec':'flac'})
**
is important. **
很重要。 If you remove it, you got an error.如果删除它,则会出现错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.