从 MP4/FLV 中提取帧?
我知道 FFMPEG 是可能的,但是如果我有部分文件(比如没有开头和结尾)该怎么办。是否可以从中提取一些帧?
I know it's possible with FFMPEG, but what to do if I have a partial file (like without the beginning and the end). Is is possible to extract some frames from it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该命令
帧
在应用选项 [-r] 之前检查电影的帧速率,同样适用于 [-t],除非您想使用自定义速率提取帧。
但从未尝试过使用裁剪(损坏?)的输入文件进行此操作。
值得一试。
The command
will extract frames
Check you movie for the framerate before applying option [-r], same applicable for [-t], unless you want to extract the frames with the custom rate.
Never tried this with the cropped (corrupted?) input file though.
Worth to try.
这可能非常困难。 MP4 文件格式包含一个“moov”原子,它具有指向音频和视频“样本”的指针。如果您拥有的 mp4 文件片段没有 moov 原子,您的工作将会复杂得多。您必须开发逻辑来检查“mdat”原子(其中包含所有音频和视频样本)并使用有根据的猜测来找到音频和视频边界。
更糟糕的是,如果没有 moov 原子,您将没有解码切片所需的 SPS 和 PPS。你必须合成替代品;如果您知道用于创建 MP4 的编解码器,那么您也许能够从类似编码的文件中复制 SPS 和 PPS;如果不是,这可能是一个痛苦的反复试验过程,因为切片(H.264 编码图片)的语法取决于 SPS 和 PPS 中指定的值。
This could be VERY difficult. The MP4 file format includes an 'moov' atom which has pointers to the audio and video 'samples'. If the fragment of the mp4 file you have does not have the moov atom, your job would be much more complicated. You'd have to develop logic to examine the 'mdat' atom (which contains all the audio and video samples) and use educated guesses to find the audio and video boundaries.
Even worse, without the moov atom, you won't have the SPS and PPS needed to decode the slices. You'd have to synthesize replacements; if you know the codec used to create the MP4, then you might be able to copy the SPS and PPS from a similarly encoded file; if not, it could be a painful process of trial and error, because the syntax of the slices (the H.264 encoded pictures) is dependent upon values specified in the SPS and PPS.