python 音訊切割

2022-09-06 03:03:07 字數 670 閱讀 7506

參考自:

安裝 pydub

pip3 install pydub

python**實現

# -*- coding: utf-8 -*-

from pydub import audiosegment  # 先導入這個模組

import os

filems = os.listdir("d:/1/***/***")

dirj = "d:/1/***/***/"

dirjl = "d:/1/***/mp4/"

index=0

for f in filems:   

input_music = audiosegment.from_***(dirj+f) # 載入***音訊

output_music = input_music[:9000] # 擷取音訊的前3秒(單位為毫秒)             

#output_music = input_music[9000:] # 擷取音訊的最後3秒(單位為毫秒)

#fary = f.split(".")

#name = fary[0]+str(index)+"."+fary[1]

output_music.export(dirjl+f, format="***") # 儲存音訊,前面為儲存的路徑,後面為儲存的格式

python切割列表

import re shop list 399 4369 539 288 109 749 235,19 99,1000 提示使用者輸入要新增的商品 多個 分號隔開 比如 389 400 480 180 190 area input 輸入你要新增的 將輸入的商品 進行字串切割 list new are...

python 切詞演算法(正向切割 反向切割)

author wanghuafeng coding utf 8 import os import sys import codecs from collections import deque try path os.path.dirname os.path.abspath file except ...

Python切割nginx日誌

前面寫過bash shell對nginx日誌的切割,現在用python進行其操作。usr bin python coding utf 8 created on 2011 11 17 切割nginx的日誌檔案,重新生成乙個log日誌,nginx的程序號不變動 author jimingsong imp...