image - 使用ffmpeg从视频中提取帧 - 标题问题?
问题描述
我想将来自相机陷阱的 .AVI 文件转换为单个帧,最好使用 ffmpeg。到目前为止,我还没有成功。
我尝试过的最简单的方法是尝试定位问题,这是(我想要所有帧,我的测试文件是 test.avi):
ffmpeg -i test.avi output_%04d.png
它失败并显示以下控制台消息:
[avi @ 0x559fb596f8c0] unknown stream type 73647578
[avi @ 0x559fb596f8c0] Something went wrong during header parsing, tag [0][0]id has size 338702712, I will ignore it and try to continue anyway.
[mjpeg @ 0x559fb59709e0] No JPEG data found in image
Last message repeated 100 times
[avi @ 0x559fb596f8c0] decoding for stream 0 failed
[avi @ 0x559fb596f8c0] Could not find codec parameters for stream 0 (Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 1280x720): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[avi @ 0x559fb596f8c0] Could not find codec parameters for stream 1 (Video: none (JUNK / 0x4B4E554A), none, 11025x22050): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, avi, from 'test.avi':
Duration: 00:00:10.50, start: 0.000000, bitrate: 28129 kb/s
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 1280x720, 20.01 fps, 20.01 tbr, 20.01 tbn, 20.01 tbc
Stream #0:1: Video: none (JUNK / 0x4B4E554A), none, 11025x22050, 11025 tbr, 11025 tbn, 11025 tbc
Stream mapping:
Stream #0:1 -> #0:0 (? (?) -> png (native))
Decoder (codec none) not found for input stream #0:1
实际视频持续时间为 10 秒(例如,当使用 vlc 读取时,这确实是在相机陷阱上编程的视频长度。ffmpeg 表示持续时间为 10.50 秒,并表示标头解析存在问题(见上文) .
尽管看过很多 ffmpeg 'convert video to frames' 帖子,但我不知道如何排序。任何提示将不胜感激,谢谢。
解决方案
如果您查看错误消息,您将看到该文件有 2 个视频流。
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 1280x720, 20.01 fps, 20.01 tbr, 20.01 tbn, 20.01 tbc
Stream #0:1: Video: none (JUNK / 0x4B4E554A), none, 11025x22050, 11025 tbr, 11025 tbn, 11025 tbc
ffmpeg 正在尝试读取第二个:
Stream mapping:
Stream #0:1 -> #0:0 (? (?) -> png (native))
您可以使用-map 0:0
选择第一个流。
推荐阅读
- android - 如何在 Mesibo 中更改调用片段的标题和图像
- azure-devops - 提取文件:处理“未找到文件”警告
- typescript - 我可以关闭用于在 lambdas 中解构的 eslint tyfedef 规则吗
- sql-server - 在原始帖子之后插入潜在回复时按日期对记录进行排序
- javascript - 只能从枚举数组中获取值的 JSDoc 文档参数
- google-chrome - 谷歌翻译在 Chrome 中显示空白屏幕
- python-3.x - python中更好的曲线拟合
- javascript - axios 没有从 api 获取任何数据
- python - 有没有办法在不下载的情况下使用 pyspark 处理 s3 存储桶的 json 文件?
- c++ - 如何声明和初始化此地图
, 布尔>?