Introduce fix_audio_encoder and fix_video_encoder

This commit is contained in:
henryruhs
2025-05-25 18:13:58 +02:00
parent 854f895403
commit aab2e0aec5

View File

@@ -260,30 +260,22 @@ def concat_video(output_path : str, temp_output_paths : List[str]) -> bool:
def fix_audio_encoder(video_format : VideoFormat, audio_encoder : AudioEncoder) -> AudioEncoder: def fix_audio_encoder(video_format : VideoFormat, audio_encoder : AudioEncoder) -> AudioEncoder:
if video_format == 'avi' and audio_encoder == 'libopus': if video_format == 'avi' and audio_encoder == 'libopus':
return 'aac' return 'aac'
if video_format == 'm4v': if video_format == 'm4v':
return 'aac' return 'aac'
if video_format == 'mov' and audio_encoder in [ 'flac', 'libopus' ]: if video_format == 'mov' and audio_encoder in [ 'flac', 'libopus' ]:
return 'aac' return 'aac'
if video_format == 'webm': if video_format == 'webm':
return 'libopus' return 'libopus'
return audio_encoder return audio_encoder
def fix_video_encoder(video_format : VideoFormat, video_encoder : VideoEncoder) -> VideoEncoder: def fix_video_encoder(video_format : VideoFormat, video_encoder : VideoEncoder) -> VideoEncoder:
if video_format == 'm4v': if video_format == 'm4v':
return 'libx264' return 'libx264'
if video_format in [ 'mkv', 'mp4' ] and video_encoder == 'rawvideo': if video_format in [ 'mkv', 'mp4' ] and video_encoder == 'rawvideo':
return 'libx264' return 'libx264'
if video_format == 'mov' and video_encoder == 'libvpx-vp9': if video_format == 'mov' and video_encoder == 'libvpx-vp9':
return 'libx264' return 'libx264'
if video_format == 'webm': if video_format == 'webm':
return 'libvpx-vp9' return 'libvpx-vp9'
return video_encoder return video_encoder