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

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

问题描述

我使用FFMPEG命令将flv视频文件转换为mp4,并使用html5视频标签,并在浏览器中播放视频。但是,使用ffmpeg将视频转换成mp4后,它不会在Firefox和Chrome浏览器中播放。它显示一条错误,说没有支持的格式和MIME类型的视频。我已经添加了以下代码,请帮忙。

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


解决方案



将此添加到您的命令中:

  -pix_fmt yuv420p 

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



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

$ -c:v libx264 -preset slow -crf 22 -pix_fmt yuv420p -c:libvo_aacenc -b :一个128kOUTPUT-FILE

将您的输入,输出路径放在引号内,并尝试开始使用现在的IE,Firefox和Chrome,我正在使用内置的aac编码器进行音频。


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

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"

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天全站免登陆