ffprobe
de FFmpeg pode fazer isso:
ffprobe -show_format foo.avi
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video.
Alguém sabe de uma ferramenta que me permita obter as propriedades de qualquer arquivo de mídia, de uma maneira parseable? Algo parecido com o que o "identificador" do ImageMagick faz para imagens:
$ identify libre.jpg
libre.jpg JPEG 512x512 512x512+0+0 8-bit DirectClass 102KB 0.010u 0:00.009
Uma biblioteca Perl, Ruby ou Python também funcionaria.
ffprobe
de FFmpeg pode fazer isso:
ffprobe -show_format foo.avi
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video.
Você pode usar file
, mas não é realmente consistente:
$ file test.avi
test.avi: RIFF (little-endian) data, AVI, 800 x 600, 25.00 fps, video:
$ file test.mpg
test.mpg: MPEG sequence, v1, system multiplex
Via Propriedades do arquivo de vídeo na linha de comando? - FedoraForum.org (também linha de comando - CLI: extrair metadados, propriedades de arquivos de vídeo - Ask Ubuntu - tem MediaInfo , que tem uma saída mais consistente:
$ mediainfo test.avi
General
Complete name : test.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 202 MiB
Duration : 26s 480ms
Overall bit rate : 64.1 Mbps
Writing application : Lavf52.64.2
Video
ID : 0
Format : FFVH
Codec ID : FFVH
Duration : 26s 480ms
Bit rate : 64.1 Mbps
Width : 800 pixels
Height : 600 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Bits/(Pixel*Frame) : 5.338
Stream size : 202 MiB (100%)
$ mediainfo test.mpg
General
Complete name : test.mpg
Format : MPEG-PS
File size : 2.22 MiB
Duration : 26s 480ms
Overall bit rate mode : Variable
Overall bit rate : 704 Kbps
Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 1
Format settings, BVOP : No
Format settings, Matrix : Default
Format settings, GOP : N=12
Duration : 26s 480ms
Bit rate mode : Variable
Bit rate : 690 Kbps
Width : 800 pixels
Height : 600 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Color space : YUV
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.058
Stream size : 2.18 MiB (98%)
Finalmente, Identifique rapidamente os atributos dos arquivos de vídeo | SavvyAdmin.com também menciona:
Aqui está a saída de exiftool
para os mesmos arquivos acima:
$ exiftool test.avi
ExifTool Version Number : 8.15
File Name : test.avi
Directory : .
File Size : 202 MB
File Modification Date/Time : 2013:09:10 16:45:02+02:00
File Permissions : rw-r--r--
File Type : AVI
MIME Type : video/avi
Frame Rate : 25
Max Data Rate : 24.41 kB/s
Frame Count : 662
Stream Count : 1
Stream Type : Video
Video Codec : FFVH
Video Frame Rate : 25
Video Frame Count : 662
Quality : Default
Sample Size : Variable
Image Width : 800
Image Height : 600
Planes : 1
Bit Depth : 12
Compression : FFVH
Image Length : 1440000
Pixels Per Meter X : 0
Pixels Per Meter Y : 0
Num Colors : Use BitDepth
Num Important Colors : All
Software : Lavf52.64.2
Duration : 26.48 s
Image Size : 800x600
$ exiftool test.mpg
ExifTool Version Number : 8.15
File Name : test.mpg
Directory : .
File Size : 2.2 MB
File Modification Date/Time : 2013:09:12 14:02:36+02:00
File Permissions : rw-r--r--
File Type : MPEG
MIME Type : video/mpeg
Image Width : 800
Image Height : 600
Aspect Ratio : 1:1
Frame Rate : 25 fps
Video Bitrate : Variable
Image Size : 800x600
Tags command-line media linux