O formato do arquivo no terminal

0

Como sabemos o formato de um arquivo diretamente no terminal? Alguém poderia me dar algum conselho?

    
por Ruixue Sun 22.06.2017 / 11:33

1 resposta

4

Mais comum:

$ file mediafile.mkv
mediafile.mkv: Matroska data

$ file ~/.bashrc
/home/users/l/j/ljames/.bashrc: ASCII text

$ file /usr/bin/passwd
/usr/bin/passwd: setuid ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=84a7c6f14ce2ce87570911abd85e19ea45b6754b, stripped

$ file /usr/bin/java
/usr/bin/java: symbolic link to /etc/alternatives/java

$ file /etc/alternatives/java
/etc/alternatives/java: symbolic link to /usr/lib/jvm/java-8-oracle/jre/bin/java

$ file /usr/lib/jvm/java-8-oracle/jre/bin/java
/usr/lib/jvm/java-8-oracle/jre/bin/java: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.9, BuildID[sha1]=c90f19ee0af98c47ccaa7181853cfd14867bc931, not stripped

Para mídia, você pode obter mais detalhes sobre o formato com essas variações de comando:

$ identify ~/.bashrc
identify-im6.q16: no decode delegate for this image format '' @ error/constitute.c/ReadImage/504.

$ mediainfo mediafile.mkv 
General
Unique ID                                : 158129335275244501904084975368798538245 (0x76F69A29135BD58AE99798A804250A05)
Complete name                            : mediafile.mkv
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 64.9 MiB
Writing application                      : Lavf56.40.101
Writing library                          : Lavf56.40.101 / Lavf56.40.101
IsTruncated                              : Yes

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 5 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 59.940 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 148 r2643 5c65704
Encoding settings                        : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=123 / keyint_min=20 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=22.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Default                                  : Yes
Forced                                   : No

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Bit rate mode                            : Constant
Bit rate                                 : 384 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Frame rate                               : 31.250 fps (1536 spf)
Compression mode                         : Lossy
Delay relative to video                  : -367ms
Language                                 : English
Default                                  : Yes
Forced                                   : No

$ file image.png
image.png: PNG image data, 382 x 279, 8-bit/color RGBA, non-interlaced

$ identify image.png
image.png PNG 382x279 382x279+0+0 8-bit sRGB 52.2KB 0.000u 0:00.000

$ mediainfo image.png
General
Complete name                            : image.png
Format                                   : PNG
Format/Info                              : Portable Network Graphic
File size                                : 51.0 KiB

Image
Format                                   : PNG
Format/Info                              : Portable Network Graphic
Width                                    : 382 pixels
Height                                   : 279 pixels
Bit depth                                : 32 bits
Compression mode                         : Lossless
Stream size                              : 51.0 KiB (100%)

Nota:

O comando identify pode levar muito tempo para analisar um arquivo de mídia antes que ele seja gerado. Os detalhes de saída também podem preencher várias telas.

Atualizar

Eu listei algumas ferramentas muito comuns para verificar as informações e os formatos dos arquivos. Uma ferramenta muito comum do repositório é exiftool . Ele fornecerá detalhes muito abrangentes sobre o formato dos arquivos de mídia.

    
por L. D. James 22.06.2017 / 11:54