Open RooneyMcNibNug opened 2 months ago
Went through with the exact same process with Arch just now and had the same results with a separate video.
To note: the pyyaml
module could not be installed with the specific version in requirements.txt
, so I just installed the latest version.
I was having the exact same issue on Macbook M1. Seems to be an issue related to the function get_frame_count_ffmpeg
in /dandere2x/src/dandere2x/dandere2xlib/wrappers/ffmpeg/ffmpeg.py
trying to get frame count data from the video metadata, but such info does not exist in the retrieved metadata, so the regex match always gives an empty list.
Here is how I resolved it:
In /dandere2x/src/dandere2x/dandere2xlib/wrappers/ffmpeg/ffmpeg.py
, define a new function get_frame_count_ffprobe
as follows:
def get_frame_count_ffprobe(ffmpeg_dir: str, input_video: str):
assert get_operating_system() != "win32" or os.path.exists(ffmpeg_dir), "%s does not exist!" % ffmpeg_dir
assert os.path.exists(input_video), "%s does not exist!" % input_video
# Construct the ffprobe command
ffprobe_cmd = [
ffmpeg_dir.replace("ffmpeg", "ffprobe"), # Replace ffmpeg path with ffprobe
"-v", "error",
"-count_frames",
"-select_streams", "v:0",
"-show_entries", "stream=nb_read_frames",
"-print_format", "json",
input_video
]
# Run the ffprobe command
process = subprocess.run(ffprobe_cmd, capture_output=True)
stdout_as_str = process.stdout.decode("utf-8")
# Debug prints to understand the ffprobe output
print("FFprobe command executed:")
print(" ".join(ffprobe_cmd))
print("FFprobe command output:")
print(stdout_as_str)
# Parse the JSON output
probe_data = json.loads(stdout_as_str)
frame_count = int(probe_data['streams'][0]['nb_read_frames'])
return frame_count
Also, somehow this script is using json
but does not import it. So also do import json
at the beginning of ffmpeg.py
.
In /dandere2x/src/dandere2x/dandere2xlib/wrappers/ffmpeg/videosettings.py
, replace the function call as such:
# self.frame_count = int(get_frame_count_ffmpeg(ffmpeg_dir=self.ffmpeg_dir, input_video=video_file))
self.frame_count = int(get_frame_count_ffprobe(ffmpeg_dir=self.ffmpeg_dir, input_video=video_file))
I am still testing and unsure whether this whole thing will work perfectly but this definitely seems to have fixed this specific AssertionError.
Hello,
I am running into issues when I start an upscale job for a video. OS I am using for this at the moment is Fedora 40. I have installed all dependencies.
Here is what I see when I start the "Upscale!":
Looks like an issue with
ffprobe
module? Let me know if there is any other useful information I can provide, and thanks for your help.