我已经尝试过使用FFProbe、including this one获取视频编解码器的一系列不同的例子,除了偶尔的[/STREAM]之外,无法获得任何输出。
这就是我目前正在尝试的
$codec = exec("ffprobe -v error -show_entries -show_streams stream=codec_name {$input['filename']}");也试过这个..。
$codec = exec("ffprobe -v quiet -print_format json -show_format -show_streams {$input['filename']}");我知道这个视频很好,而且它可以在CLI上工作,因为当我使用下面的内容来获得持续时间时,我得到了预期的结果
$duration = exec("ffprobe {$input['filename']} -show_format 2>&1 | sed -n 's/duration=//p'");有什么想法吗?
发布于 2015-11-13 19:00:40
弄明白了。
$codec = exec("ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 {$input['filename']}");echo $codec;
产生
h264
发布于 2020-12-05 01:14:54
来自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 Mime文件类型的唯一编解码器。本指南可能有用:https://trac.ffmpeg.org/wiki/Encode/H.264
据我所知,如果浏览器正在使用,是最新的,它应该支持这些视频Mime类型!
感谢@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年12月06.12.2020,这是HTML5视频标签的一个很好的ffmpeg编码。
https://stackoverflow.com/questions/33699091
复制相似问题