有谁知道如何使用ffmpeg从视频文件中获取总帧数吗?ffmpeg的渲染输出显示当前帧,我需要帧数来计算百分比进度。
发布于 2018-04-26 09:25:37
示例命令
$ ffprobe -v error -count_frames -select_streams v:0 \
-show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 \
input.mkv
2600
2600指读取帧的数量。-v error 这隐藏了“信息”输出(版本信息等),使分析更容易。-count_frames 计算每个流的帧数并在相应的流部分报告。-select_streams v:0 只选择视频流。-show_entries stream=nb_read_frames 仅显示读取帧的数量。-of default=nokey=1:noprint_wrappers=1设置输出格式(即“作者”)default,不要打印每个字段(nokey=1)的关键字,并且不要打印节标题和页脚(noprint_wrappers=1)。发布于 2018-04-26 10:29:43
在Unix中
ffmpeg -i 00000.avi -vcodec copy -acodec copy -f null /dev/null 2>&1 | grep 'frame=' | cut -f 2 -d ' '
https://stackoverflow.com/questions/-100003979
复制相似问题