FFMPEG 转换后的 mp4 文件在 firefox 和 chrome 中无法播放 [英] FFMPEG converted mp4 file does not play in firefox and chrome

查看:54
本文介绍了FFMPEG 转换后的 mp4 文件在 firefox 和 chrome 中无法播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 FFMPEG 命令将 flv 视频文件转换为 mp4 并使用 html5 视频标签并在浏览器中播放视频.但是在使用 ffmpeg 将视频转换为 mp4 后,它无法在 firefox 和 chrome 浏览器中播放.它显示一条错误消息,指出未找到支持格式和 MIME 类型的视频".我已经添加了下面的代码,请帮忙.

I have used FFMPEG command to convert flv video file to mp4 and use html5 video tag and play video in browser. But after the video is converted to mp4 using ffmpeg it does not play in firefox and chrome browser. It displays a error saying 'No video with supported format and MIME type found'. I have added the code below, Please help.

cmd /C ffmpeg -i INPUT_FILE_PATH -y -ar 22050 -ab 512 -b 800k -f mp4 -s 514*362 OUTPUT_FILE.mp4"

推荐答案

这就是您所需要的.我最近发现自己也遇到了同样的问题.

This is what you need. I recently found myself fighting the same problem.

将此添加到您的命令中:

Add this to your command:

-pix_fmt yuv420p

如果您不指定 pix_fmt,它默认为 yuv444p,这似乎与当前浏览器不兼容.

If you don't specify the pix_fmt it defaults to yuv444p which doesn't seem to be compatible with current browsers.

我成功测试的完整命令是:

The full command I'm successfully testing with is:

ffmpeg -y -i "INPUT-FILE" -c:v libx264 -preset slow -crf 22 -pix_fmt yuv420p -c:a libvo_aacenc -b:a 128k "OUTPUT-FILE"

将您的输入、输出路径放在引号内,然后尝试开始.在当前的 IE、Firefox 和 Chrome 中播放.我正在使用内置的 aac 编码器进行音频.

Put your input, output paths inside the quotes and try that to get started. Plays in current IE, Firefox, and Chrome. I'm using the built in aac encoder for audio.

这篇关于FFMPEG 转换后的 mp4 文件在 firefox 和 chrome 中无法播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆