[英]python-vlc - Codec `h264' (H264 - MPEG-4 AVC (part 10)) is not supported
I am trying to play a video using python-vlc in python.我正在尝试在 python 中使用 python-vlc 播放视频。 It is giving me the following error.
它给了我以下错误。
[00007f92180098b0] main decoder error: Codec `h264` (H264 - MPEG-4 AVC (part 10)) is not supported.
[00007f92180098b0] main decoder error: Codec not supported
[00007f92180098b0] main decoder error: VLC could not decode the format "h264" (H264 - MPEG-4 AVC (part 10))
The code to play the video is as follows播放视频的代码如下
import sys
import vlc
import easygui
if(len(sys.argv) < 2):
print("Please enter file name as command line argument")
exit(0)
media = vlc.MediaPlayer(sys.argv[1])
media.play()
while True:
pass
Any help is greatly appreciated.任何帮助是极大的赞赏。 Thank you.
谢谢你。
I came across with this problem while using Anaconda virtual environment.我在使用 Anaconda 虚拟环境时遇到了这个问题。 I solved it by updating
ffmpeg
package which was very old.我通过更新非常旧的
ffmpeg
包来解决它。 This action also triggered openh264
new library installation.这个动作也触发了
openh264
新库的安装。
conda install -c conda-forge ffmpeg
In case of the usual python
run, I think installing/updating ffmpeg library will solve it.在通常的
python
运行的情况下,我认为安装/更新 ffmpeg 库可以解决它。
Try installing libavcodec by running apt install libavcodec58
and make sure the system VLC player can play the MP4 file without any errors.尝试通过运行
apt install libavcodec58
并确保系统 VLC 播放器可以播放 MP4 文件而没有任何错误。
If you are running Anaconda Python, some old-version Anaconda Python will cause the H264-codec-not-found error.如果您正在运行 Anaconda Python,一些旧版本的 Anaconda Python 会导致 H264-codec-not-found 错误。 So try to install the latest version Anaconda or Miniconda, and use its
pip
to install python-vlc
and launch Python VLC.因此尝试安装最新版本的 Anaconda 或 Miniconda,并使用其
pip
安装python-vlc
并启动 Python VLC。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.