文件夹:C:\迅雷下载\有声绘本_flash[淘宝-珍奥下载]\有声绘本 flash,里面有多个flash文件,怎么转换成mp3文件呢?
可以使用swfextract工具从Flash动画中提取音频,下载地址是http://www.swftools.org/download.html,也可以加入知识星球“AIGC部落”进行下载。
然后将swfextract这个工具的可执行文件的路径已经添加到系统PATH环境变量中:
比如其路径是:D:\Program Files (x86)\SWFTools
然后,在ChatGPT中输入提示词:
你是一个Python编程专家,要完成一个提取flash动画swf文件中的mp3的任务,具体步骤如下:
打开文件夹:C:\迅雷下载\有声绘本_flash[淘宝-珍奥下载]\有声绘本 flash;
读取所有的swf文件;
使用swfextract工具将这些swf文件转换为mp3文件;
注意:每一步都要输出相关信息;
swfextract.exe的地址是:D:\Program Files (x86)\SWFTools
swfextract工具的使用方法:
NAME
swfextract - a tool for extracting data out of swf files.
Synopsis
swfextract [options] [file.swf]
DESCRIPTION
swfextracts allows to extract swf movieclips and objects out of swf files.
SWF files are animation files which can be displayed in Web Browsers using the Flash Plugin.
OPTIONS
?m, ??mp3
Extract main mp3 stream (There may be substreams in the Movieclips, as well. To extract these, first extract the Movieclips with -i and then use -m)
生成源代码如下:
import os
import subprocess
# 文件夹路径
folder_path = "C:\\迅雷下载\\有声绘本_flash[淘宝-珍奥下载]\\有声绘本 flash"
# swfextract 工具的路径
swfextract_path = "D:\\Program Files (x86)\\SWFTools\\swfextract.exe"
# 读取所有的swf文件
swf_files = [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f)) and f.endswith(".swf")]
# 遍历所有swf文件
for swf_file in swf_files:
print(f"处理文件:{swf_file}")
# 提取swf文件中的音频
mp3_file = swf_file.replace(".swf", ".mp3")
subprocess.run([swfextract_path, "-m", os.path.join(folder_path, swf_file), "-o", os.path.join(folder_path, mp3_file)])
print(f"生成MP3文件:{mp3_file}")
print("所有文件处理完毕。")
运行程序,全部flash动画文件转换成了mp3音频
本文暂时没有评论,来添加一个吧(●'◡'●)