使用ffmpeg从视频中提取帧-标头问题?

时间:2019-07-19 19:11:48

标签: image video 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.50s,并表示标头解析存在问题(见上文)。

尽管看了很多ffmpeg的“将视频转换为帧”帖子,但我不知道如何排序。任何提示将不胜感激,谢谢。

1 个答案:

答案 0 :(得分:1)

如果查看错误消息,您将看到该文件有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选择第一个视频流。