PyAV output error
Hi there!
Thanks for making this, it looks super awesome! Unfortunately, after following your instructions, it "Diffuses" successfully but then gives the following error:
Diffusing...: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 88/88 [02:11<00:00, 1.50s/frame]
Traceback (most recent call last):
File "C:\Users\User\Documents\Programming\TemporalNet2-wav\temporalvideo_hf.py", line 125, in
write_video(out_file, output_video.mul(255), fps=info["video_fps"])
File "C:\Users\User\miniconda3\envs\bskl_tn2wav\lib\site-packages\torchvision\io\video.py", line 134, in write_video
container.mux(packet)
File "av\container\output.pyx", line 203, in av.container.output.OutputContainer.mux
File "av\container\output.pyx", line 209, in av.container.output.OutputContainer.mux_one
File "av\container\output.pyx", line 164, in av.container.output.OutputContainer.start_encoding
File "av\error.pyx", line 336, in av.error.err_check
av.error.ValueError: [Errno 22] Invalid argument
I managed to get around this by manually outputting each frame as a png file. Here is the code if anyone is interested (replacing lines 127-128):
import torchvision.transforms as transforms
to_pil = transforms.ToPILImage()
for i in range(output_video.size(0)):
pil_image = to_pil(output_video[i, :, :, :].permute(2, 0, 1))
pil_image.save("output" + str(i) + ".jpg")
I'm not sure what could cause this issue with PyAV, but your solution is a good workaround.
Maybe you could try updating torchvision and pyav? pip install --upgrade av torchvision