I have noticed that the file command in linux, is detecting this mpg as data?
http://www.berkut13.com/videos/brakeup.mpg
it detects flv ok but this mpg file it doesn't..
i'd like to be able to detect mpg files.
I found the part of the magic file for MPEG..
# MPEG file
# MPEG sequences
# FIXME: This section is from the old magic.mime file and needs integrating with the rest
0 belong 0x000001BA
>4 byte &0x40
!:mime video/mp2p
>4 byte ^0x40
!:mime video/mpeg
0 belong 0x000001BB
!:mime video/mpeg
0 belong 0x000001B0
!:mime video/mp4v-es
0 belong 0x000001B5
!:mime video/mp4v-es
0 belong 0x000001B3
!:mime video/mpv
0 belong&0xFF5FFF1F 0x47400010
!:mime video/mp2t
0 belong 0x00000001
>4 byte&0x1F 0x07
!:mime video/h264
and the file
$ xxd -p brakeup.mpg | head -n 1
000001ba2100010001800e3b000001bb000c800e3b07e1ffc0c020e0e02e
$ od -x brakeup.mpg | head -n 2
0000000 0000 ba01 0021 0001 8001 3b0e 0000 bb01
0000020 0c00 0e80 073b ffe1 c0c0 e020 2ee0 0000
The file
command uses a list of file definitions in a magic file (usually /usr/share/file/magic on linux systems, or /etc/magic on Unix).
Most of the entries in that file are just 'magic' numbers: the file command matches the first few bytes of a file against these entries to identify the file.
Try adding these definitions from this example magic file:
#------------------------------------------------------------------------------
# animation: file(1) magic for animation/movie formats
#
# animation formats
# MPEG, FLI, DL originally from vax@ccwf.cc.utexas.edu (VaX#n8)
# FLC, SGI, Apple originally from Daniel Quinlan (quinlan@yggdrasil.com)
# MPEG animation format
0 belong 0x000001b3 MPEG video stream data
#>4 beshort&0xfff0 x (%d x
#>5 beshort&0x0fff x %d)
0 belong 0x000001ba MPEG system stream data
Your brakeup.mpg file begins with 00,00,01,ba
so the file command should identify it as MPEG system data at least.
On Ubuntu-based linux distributions, the /usr/share/file/magic already has definitions that will identify that MPG file as:
brakeup.mpg: MPEG sequence, v1, system multiplex
User contributions licensed under CC BY-SA 3.0