🌐 AI搜索 & 代理 主页
Skip to content

Commit a924e45

Browse files
committed
.
1 parent 32a7bd6 commit a924e45

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

image-converter/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Image Converter
2+
3+
Bunu GUI ile proje olarak yapıcam. şimdilik ismi dursun

mp4-converter/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# MP4 CONVERTER
2+
3+
Bunu GUI ile proje olarak yapıcam. şimdilik ismi dursun.

mp4-converter/mp4_conv.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#import subprocess; subprocess.run(['ffmpeg', '-i', 'a.mp4', '-vf', 'scale=-1:1080', 'movie_resized.mp4'])
2+
3+
############### ALTERNATIVE METHOD USING MOVIEPY ####################
4+
5+
from moviepy.video.io.VideoFileClip import VideoFileClip
6+
7+
clip = VideoFileClip("a.mp4")
8+
9+
# make the height 360px
10+
clip.resized(height=720)
11+
12+
clip.write_videofile("movie_resized.mp4")
13+
clip.close()
14+
15+
16+
############## ANOTHER WAY USING MOVIEPY ####################
17+
18+
""" ANOTHER WAY
19+
import moviepy.editor as mp
20+
21+
clip = mp.VideoFileClip("a.mp4")
22+
23+
# make the height 360px ( According to moviePy documenation The width is then computed so that the width/height ratio is conserved.)
24+
clip_resized = clip.resize(height=720)
25+
26+
clip_resized.write_videofile("movie_resized.mp4")
27+
"""

mp4-converter/mp4_to_mp3.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
from moviepy import VideoFileClip
3+
4+
def mp4_to_mp3(input_file: str, output_file: str | None = None):
5+
"""MP4 dosyasını MP3 formatına dönüştürür."""
6+
7+
if not os.path.exists(input_file):
8+
print(f"Hata: '{input_file}' dosyası bulunamadı!")
9+
return False
10+
11+
output_file = output_file or os.path.splitext(input_file)[0] + ".mp3"
12+
13+
try:
14+
with VideoFileClip(input_file) as video:
15+
if not video.audio:
16+
print("Hata: Video dosyasında ses bulunamadı!")
17+
return
18+
else : video.audio.write_audiofile(output_file, verbose=False, logger=None)
19+
print(f"✅ Dönüştürme tamamlandı: {output_file}")
20+
return True
21+
except Exception as e:
22+
print(f"❌ Hata: {e}")
23+
24+
25+
26+
27+
mp4_to_mp3("a.mp4")

0 commit comments

Comments
 (0)