Open WinterEx19 opened 1 year ago
copying audio
Error while decoding stream #0:0: Invalid data found when processing input <- This!
reading audio
Interesting. This is likely the culprit:
https://github.com/ArdenButterfield/stammer/blob/6de38a7578a8335d4b2ea34e94a616a68b7e5280/stammer.py#L190-L200
I think we need to add -vn -map 0:a:0
so that ffmpeg ignores the video and only picks one audio track.
It is odd that, here, ffmpeg
could get video frames, but couldn't get audio
I am not experiencing this "Error while decoding stream" but am experiencing this bug, so that's not the culprit. How do I make this thing work? Clearly others are using it and not running into this issue.
It's nothing to do with the audio, it's everything to do with how it's naming and calling the frame files
it's line 171. At least in the current build at the time of this comment--your post has it as line 105 but it's the same line of code
edit: looks like stammer has been updated, this fix is not applicable to the current ver
shutil.copy(frames_dir / f'frame{match_num+1:06d}.png', outframes_dir / f'frame{i:06d}.png')
the match_num+1 part makes it look for a frame file one number above the last one created in the directory. Like, if it extracts 100 frames from the input video, it'll try to copy frame 101 into the output, which doesn't exist, so it's aborted
removing the +1 makes it look for frame 0 instead, which also doesn't exist. I fixed this by making it copy frame 1 as frame 0
change lines 169-171 (or wherever it is in your build) to
shutil.copy(frames_dir / f'frame000001.png', frames_dir / f'frame000000.png') //added this line to copy the frame
if type(best_matches) == list:
for i, match_num in enumerate(best_matches):
shutil.copy(frames_dir / f'frame{match_num:06d}.png', outframes_dir / f'frame{i:06d}.png')
it's kind of a patchwork thing, it's like duct tape
shutil.copy(frames_dir / f'frame000001.png', frames_dir / f'frame000000.png') //added this line to copy the frame if type(best_matches) == list: for i, match_num in enumerate(best_matches): shutil.copy(frames_dir / f'frame{match_num:06d}.png', outframes_dir / f'frame{i:06d}.png')
Trying to implement this as a quick fix, (as someone who only knows a little python)... If I paste and replace the line quoted above, "Best_matches" isn't defined yet. Also, is the if statement inside the previous if statement? or a separate if statement?
it's separate. It looks like this
in the version of stammer I was using. Looks like it's been updated. The fix will not work with the current version
This is the possible culpirt in the updated version: "video_handler.write_frame(video_frame_i,video_handler.get_frame(carrier_video_frame+1))"
This may fix it if you remove +1
I have a branch @ #65 (https://github.com/Firepal/stammer/tree/assert_fix_test) which at best attempts to fix the problem, and at worst reports more information when the problem arises.
Please try it, and if you get an error, report back here or in the sister issue #62 with the full STAMMER output. Thanks!
This branch is now merged into main. As far as I'm concerned, it should be impossible for the latest code to be able to read any bad frames. @WinterEx19 @ArdenButterfield Thoughts on closing this issue?
This is my console output: Separating video frames copying audio Error while decoding stream #0:0: Invalid data found when processing input reading audio analyzing audio finding best matches creating output audio building output video Traceback (most recent call last): File "/Users/myname/Desktop/folder/stammer/stammer.py", line 254, in
main()
File "/Users/myname/Desktop/folder/stammer/stammer.py", line 247, in main
process(carrier_path, modulator_path, output_path)
File "/Users/myname/Desktop/folder/stammer/stammer.py", line 225, in process
build_output_video(frames_dir, outframes_dir, best_matches, 1/frame_length, output_path)
File "/Users/myname/Desktop/folder/stammer/stammer.py", line 105, in build_output_video
shutil.copy(frames_dir / f'frame{match_num+1:06d}.png', outframes_dir / f'frame{i:06d}.png')
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 419, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 256, in copyfile
with open(src, 'rb') as fsrc:
^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'temp/frames/frame017558.png'
It never creates the file frame017558.png when creating frames.