从终端中的视频中提取元数据


Answers:


27

在基于Debian的系统上(但大概其他发行版也将mediainfo在其存储库中提供):

$ sudo apt-get install mediainfo
$ mediainfo foo.mp4

那会散发出很多信息。例如,要获取长度,分辨率,编解码器和尺寸,请使用:

$ $ mediainfo "The Blues Brothers.mp4" | grep -E 'Duration|Format  |Width|Height' | sort | uniq
Duration                                 : 2h 27mn
Format                                   : AAC
Format                                   : AVC
Format                                   : MPEG-4
Height                                   : 688 pixels
Width                                    : 1 280 pixels

22

您可以使用exiftool。要安装它,请运行:

sudo apt-get install libimage-exiftool-perl

然后从mp4文件中获取元数据:

exiftool video_file.mp4 > medatata.txt

保存在文件中的输出应如下所示:

ExifTool Version Number         : 9.60
File Name                       : video_file.mp4
Directory                       : .
File Size                       : 11 MB
File Modification Date/Time     : 2014:05:12 21:25:11+03:00
File Access Date/Time           : 2014:05:20 23:05:35+03:00
File Inode Change Date/Time     : 2014:05:12 21:25:11+03:00
File Permissions                : rw-r--r--
File Type                       : MP4
MIME Type                       : video/mp4
Major Brand                     : MP4 v2 [ISO 14496-14]
Minor Version                   : 0.0.0
Compatible Brands               : isom, mp42
Movie Header Version            : 0
Create Date                     : 2014:04:24 05:33:58
Modify Date                     : 2014:04:24 05:33:58
Time Scale                      : 600
Duration                        : 0:03:10
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 3
Track Header Version            : 0
Track Create Date               : 0000:00:00 00:00:00
Track Modify Date               : 2014:04:24 05:33:59
Track ID                        : 1
Track Duration                  : 0:03:10
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 450
Image Height                    : 360
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 450
Source Image Height             : 360
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Buffer Size                     : 19318
Max Bitrate                     : 1059760
Average Bitrate                 : 396688
Video Frame Rate                : 25
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2014:04:24 05:33:58
Media Modify Date               : 2014:04:24 05:33:59
Media Time Scale                : 44100
Media Duration                  : 0:03:10
Media Language Code             : und
Handler Description             : IsoMedia File Produced by Google, 5-11-2011
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 44100
Handler Type                    : Metadata
Handler Vendor ID               : Apple
Google Start Time               : 0
Google Track Duration           : 191006
Google Source Data              : B567F7685HH1399919109001385
Google Ping URL                 : 
Google Ping Message             : 
Google Host Header              : r2---sn-gqn-vhge.googlevideo.com
Movie Data Size                 : 11755744
Movie Data Offset               : 60204
Avg Bitrate                     : 493 kbps
Image Size                      : 450x360
Rotation                        : 0

1
在OS X上,如果已安装Homebrew软件包管理器,则homebrew install exiftool' and it will be compiled by perl and become available the same way, as exiftool video_file.mp4> medatata.txt`
HongPong

8

您可以使用FFmpeg项目执行此操作:

ffprobe 'Breaking The Girl-EVmfXA3vjuE.mp4'

结果:

输入#0,mov,mp4,m4a,3gp,3g2,mj2,来自“ Breaking the Girl-EVmfXA3vjuE.mp4”:
  元数据:
    major_brand:mp42
    minor_version:0
    compatible_brands:isommp42
    creation_time:2016-10-05T03:35:07.000000Z
  持续时间:00:04:55.38,开始:0.000000,比特率:330 kb / s
    流#0:0(und):视频:h264(Main)(avc1 / 0x31637661),yuv420p(tv,bt709),
      1280x720 [SAR 1:1 DAR 16:9],200 kb / s,25 fps,25 tbr,90k tbn,50 tbc(默认)
    元数据:
      creation_time:2016-10-05T03:35:07.000000Z
      handler_name:Google Inc.制作的ISO媒体文件。
    流#0:1(und):音频:aac(LC)(mp4a / 0x6134706D),44100 Hz,立体声,fltp,
      125 kb / s(默认)
    元数据:
      creation_time:2016-10-05T03:35:07.000000Z
      handler_name:Google Inc.制作的ISO媒体文件。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.