Python does not play mp4 and avi files

岁酱吖の 提交于 2021-02-05 11:22:15

问题


This program does not play videos but the sound is okey. I get an error about h264 or MJPG.When trying to play an .mp4 or .avi file I see the this messages.

main decoder error: Codec `MJPG' (Motion JPEG Video) is not supported.

main decoder error: Codec not supported

main decoder error: VLC could not decode the format "MJPG" (Motion JPEG Video)

or

main decoder error:Codec `h264' (H264 - MPEG-4 AVC (part 10)) is not supported.

main decoder error: Codec not supported

main decoder error: VLC could not decode the format "h264" (H264 - MPEG-4 AVC (part 10))

and this is my code

import vlc

from time import sleep


Instance = vlc.Instance('--fullscreen')
player = Instance.media_player_new()
Media = Instance.media_new('/home/onur/video_005.avi') #Media Location
Media.get_mrl()
player.set_media(Media)
player.play()

sleep(5) # Or however long you expect it to take to open vlc

while player.is_playing():
    sleep(1)

来源:https://stackoverflow.com/questions/59993103/python-does-not-play-mp4-and-avi-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!