1. 錯誤信息
今天在使用Pytorch.io和PyAV包的時候出現了這個錯誤,完整的錯誤信息如下所示:
...envs\tf2_py38\lib\site-packages\torchvision\io\video.py", line 92, in write_videostream = container.add_stream(video_codec, rate=fps)File "av\\container\\output.pyx", line 67, in av.container.output.OutputContainer.add_streamFile "av\\codec\\codec.pyx", line 185, in av.codec.codec.Codec.__cinit__File "av\\codec\\codec.pyx", line 194, in av.codec.codec.Codec._init
av.codec.codec.UnknownCodecError: libx264Process finished with exit code 1
大概意思就是虛擬環境tf2_py38沒有找到視頻編碼的libx264這個編碼
2. 錯誤解決
這個需要去官網下載:(https://www.videolan.org/developers/x264.html)
git clone https://code.videolan.org/videolan/x264.git
或者也可以直接下載編譯好的exe文件:
https://artifacts.videolan.org/x264/