简体   繁体   English

如何从PHP / FFmpeg / MP4Box / Anything中提取MP4搜索点信息?

[英]How to extract MP4 seekpoints information from PHP/FFmpeg/MP4Box/Anything?

Is it possible to extract the seekpoints/keyframes from a MP4 file in the following fashion: 是否可以通过以下方式从MP4文件中提取搜寻点/关键帧:

Keyframe - Time Range (in seconds) - Offset (in bytes) 关键帧-时间范围(以秒为单位)-偏移量(以字节为单位)

Example: 0 - 0s - 77262 例如:0-0s-77262

1 - 0.5s - 144183 1-0.5秒-144183

2 - 1s - 222965 2-1秒-222965

3 - 1.5s - 293303 3-1.5秒-293303

4 - 2s - 362199 4-2秒-362199

5 - 2.5s - 431178 5-2.5秒-431178

Thanks in advance. 提前致谢。

You can use ffprobe . 您可以使用ffprobe Perhaps something like this: 也许是这样的:

ffprobe -show_frames -select_streams v:0 -show_entries frame=key_frame,coded_picture_number,pkt_pts_time,pkt_pos input.mp4 | grep -A 3 "key_frame=1"

Results in: 结果是:

key_frame=1
pkt_pts_time=0.000000
pkt_pos=48
coded_picture_number=0
--
key_frame=1
pkt_pts_time=10.000000
pkt_pos=47130
coded_picture_number=250
--
key_frame=1
pkt_pts_time=20.000000
pkt_pos=92713
coded_picture_number=500
--
key_frame=1
pkt_pts_time=30.000000
pkt_pos=138159
coded_picture_number=750
  • key_frame=1 indicates that the particular frame is a key frame. key_frame=1表示特定帧是关键帧。

  • You may have to choose section_entries if this example does not give you exactly what you want. 如果此示例不能完全提供所需的内容,则可能必须选择section_entries See man ffprobe . man ffprobe

  • See the -print_format option to change the output printing format (default, compact, csv, flat, ini, json, xml). 请参阅-print_format选项以更改输出打印格式(默认,紧凑,csv,flat,ini,json,xml)。 You may have to perform additional processing to get what you want. 您可能必须执行其他处理才能获得所需的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM