비디오 세트 (mp4)의 메타 데이터 (길이, 해상도 등)를 파일로 에코하려는 bash 스크립트를 작성 중입니다.
MP4 파일에서이 정보를 얻는 간단한 방법이 있습니까?
답변
데비안 기반 시스템에서 (아마도 다른 배포판에도 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
답변
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
답변
FFmpeg 프로젝트로 이를 수행 할 수 있습니다 .
ffprobe 'Breaking The Girl-EVmfXA3vjuE.mp4'
결과:
'Breaking The Girl-EVmfXA3vjuE.mp4'에서 입력 # 0, mov, mp4, m4a, 3gp, 3g2, mj2 :
메타 데이터 :
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], 200kb / s, 25fps, 25tbr, 90k tbn, 50tbc (기본값)
메타 데이터 :
creation_time : 2016-10-05T03 : 35 : 07.000000Z
handler_name : Google Inc.에서 제작 한 ISO 미디어 파일
스트림 # 0 : 1 (und) : 오디오 : aac (LC) (mp4a / 0x6134706D), 44100Hz, 스테레오, fltp,
125kb / s (기본값)
메타 데이터 :
creation_time : 2016-10-05T03 : 35 : 07.000000Z
handler_name : Google Inc.에서 제작 한 ISO 미디어 파일