检测mp4文件 [英] Detect mp4 files

查看:150
本文介绍了检测mp4文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须设计一个检测 mp4 文件的模块.如果将获取任何随机文件作为输入,则必须告诉它是否是mp4文件.在哪里可以找到mp4文件头的规范?尝试使用谷歌搜索,但除签名外找不到任何其他内容.关于该模块的C编程还有其他技巧吗?

I have to design a module that detects mp4 files. If will get any random file as input and it has to tell whether it is a mp4 file or not. Where can I find the specification of headers for the mp4 file? Tried googling but could not find anything except the signature. Any other tips regarding C programming for the module?

推荐答案

您可以检查扩展名或文件签名(幻数)

you can check the extension or the file signature (magic number)

http://www.garykessler.net/library/file_sigs.html

http://en.wikipedia.org/wiki/List_of_file_signatures

00 00 00 18 66 74 79 70 33 67 70 35 .... ftyp 3gp5 MPEG-4视频文件

00 00 00 18 66 74 79 70 33 67 70 35 ....ftyp 3gp5 MPEG-4 video files

或者,如果您使用的是Unix/Linux,则可以解析文件的输出(1)来自您的程序.

Or if you're on Unix/Linux you can parse the output of file(1) from your program.

您无需扫描整个文件即可识别它,签名即可,但是,如果需要的话,请注意MP4是其他格式的容器,这意味着您可以可能还需要了解MP4及其包含的其他格式,这里有一些信息: http://en.wikipedia.org/wiki/MPEG-4_Part_14

You don't need to scan the whole file to identify it, the signature will do, however, if you have to, note that MP4 is a container for other formats, which means you will probably need to know about MP4 and other formats it contains as well, there's some information here: http://en.wikipedia.org/wiki/MPEG-4_Part_14

我会使用类似 libffmpeg 之类的方法来实现.

I'd use something like libffmpeg to do that instead.

这篇关于检测mp4文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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