Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Error issue (assumed to be caused by long mudulation file, maybe) #62

Open
astatinedeposit opened this issue Apr 7, 2023 · 3 comments

Comments

@astatinedeposit
Copy link

astatinedeposit commented Apr 7, 2023

running into an issue with the program. i think the issue may be the length of my audio file modulator file(25min), but I am unsure. (Im an absolutely illiterate idiot with technical code such as this)
If I've done something dumb I apologise
problem usually occurs 7099 frames through the "building output video" segment.

Traceback (most recent call last):
File "C:\Users*name*\Downloads\stammer-main\stammer-main\stammer.py", line 309, in
main()
File "C:\Users*name*\Downloads\stammer-main\stammer-main\stammer.py", line 305, in main
process(vars(args))
File "C:\Users*name
\Downloads\stammer-main\stammer-main\stammer.py", line 265, in process
build_output_video(handler, matcher)
File "C:\Users*name
\Downloads\stammer-main\stammer-main\stammer.py", line 144, in build_output_video
video_handler.write_frame(video_frame_i,video_handler.get_frame(carrier_video_frame+1))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users*name*\Downloads\stammer-main\stammer-main\video_out.py", line 90, in get_frame
super().get_frame(idx)
File "C:\Users*name*\Downloads\stammer-main\stammer-main\video_out.py", line 41, in get_frame
assert(idx > self.framecount)
^^^^^^^^^^^^^^^^^^^^^
AssertionError

edit: i got a temp fix working by setting the output as .mp3

@astatinedeposit astatinedeposit changed the title issue Assertion Error issue (assumed to be caused by long mudulation file, maybe) Apr 7, 2023
@Firepal
Copy link
Collaborator

Firepal commented Apr 8, 2023

You've done nothing wrong.
Very probably a duplicate of #9 et al. I introduced this assert because of those issues.

I have a hunch the bug is located within build_output_video but I can't parse a lot of the frame length math in my brains :^)

@onedez
Copy link

onedez commented Apr 10, 2023

I had this same problem too. Got the same exact stack traceback.

Calculating video length
Separating video frames
frame=129578 fps=412 q=-0.0 Lsize=N/A time=01:30:04.48 bitrate=N/A speed=17.2x
reading audio
analyzing audio
creating output audio
building output video
Traceback (most recent call last):
File "C:\Users\myname\Downloads\stammer-main\stammer-main\stammer.py", line 309, in
main()
File "C:\Users\myname\Downloads\stammer-main\stammer-main\stammer.py", line 305, in main
process(**vars(args))
File "C:\Users\myname\Downloads\stammer-main\stammer-main\stammer.py", line 265, in process
build_output_video(handler, matcher)
File "C:\Users\myname\Downloads\stammer-main\stammer-main\stammer.py", line 144, in build_output_video
video_handler.write_frame(video_frame_i,video_handler.get_frame(carrier_video_frame+1))
File "C:\Users\myname\Downloads\stammer-main\stammer-main\video_out.py", line 90, in get_frame
super().get_frame(idx)
File "C:\Users\myname\Downloads\stammer-main\stammer-main\video_out.py", line 41, in get_frame
assert(idx < self.framecount)
AssertionError

However, my modulator track isn't the long one. It's my carrier track that's long. (90 minutes)
It was around uh.. 1100-1300 frames into the "building output video" process out of 5300 frames.

I'm running this on Windows 11.

I tried this twice and got the same error output.

@Firepal
Copy link
Collaborator

Firepal commented Apr 10, 2023

@ArdenButterfield Can you clear up the purpose of the +1 in line 144 of this code?

stammer/stammer.py

Lines 135 to 144 in d73334d

if type(matcher) in (BasicAudioMatcher, UniqueAudioMatcher):
for video_frame_i in range(int(len(best_matches) * audio_frame_length / video_frame_length)):
elapsed_time = video_frame_i * video_frame_length
audio_frame_i = int(elapsed_time / audio_frame_length)
time_past_start_of_audio_frame = elapsed_time - (audio_frame_i * audio_frame_length)
match_num = best_matches[audio_frame_i]
elapsed_time_in_carrier = match_num * audio_frame_length + time_past_start_of_audio_frame
carrier_video_frame = int(elapsed_time_in_carrier / video_frame_length)
carrier_video_frame = min(carrier_video_frame, int(video_handler.framecount - 1))
video_handler.write_frame(video_frame_i,video_handler.get_frame(carrier_video_frame+1))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants