@@ -68,12 +68,8 @@ def set_video_codec(
68
68
) -> str :
69
69
if codec == "auto" :
70
70
codec = "h264" if (src is None or not src .videos ) else src .videos [0 ].codec
71
- if ctr .vcodecs is not None :
72
- if ctr .vstrict and codec not in ctr .vcodecs :
73
- return ctr .vcodecs [0 ]
74
-
75
- if codec in ctr .disallow_v :
76
- return ctr .vcodecs [0 ]
71
+ if codec not in ctr .vcodecs and ctr .default_vid != "none" :
72
+ return ctr .default_vid
77
73
return codec
78
74
79
75
if codec == "copy" :
@@ -83,12 +79,7 @@ def set_video_codec(
83
79
log .error ("Input file does not have a video stream to copy codec from." )
84
80
codec = src .videos [0 ].codec
85
81
86
- if ctr .vstrict :
87
- assert ctr .vcodecs is not None
88
- if codec not in ctr .vcodecs :
89
- log .error (codec_error .format (codec , out_ext ))
90
-
91
- if codec in ctr .disallow_v :
82
+ if ctr .vcodecs is not None and codec not in ctr .vcodecs :
92
83
log .error (codec_error .format (codec , out_ext ))
93
84
94
85
return codec
@@ -99,8 +90,8 @@ def set_audio_codec(
99
90
) -> str :
100
91
if codec == "auto" :
101
92
codec = "aac" if (src is None or not src .audios ) else src .audios [0 ].codec
102
- if ctr . acodecs is not None and codec not in ctr .acodecs :
103
- return ctr .acodecs [ 0 ]
93
+ if codec not in ctr .acodecs and ctr . default_aud != "none" :
94
+ return ctr .default_aud
104
95
return codec
105
96
106
97
if codec == "copy" :
@@ -272,13 +263,13 @@ def make_media(tl: v3, output: str) -> None:
272
263
sub_output = []
273
264
apply_later = False
274
265
275
- if ctr .allow_subtitle and not args .sn :
266
+ if ctr .default_sub != "none" and not args .sn :
276
267
sub_output = make_new_subtitles (tl , ensure , temp )
277
268
278
- if ctr .allow_audio :
269
+ if ctr .default_aud != "none" :
279
270
audio_output = make_new_audio (tl , ensure , args , ffmpeg , bar , temp , log )
280
271
281
- if ctr .allow_video :
272
+ if ctr .default_vid != "none" :
282
273
if tl .v :
283
274
out_path , apply_later = render_av (ffmpeg , tl , args , bar , ctr , temp , log )
284
275
visual_output .append ((True , out_path ))
0 commit comments