How IT

언제든지 물어보세요.

컨텐츠로 건너뛰기
  • 홈
  • Unix
  • Apple
  • Java
  • Android
  • C#
  • C++

Mac OS X의 비디오에 대한 정보와 유사한 명령이 있습니까? 이 있습니다. 명령

Mac OS X에는 afinfo오디오 파일 정보를 가져 오는 명령 이 있습니다. 명령 이외의 비디오 ( .mov, .m4v)에 대한 비디오 파일 정보를 가져 오는 비슷한 명령이 mdls있습니까?



답변

OS X 자체에는 없습니다.

MediaInfo 명령 행 인터페이스를 다운로드 할 수 있습니다 (x64 아래의 “CLI”링크 참조). 패키지의 Homebrew 를 통해서도 이용할 수 있습니다 media-info.

샘플 터미널 사용법 :

$ mediainfo myMovie.mov

비디오의 경우 다음과 같은 출력을 생성합니다.

Format                                   : MPEG-4
Format profile                           : QuickTime
Format settings                          : Compressed header
Codec ID                                 : qt
File size                                : 12.1 MiB
Duration                                 : 2mn 27s
Overall bit rate mode                    : Variable
Overall bit rate                         : 689 Kbps
Encoded date                             : UTC 2006-06-13 06:43:09
Tagged date                              : UTC 2006-06-13 06:43:12
Writing library                          : Apple QuickTime

Video #1
ID                                       : 2
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L2.1
Format settings, CABAC                   : No
Format settings, ReFrames                : 2 frames
Format settings, GOP                     : M=2, N=24
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 2mn 23s
Source duration                          : 2mn 23s
Bit rate mode                            : Variable
Bit rate                                 : 569 Kbps
Maximum bit rate                         : 770 Kbps
Width                                    : 320 pixels
Height                                   : 240 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 24.975 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.297
Stream size                              : 9.74 MiB (80%)
Source stream size                       : 9.74 MiB (80%)
Language                                 : English
Encoded date                             : UTC 2006-06-13 06:18:04
Tagged date                              : UTC 2006-06-13 06:43:12
Color primaries                          : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Transfer characteristics                 : BT.709-5, BT.1361
Matrix coefficients                      : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M


답변

범용 파일 메타 데이터 유틸리티 인 mdls builtin 명령을 사용하여 많은 정보를 얻을 수 있습니다. 비디오 파일뿐만 아니라 모든 유형의 파일에 적용됩니다. “정보 입수”메뉴 명령을 사용할 때 파인더가 사용하는 유틸리티입니다.

다음은 forest.mp4라는 mp4 파일의 명령을 사용할 때 얻을 수있는 출력의 일부입니다.

$mdls forest.mp4
kMDItemCodecs                  = (
    "H.264"
)
kMDItemContentCreationDate     = 2014-10-17 05:08:09 +0000
kMDItemContentModificationDate = 2014-10-17 05:08:09 +0000
kMDItemContentType             = "public.mpeg-4"
kMDItemContentTypeTree         = (
    "public.mpeg-4",
    "public.movie",
    "public.audiovisual-content",
    "public.data",
    "public.item",
    "public.content"
)
kMDItemDateAdded               = 2016-01-11 20:30:01 +0000
kMDItemDisplayName             = "forest.mp4"
kMDItemDownloadedDate          = (
    "2014-12-08 15:11:56 +0000"
)
kMDItemDurationSeconds         = 29.96166666666667
kMDItemFSContentChangeDate     = 2014-10-17 05:08:09 +0000
kMDItemFSCreationDate          = 2014-10-17 05:08:09 +0000
kMDItemFSCreatorCode           = ""
kMDItemFSFinderFlags           = 0
kMDItemFSHasCustomIcon         = (null)
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 0
kMDItemFSIsStationery          = (null)
kMDItemFSLabel                 = 0
kMDItemFSName                  = "forest.mp4"
kMDItemFSNodeCount             = (null)
kMDItemFSOwnerGroupID          = 20
kMDItemFSOwnerUserID           = 501
kMDItemFSSize                  = 45363721
kMDItemFSTypeCode              = ""
kMDItemKind                    = "MPEG-4 Movie"
kMDItemLogicalSize             = 45363721
kMDItemMediaTypes              = (
    Video
)
kMDItemPhysicalSize            = 45367296
kMDItemPixelHeight             = 1080
kMDItemPixelWidth              = 1920
kMDItemStreamable              = 0
kMDItemTotalBitRate            = 12110
kMDItemVideoBitRate            = 12110

또한 나열하려는 속성을 지정할 수 있습니다. 예를 들어 영화의 지속 시간 만 가져 오려면

$ mdls -name kMDItemDurationSeconds forest.mp4
kMDItemDurationSeconds = 29.96166666666667


답변

도움이된다면 특정 디렉토리에있는 모든 MP4의 파일 이름과 길이를 출력하는 작은 스크립트가 있습니다.

#! /bin/bash
# get video length of file.
for MP4 in `ls *mp4`
do
    echo "\"$MP4\",\c"
    mediainfo $MP4 | grep "^Duration" | head -1 | sed 's/^.*: \([0-9][0-9]*\)mn *\([0-9][0-9]*\)s/00:\1:\2/'
done
# END

파일 이름에 공백이 있으면 작동하지 않습니다. 비디오가 1 시간 이상이면 REGEXP를 조정하십시오.


답변

을 사용하는 것보다 약간 개선되었습니다 mediainfo.

jq( brew install jq) 이 필요 하고의 JSON 출력을 사용해야합니다.mediainfo

그럼 당신은 독립 실행 형 스크립트로 사용하거나에 넣어 수 있습니다 ~/.bashrc또는 ~/.zshrc:

    #!/bin/bash

    IFS=$'\n'

    # accepts any list of files, eg. video_times *.{mp4,mov}
    video_times() {
        for file in $* ; do
            duration=$(mediainfo --Output=JSON "$file" | jq -r '.media.track[] | select(."@type"=="General") | .Duration | tonumber | floor')
            minutes=$(($duration / 60))
            seconds=$(($duration % 60))
            echo "$file: ${minutes}m${seconds}s"
        done
    }

    video_times $*


답변


이 글은 Superuser 카테고리에 분류되었고 macos, metadata, video 태그가 있으며 소장 마님에 의해 2022-07-12에 작성되었습니다.

글 네비게이션

← Word 2013에서“그림 변경”단추가 누락되거나 비활성화 된 이유는 무엇입니까? 그러나 다음 끓는 다른 냄비에 계란을 끓일 수 있습니까? 것을 알고 있습니다. 그러나 나는 살모넬라가 →

태그

  • android
  • apt
  • bash
  • boot
  • c#
  • c++
  • code-golf
  • command-line
  • debian
  • firefox
  • git
  • google-chrome
  • hard-drive
  • html
  • java
  • keyboard
  • linux
  • mac
  • macos
  • math
  • memory
  • microsoft-excel
  • mysql
  • networking
  • performance
  • permissions
  • python
  • r
  • regression
  • security
  • shell
  • sql-server
  • ssh
  • string
  • terminal
  • ubuntu
  • unity
  • usb
  • vim
  • virtualbox
  • windows
  • windows-7
  • windows-8
  • windows-10
  • windows-xp

최신 글

  • Windows에서 파티션 크기를 조정 한 후 APFS 파티션이 손실 됨 00 80
  • App Store에서 El Capitan을 강제로 다시 다운로드 하시겠습니까? 업데이트 된 플래시 드라이브 설치 프로그램을 빌드하기
  • 기존 시스템에 부팅 드라이브로 SSD 추가 백업에 큰 관심이 없습니다. 내가 걱정하는 것은이
  • geoJSON featureCollection에 properties 요소를 갖는 것이 유효합니까?
  • 추세를 식별하기 위해 신호 처리 원리를 신중하게 사용 매우 시끄러운 장기 데이터에서 추세를

카테고리

  • Android
  • Apple
  • C#
  • C++
  • cooking
  • cs
  • cstheory
  • diy
  • drupal
  • electronics
  • emacs
  • Gis
  • Git
  • Html
  • Java
  • Javascript
  • magento
  • photo
  • Python
  • raspberrypi
  • scicomp
  • Server
  • Software
  • Sql
  • stats
  • Superuser
  • ubuntu
  • Unix
  • vi
  • webapps
  • webmasters
  • wordpress
  • 게임개발
  • 코딩
Proudly powered by WordPress
Go to mobile version
Close