命令在终端中查看媒体文件信息?
我需要一个命令来快速查看有关音频或video文件的终端基本信息。
(然后我会考虑将其添加到Thunar的自定义操作等)
包libav-tools
非常好。
示例输出avprobe somefile.mp4
avprobe version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2007-2012 the Libav developers built on Nov 6 2012 16:51:33 with gcc 4.6.3 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'somefile.mp4': Metadata: major_brand : avc1 minor_version : 0 compatible_brands: isomavc1 creation_time : 2012-08-10 15:01:14 Duration: 00:01:02.55, start: 0.000000, bitrate: 682 kb/s Stream #0.0(und): Video: h264 (High), yuv420p, 1904x1040 [PAR 1:1 DAR 119:65], 680 kb/s, 19.18 fps, 20 tbr, 20 tbn, 40 tbc Metadata: creation_time : 2012-08-10 15:01:14
要添加到Thunar自定义操作,与此处建议的相关,要添加的模拟公式为:
gnome-terminal --window-with-profile=new1 -e "avprobe %f"
我使用mediainfo
来获取媒体文件的所有属性(音频和video文件)
root@server:Videos::08:47 PM# mediainfo Vazquez.mp4 General Complete name : Vazquez.mp4 Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 File size : 103 MiB Duration : 3mn 52s Overall bit rate mode : Variable Overall bit rate : 3 730 Kbps Encoded date : UTC 2011-11-10 07:30:57 Tagged date : UTC 2011-11-10 07:30:57 gsst : 0 gstd : 232083 gssd : B7AA66E45HH1322313268839354 gshh : oo.preferred.bhartibb-blr1.v12.lscache7.c.youtube.com Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.0 Format settings, CABAC : Yes Format settings, ReFrames : 1 frame Format settings, GOP : M=1, N=24 Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 3mn 52s Bit rate : 3 576 Kbps Maximum bit rate : 5 947 Kbps Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 24.000 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.072 Stream size : 98.9 MiB (96%) Tagged date : UTC 2011-11-10 07:30:58 Audio ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : 40 Duration : 3mn 52s Bit rate mode : Variable Bit rate : 152 Kbps Maximum bit rate : 188 Kbps Channel(s) : 2 channels Channel positions : Front: LR Sampling rate : 44.1 KHz Compression mode : Lossy Stream size : 4.20 MiB (4%) Title : IsoMedia File Produced by Google, 5-11-2011 Encoded date : UTC 2011-11-10 07:30:58 Tagged date : UTC 2011-11-10 07:30:58
mediainfo
现在位于Ubuntu存储库中,可以通过运行来安装
sudo apt install mediainfo
以前有必要使用PPA,但是目前的Ubuntu版本没有包。
exiftool
这可能是一个惊喜,但来自libimage-exiftool-perl的exiftool 也有这种能力。
它支持显示来自许多媒体文件格式的信息 ,并且也可以为某些格式编写元数据。
音频文件的输出示例:
# exiftool The\ Police\ -\ Live\!\ Disc\ 2\ -\ Atlanta\ -\ 01.\ Synchronicity\ I.mp3 ExifTool Version Number : 9.13 File Name : The Police - Live! Disc 2 - Atlanta - 01. Synchronicity I.mp3 Directory : . File Size : 3.9 MB File Modification Date/Time : 2012:03:23 19:44:23+01:00 File Access Date/Time : 2012:12:26 11:44:38+01:00 File Inode Change Date/Time : 2012:03:23 19:44:23+01:00 File Permissions : rw------- File Type : MP3 MIME Type : audio/mpeg MPEG Audio Version : 1 Audio Layer : 3 Sample Rate : 44100 Channel Mode : Joint Stereo MS Stereo : On Intensity Stereo : Off Copyright Flag : False Original Media : True Emphasis : None VBR Frames : 6660 VBR Bytes : 4044318 VBR Scale : 57 Encoder : LAME3.96 Lame VBR Quality : 4 Lame Quality : 3 Lame Method : VBR (old/rh) Lame Low Pass Filter : 18 kHz Lame Bitrate : 32 kbps Lame Stereo Mode : Joint Stereo Track : 1/15 Disc : 2/2 Artist : The Police Title : Synchronicity I Album : Live! Year : 2003 Genre : Rock Comment : Atlanta Discid : c611270f ID3 Size : 128 Audio Bitrate : 186 kbps Date/Time Original : 2003 Duration : 0:02:53 (approx)
根据您认为必要的内容 ,您可能希望使用file
实用程序,它提供有关任何文件的一般信息。 它的主要目的是告诉你你有什么类型的文件,但它可以提供你需要的详细程度。
$ file '01 - Nina Simone - Mood Indigo.mp3' 01 - Nina Simone - Mood Indigo.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo
但是,如果你需要知道标签的内容 – 标题,艺术家等 – file
不会告诉你。
我知道这个命令: avconv -i
对于myfile.flv: avconv -i myfile.flv
我的想法是将该命令添加到Thunar的自定义操作 ,只需从上下文菜单运行它,无论扩展名如何。 但它必须在终端运行,所以我看了看这个答案 。 (要打开终端并保持打开状态,我在gnome-terminal(编辑/配置文件)中创建了一个名为“new1”的新配置文件,并在配置文件首选项/“标题和命令”下设置“当命令退出”时“保持终端开放“。)
最后(通过反复试验)我想出了这个:
gnome-terminal --window-with-profile=new1 -e "avconv -i %f"
哪个工作放在Thunar的自定义操作中 – 并且应该适用于任何媒体文件。
音频文件也有以下内容,但可能与exiftool不能很好地竞争:
id3v2 -l soxi
soxi也支持video文件。
id3v2 和sox 包(可以通过单击这些链接安装)提供这些命令。 它们也可以安装在软件中心 ,或运行:
sudo apt-get install sox sudo apt-get install id3v2
一个例子 : id3v2 -l 'Beatles - Here Comes The Sun.mp3'
输出:
id3v1 tag info for Beatles - Here Comes The Sun.mp3: Title : Here Comes The Sun Artist: Beatles Album : Abbey Road Year: 1969, Genre: Pop (13) Comment: Track: 7 id3v2 tag info for Beatles - Here Comes The Sun.mp3: TIT2 (Title/songname/content description): Here Comes The Sun TYER (Year): 1969 TPUB (Publisher): Capitol TCON (Content type): Pop (13) TALB (Album/Movie/Show title): Abbey Road PRIV (Private frame): (unimplemented) PRIV (Private frame): (unimplemented) TRCK (Track number/Position in set): 7 PRIV (Private frame): (unimplemented) PRIV (Private frame): (unimplemented) PRIV (Private frame): (unimplemented) PRIV (Private frame): (unimplemented) TPE2 (Band/orchestra/accompaniment): The Beatles PRIV (Private frame): (unimplemented) PRIV (Private frame): (unimplemented) PRIV (Private frame): (unimplemented) TCOM (Composer): George Harrison TPE1 (Lead performer(s)/Soloist(s)): Beatles