ffmpeg - 如何从碎片化的mp4中获取帧信息
问题描述
我正在使用以下命令生成 fmp4 文件
ffmpeg -rtsp_transport tcp -i rtsp://someuser:somepassword@somedomain:someport/Streaming/Channels/101 -acodec copy -vcodec copy -hls_segment_type fmp4 -hls_time 2 -hls_list_size 10 -hls_flags delete_segments+append_list+split_by_time -hls_playlist_type event test.m3u8
我需要知道每个片段的确切持续时间和帧数。不幸的是 -vstats 似乎被忽略了。
我尝试使用
ffprobe -show_frames ./test0.m4s
但我明白了
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] could not find corresponding track id 1 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] could not find corresponding trex (id 1) [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] could not find corresponding track id 0 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] trun track id unknown, no tfhd was found [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] error reading header ./test0.m4s: Invalid data found when processing input
我假设这是因为尚未加载初始化段,但我找不到这样做的选项。
如果我尝试用
ffprobe -show_frames ./init.mp4
我没有得到任何帧信息和错误
Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 2560x1440): unspecified pixel format Consider increasing the value for the 'analyzeduration' and 'probesize' options
将不胜感激任何帮助。
解决方案
我假设这是因为尚未加载初始化段
正确的。
实现您所需要的一种方法是将cat
初始化段和媒体段放在一起并将它们输送到ffprobe
:
$ cat ./init.mp4 ./test0.m4s | ffprobe -show_frames -
推荐阅读
- c++ - 如何让 CMake find_library 为构建类型找到正确的库
- java - 如何在android java中的imageview上绘制多个点
- drupal - 如何获取drupal视图更改钩子中的总行数?
- java - 线程没有同时运行以读取文件
- reactjs - React Hooks 和 React-Redux 连接:让它们一起工作的最佳实践是什么?
- javascript - 如何使用自定义文件名在 Javascript 中创建分号分隔的 CSV?
- r - 取三个包含 NA 的变量的平均值,以使用 dplyr 创建新变量
- java - Avro Schema 字段名称:如何包含“非法”字符
- powerbi - 只有当某些用户访问主表时,是否可以在明细表中实现RLS?
- java - 如何在 Spring Boot 中使用带有休息模板的多部分表单数据