如何分析文件并检测文件是否为H.264视频格式? [英] How can I analyze file and detect if the file is in H.264 video format?

查看:167
本文介绍了如何分析文件并检测文件是否为H.264视频格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了C/C ++软件来恢复已删除的文件,并且需要根据文件的二进制内容识别文件,所以我的问题是有一种简单的方法来知道特定文件是否为H.264格式的视频吗?H.264有签名吗?

I write software C/C++ to recover deleted files, and I need to identify files according to their binary content, so my question is there a simple way to know if a particular file is H.264 format video? is H.264 has an signature?

我在此处看到了FFMPEG的代码,但这可以帮助我吗?

I saw the code of FFMPEG here, but can it help me, how?

推荐答案

问题是H.264不是文件格式,它是视频压缩标准,因此可以在多种文件格式中找到.使用H.264编码的.f4v可以和使用H.264编码的.mp4一样多.

The problem is that H.264 is not a file format, it is a video compression standard, and as such it can be found in multiple file formats. You can have a .f4v encoded with H.264 as much as you can have .mp4 with H.264.

那么,您如何解决您的问题?好吧,我强烈建议您使用可以为您完成此任务的库.例如, libavformat 应该可以解决问题(请检查 AVStream AVFormatContext 结构,以及 avformat_open_input 函数).

So, how do you solve your issue? Well, I strongly advise you to use a library that does that for you. libavformat, for example, should do the trick (check the AVStream and AVFormatContext structures, and the avformat_open_input function).

现在,如果您绝对要在没有库的情况下进行操作,则可以查看每个视频容器的文档格式,该格式支持H.264,以查看如何检索视频流的编码信息,但这种方法至少会花费您一两个月的时间.

Now, if you absolutely want to do it without libraries, you can check out the documentation for each video container format that supports H.264 to see how to retrieve the encoding information of the video stream, but expect this to take you at least a month or two.

这篇关于如何分析文件并检测文件是否为H.264视频格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆