Detect and distinguish avi and wav

Peter Volz 1,295 Reputation points
2023-06-08T03:21:51.7066667+00:00

Hello all

According to this table, AVI and WAV part:

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

I have the initial 12 bytes of the file:

Case InputByte.Take(12).SequenceEqual({&Hxx, &Hxx, &Hxx, &Hxx, &Hxx, &Hxx, &Hxx, &Hxx, &Hxx, &Hxx, &Hxx, &Hxx})

wav:

52 49 46 46 ?? ?? ?? ??

57 41 56 45

avi:

52 49 46 46 ?? ?? ?? ??

41 56 49 20

no idea how to correctly check against my bytes :(

Anyone knows?

Developer technologies | VB
Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 122.6K Reputation points
    2023-06-08T03:37:43.4266667+00:00

    Try something like this for .wav:

    Case InputByte.Take(4).SequenceEqual({&H52, &H49, &H46, &H46}) AndAlso InputByte.Skip(8).Take(4).SequenceEqual({&H57, &H41, &H56, &H45})
    

    Make sure that the length of the file is greater than 12.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.