哪个ffmpeg命令行会将现有.MP4中关键帧的索引号列出到标准输出?
我已经在https://superuser.com/questions/885452/extracting-the-index-of-key-frames-from-a-video-using-ffmpeg上尝试了唯一适用的答案,但没有效果。
发布于 2019-12-21 21:34:22
使用
ffmpeg -i in.mp4 -v trace 2>&1 | grep -B 1 "distance 1, keyframe 0" | grep "distance 0, keyframe 1"
这将发出表单的行,
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000405740] AVIndex stream 0, sample 3961, offset 2e0d298, dts 2028032, size 37168, distance 0, keyframe 1
其中,采样后的数字是帧计数,以零为索引。
我有两个grep,因为通常所有音频样本都被标记为关键帧,所以第一个grep搜索关键帧之后的帧,第二个grep只将行发送到匹配帧的前面,即KF。如果您知道视频的流索引,您可以设计一个正则表达式并使用单个grep。
https://stackoverflow.com/questions/59435477
复制相似问题