diff --git a/vid_convert.py b/vid_convert.py index 47dcaa9..1ea1156 100755 --- a/vid_convert.py +++ b/vid_convert.py @@ -152,7 +152,7 @@ def extract_subs(file, track, lang): logging.debug(command) result = subprocess.getoutput(command) if result != "": - logging.info(result) + logging.error(result) def convert_audio(file, track, volume_adj, channels, channel_layout, language, title): @@ -163,7 +163,8 @@ def convert_audio(file, track, volume_adj, channels, channel_layout, language, t command = f'ffmpeg -loglevel error -i {file} -map 0:{track} -map_metadata -1 -vn -sn -c:a {codec} -mapping_family 1 -filter:a volume={volume_adj},aformat=channel_layouts={channel_layout} {metadatas} -y {file}_audio_{track}_{language}.mka' logging.debug(command) result = subprocess.getoutput(command) - logging.info(result) + if result != "": + logging.error(result) def convert_video(file, infos, start, crop, crf, animation): @@ -215,7 +216,8 @@ def convert_video(file, infos, start, crop, crf, animation): command = f'ffmpeg -loglevel error -i {file} -map 0:{track} -ss {start} -t 300 -an -sn -c:v {codec} {tune} {hdr} -crf {crf} -pix_fmt {fmt} -filter:v {crop} -y {output}' logging.debug(command) result = subprocess.getoutput(command) - logging.info(result) + if result != "": + logging.error(result) def create_mkv(filename): @@ -272,10 +274,12 @@ def create_mkv(filename): def mkv_to_mp4(filename): options = "-c:a copy -c:v copy -c:s copy -movflags faststart" - command = f"ffmpeg -i {filename}_FINAL.mkv {options} -y NEW_{filename}.mp4" + command = f"ffmpeg -loglevel error -i {filename}_FINAL.mkv {options} -y NEW_{filename}.mp4" result = subprocess.getoutput(command) - logging.debug(result) - remove(f"{filename}_FINAL.mkv") + if result != "": + logging.error(result) + else: + remove(f"{filename}_FINAL.mkv") if __name__ == '__main__':