반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- OPIC 번개
- docker 환경 문제
- cross entoropy
- OPIC 하루 전
- tensorboard html5
- ImportError: cannot import name 'Mapping' from 'collections'
- ollama
- 엑셀에 ollama
- OPIC 당일치기
- 인간종말
- DDPG
- dice loss
- 공개키 docker
- 빅데이터 분석기사 #빅분기실기 #데이터마님 # 빅분기실기준비
- 강화학습 간단 정리
- tersorboard mapping
- gpt excel 사용
- ImportError: cannot import name 'Mapping' from 'collections' tensrorbaord
- OPIC 오늘 시작
- AI생성함
- tesorboard
- 음성전처리 #음성처리 #python 음성추출 # python 음성 추출 #moviepy
- OPIC 시험 전날
- 일기 #다짐
- whisper jax
- focal loss
- AI모델
- reinforced learning
- OPIC 하루전 시작
- tensorboard 에러
Archives
- Today
- Total
Moonie
폴더 내 모든 동영상에서 음성을 추출 하는 코드 본문
반응형
import os
import moviepy.editor as mp
path_dir = "데이터 폴더 경로"
dst_dir = "대상 폴더 경로"
for (root, directories, files) in os.walk(path_dir):
for d in directories:
d_path = os.path.join(root, d)
print(d_path)
for file in files:
file_path = os.path.join(root, file) # path_dir경로/파일
print(file_path)
wave_name = dst_dir + file.strip(".mp4") + (".mp3") # 대상경로+ 파일 명에서 확장자 바꾸기
print(wave_name)
dst_file_path = os.path.join(dst_dir,wave_name)
clip = mp.VideoFileClip(file_path) # 동영상을 라이브러리로 호출
clip.audio.write_audiofile(wave_name) #음성 파일로 저장
두고두고 쓰려고 내가 만들었다.
반응형
'공부 > 코드관련' 카테고리의 다른 글
[에러해결] tensorboard 에러 ImportError: cannot import name 'Mapping' from 'collections' 해결 (0) | 2023.06.16 |
---|---|
whisper jax를 이용한 폴더내 음성데이터 텍스트 및 json 변환 (0) | 2023.05.19 |
Python 텍스트에서 특정 조건 열 삭제 (2) | 2021.08.04 |
Comments