开发者

Determine if an .iso is actually a video/movie in C#

I'm in a situation where I'd like to, using C#, look at .iso files that are in a directory and determine if they are indeed video discs (DVD/BD or similar).

I don't need to actually distinguish the type, just a blanket "yes this is a video disc". I开发者_StackOverflows there a way to do this?


the ISO file is actually a CD Image in file format. The easiest way to determine what is on it is to mount it with a Virtual CD program. Or you can look at the file contents.

Here is the Specifications for ISO files http://users.telenet.be/it3.consultants.bvba/handouts/ISO9960.html

After you are able to determine what information is on the disk then you can determine if there is video information on it by finding out what the contents of those files are.

That is a much more daunting task then just determining the file structure.

This specification file will only define ISO files. Other cd formats will need to be read using their own Specifications...

You can determine if the file is of type ISO using the header data

Here is a Stack Question explaining in a little more detail.

Using .NET, how can you find the mime type of a file based on the file signature not the extension

EDIT

Looking into the Mime type thing a little more reveals that Microsoft will have to have a registered mime type for that header data. It may not know that it is an ISO and may tell you application/octet-stream If this is the case then you can instead use your own judgement with the same first 256 bytes. Determine some things that tell you that it is an ISO file that you can handle. Usually you can tell what type and version a file is with the first 20 bytes or so.


I did some searching around for a library that you could use to read/write ISO files. You just need the read part obviously and this project is something you could probably use http://discutils.codeplex.com/


As another mentioned, an ISO file contains a file system. The easiest way to read it is to mount it as a virtual drive, using any one of a number of utilities. Once you've mounted it as a drive, then you can determine that it likely contains a movie by inspecting the file system (i.e. using Directory.GetFiles and similar methods in C#).

If you want to read the file's contents directly (without mounting it), I'm not sure what to tell you. I've heard that 7-zip has an API that will let you read the files. You might also check out DiscUtils, which claims to be able to read ISO files.

Once you can read the contents of the file system, see the "Filesystem" section of http://en.wikipedia.org/wiki/DVD-Video. That will tell you what files and directories you should expect to see in the ISO of a DVD movie.

Note that the files' existence is an indication that the image probably contains a DVD movie. There's no way to tell for sure without examining the files' contents individually. Tracking down the specifications for the individual file types might be a more difficult task.


try using IMAPIv2 to interrogate the iso.

This link doesnt do that.. but it should get you started in the right direction.

How to create optical ISO using IMAPIv2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜