mirror of
https://cdm-project.com/Download-Tools/udemy-downloader.git
synced 2025-04-30 02:14:25 +02:00
attempt to fix ffmpeg hanging
+ Added nostdin argument to ffmpeg call + Set ffmpeg log level to errors only + Fixed some stuff not getting printed correctly
This commit is contained in:
parent
e5d5285bf7
commit
885d920fba
11
main.py
11
main.py
@ -55,6 +55,7 @@ def log_subprocess_output(prefix: str, pipe: IO[bytes]):
|
||||
if pipe:
|
||||
for line in iter(pipe.readline, b''): # b'\n'-separated lines
|
||||
logger.debug('[%s]: %r', prefix, line.decode("utf8").strip())
|
||||
pipe.flush()
|
||||
|
||||
|
||||
# this is the first function that is called, we parse the arguments, setup the logger, and ensure that required directories exist
|
||||
@ -1083,14 +1084,14 @@ def mux_process(video_title, video_filepath, audio_filepath, output_path):
|
||||
@author Jayapraveen
|
||||
"""
|
||||
if os.name == "nt":
|
||||
command = "ffmpeg -y -i \"{}\" -i \"{}\" -acodec copy -vcodec copy -fflags +bitexact -map_metadata -1 -metadata title=\"{}\" \"{}\"".format(
|
||||
command = "ffmpeg -nostdin -loglevel error -y -i \"{}\" -i \"{}\" -acodec copy -vcodec copy -fflags +bitexact -map_metadata -1 -metadata title=\"{}\" \"{}\"".format(
|
||||
video_filepath, audio_filepath, video_title, output_path)
|
||||
else:
|
||||
command = "nice -n 7 ffmpeg -y -i \"{}\" -i \"{}\" -acodec copy -vcodec copy -fflags +bitexact -map_metadata -1 -metadata title=\"{}\" \"{}\"".format(
|
||||
command = "nice -n 7 ffmpeg -nostdin -loglevel error -y -i \"{}\" -i \"{}\" -acodec copy -vcodec copy -fflags +bitexact -map_metadata -1 -metadata title=\"{}\" \"{}\"".format(
|
||||
video_filepath, audio_filepath, video_title, output_path)
|
||||
|
||||
process = subprocess.Popen(
|
||||
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
command, shell=True)
|
||||
log_subprocess_output("FFMPEG-STDOUT", process.stdout)
|
||||
log_subprocess_output("FFMPEG-STDERR", process.stderr)
|
||||
ret_code = process.wait()
|
||||
@ -1112,7 +1113,7 @@ def decrypt(kid, in_filepath, out_filepath):
|
||||
command = f"nice -n 7 shaka-packager --enable_raw_key_decryption --keys key_id={kid}:key={key} input=\"{in_filepath}\",stream_selector=\"0\",output=\"{out_filepath}\""
|
||||
|
||||
process = subprocess.Popen(
|
||||
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
command, shell=True)
|
||||
log_subprocess_output("SHAKA-STDOUT", process.stdout)
|
||||
log_subprocess_output("SHAKA-STDERR", process.stderr)
|
||||
ret_code = process.wait()
|
||||
@ -1147,7 +1148,7 @@ def handle_segments(url, format_id, video_title,
|
||||
args.append("--downloader-args")
|
||||
args.append("aria2c:\"--disable-ipv6\"")
|
||||
process = subprocess.Popen(
|
||||
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
args)
|
||||
log_subprocess_output("YTDLP-STDOUT", process.stdout)
|
||||
log_subprocess_output("YTDLP-STDERR", process.stderr)
|
||||
ret_code = process.wait()
|
||||
|
Loading…
x
Reference in New Issue
Block a user