非常感谢timgavin提供的好答案!
我的需求需要一个略微不同的应用程序,我使用了命令提示符:
set probe="<YOUR PATH>/ffmpeg/bin/ffprobe.exe"
%probe% -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 input.avi
在这种情况下,返回的是:
。
mpeg4
我不确定这是否足以满足我的要求。从我的当前研究来看,HTML5视频标签是一个文档不完善的标准。
感谢@llogan的评论和更多的研究,我决定发布我对视频标签的发现:
ffmpeg/bin/ffmpeg.exe" -i input.avi -b 1500k -vcodec libx264 "output.mp4"
或者
ffmpeg/bin/ffmpeg.exe -i input.mov -vcodec h264 -acodec aac -strict -2 output.mp4
当然,这个:
h264
视频编解码器是唯一被支持的 .mp4 文件类型的编解码器。这个指南可能会有所帮助:https://trac.ffmpeg.org/wiki/Encode/H.264
据我所知,如果使用的浏览器是最新版本,则应该支持这些视频文件类型!
感谢 @llogan 的建议,我们不再需要:
-strict -2
但使用:
-movflags +faststart
我现在拥有的,得益于劳埃德的帮助和研究,是:
string ffmpeg = "Utils/ffmpeg/ffmpeg.exe";
string encode = "-y -i \"" + InputFile + "\" -movflags +faststart -vcodec libx264 -crf 22 -acodec aac -b:a 192k \"" + OutputFile + "\"";
位置: OutputFile
为 OutputFile.mp4
截至:2020年6月12日,这是适用于HTML5视频标签的良好ffmpeg编码。