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/