如何使用下面的程序重命名要下载的.wav文件?

2024-09-30 01:35:40 发布

您现在位置:Python中文网/ 问答频道 /正文

from __future__ import unicode_literals
import youtube_dl

ydl_opts = {
    'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'wav',
        'preferredquality': '192'
    }],
    'postprocessor_args': [
        '-ar', '16000'
    ],
    'prefer_ffmpeg': True,
    'keepvideo': True
}

with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['https://www.youtube.com/watch?v=JpjEwIceVIo'])

输出:

[youtube] JpjEwIceVIo: Downloading webpage
[download] Speech on Importance of Education in English for Higher Secondary students by Smile Please World-JpjEwIceVIo.webm has already been downloaded
[download] 100% of 1.69MiB
[ffmpeg] Destination: Speech on Importance of Education in English for Higher Secondary students by Smile Please World-JpjEwIceVIo.wav

我想将文件名改为audio1.wav,而不是关于微笑世界对高中生英语教育重要性的演讲-JpjEwIceVIo.wav。请帮我解决这个问题


Tags: ofimporttrueyoutubeondownloadspeechffmpeg

热门问题