1

我正在尝试在 python 中使用 python-vlc 播放视频。它给了我以下错误。

[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))

播放视频的代码如下

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

任何帮助是极大的赞赏。谢谢你。

4

2 回答 2

0

我在使用 Anaconda 虚拟环境时遇到了这个问题。我通过更新ffmpeg非常旧的包来解决它。此操作还触发了openh264新库安装。

conda install -c conda-forge ffmpeg

在通常python运行的情况下,我认为安装/更新 ffmpeg 库将解决它。

于 2020-02-19T15:27:13.047 回答
0

尝试通过运行安装 libavcodecapt install libavcodec58并确保系统 VLC 播放器可以播放 MP4 文件而没有任何错误。

如果您正在运行 Anaconda Python,一些旧版本的 Anaconda Python 会导致 H264-codec-not-found 错误。所以尝试安装最新版本的 Anaconda 或 Miniconda,并使用它pip来安装python-vlc和启动 Python VLC。

于 2022-01-26T15:09:47.197 回答