@@ -20,8 +20,6 @@ async def convert_video(listener, video_file, ext, retry=False):
20
20
"ffmpeg" ,
21
21
"-i" ,
22
22
video_file ,
23
- "-preset" ,
24
- "ultrafast" ,
25
23
"-c:v" ,
26
24
"libx264" ,
27
25
"-c:a" ,
@@ -32,6 +30,10 @@ async def convert_video(listener, video_file, ext, retry=False):
32
30
f"{ cpu_count () // 2 } " ,
33
31
output ,
34
32
]
33
+ if ext == "mp4" :
34
+ cmd [7 :7 ] = ["-c:s" , "mov_text" ]
35
+ elif ext == "mkv" :
36
+ cmd [7 :7 ] = ["-c:s" , "ass" ]
35
37
else :
36
38
cmd = ["ffmpeg" , "-i" , video_file , "-map" , "0" , "-c" , "copy" , output ]
37
39
if listener .cancelled :
@@ -52,6 +54,8 @@ async def convert_video(listener, video_file, ext, retry=False):
52
54
f"{ stderr } . Something went wrong while converting video, mostly file is corrupted. Path: { video_file } "
53
55
)
54
56
if not retry :
57
+ if await aiopath .exists (output ):
58
+ await remove (output )
55
59
return await convert_video (listener , video_file , ext , True )
56
60
return False
57
61
@@ -63,8 +67,6 @@ async def convert_audio(listener, audio_file, ext):
63
67
"ffmpeg" ,
64
68
"-i" ,
65
69
audio_file ,
66
- "-preset" ,
67
- "ultrafast" ,
68
70
"-map" ,
69
71
"0" ,
70
72
"-threads" ,
@@ -88,6 +90,8 @@ async def convert_audio(listener, audio_file, ext):
88
90
LOGGER .error (
89
91
f"{ stderr } . Something went wrong while converting audio, mostly file is corrupted. Path: { audio_file } "
90
92
)
93
+ if await aiopath .exists (output ):
94
+ await remove (output )
91
95
return False
92
96
93
97
@@ -512,8 +516,6 @@ async def createSampleVideo(listener, video_file, sample_duration, part_duration
512
516
"ffmpeg" ,
513
517
"-i" ,
514
518
video_file ,
515
- "-preset" ,
516
- "ultrafast" ,
517
519
"-filter_complex" ,
518
520
filter_complex ,
519
521
"-map" ,
@@ -546,4 +548,6 @@ async def createSampleVideo(listener, video_file, sample_duration, part_duration
546
548
LOGGER .error (
547
549
f"{ stderr } . Something went wrong while creating sample video, mostly file is corrupted. Path: { video_file } "
548
550
)
551
+ if await aiopath .exists (output_file ):
552
+ await remove (output_file )
549
553
return False
0 commit comments