Html 将MPEG-4编解码器转换为H.264以使用Flask播放

Html 将MPEG-4编解码器转换为H.264以使用Flask播放,html,flask,video,base64,codec,Html,Flask,Video,Base64,Codec,我想用flask在网页上播放视频。但是视频编解码器是不受浏览器支持的mpeg-4。我想在服务器上使用python将视频编解码器转换为h.264,有什么方法可以做到吗 以下是我的代码片段: web_page.py out_bytes = reply.content zipped_file = io.BytesIO(out_bytes) with ZipFile(zipped_file, 'r') as zf: zf.printdir() filename = zf.in

我想用flask在网页上播放视频。但是视频编解码器是不受浏览器支持的mpeg-4。我想在服务器上使用python将视频编解码器转换为h.264,有什么方法可以做到吗

以下是我的代码片段:

web_page.py

out_bytes = reply.content

zipped_file = io.BytesIO(out_bytes) 
with ZipFile(zipped_file, 'r') as zf:
   zf.printdir()      
   filename = zf.infolist()[0].filename
   buff = zf.read(filename)
   encoded = base64.b64encode(buff)#.decode('utf8')

return render_template('video_player.html', value = encoded )


视频播放器.html

<video autobuffer width="640" height="360" controls >
           <source type='video/mp4;  preload="auto" src="data:video/mp4;base64,{{value}}">
            Your browser does not support the video element.
        </video>



有许多mpeg 4编解码器。事实上,h.264是一种mpeg编解码器(其mpeg4第10部分)。您可以使用ffmpeg将任何内容转换为任何内容。@szatmary ffmpeg是一个单独的工具,对吗?我想在我的python文件中转换编解码器。那么你就不走运了。没有本地python工具可以做到这一点。“它们都是包装纸。”萨特玛丽,包装纸对我有用。有什么可以推荐给python的吗?