Script: video identification (Bash)

This script displays mplayer's information/identification lines of a multimedia file. Nowadays I prefer to use an undocumented feature of vcs (see below)

#!/bin/bash

# This script displays mplayer's information/identification lines of a multimedia file
# Put in the public domain. <http://w.corvera.eu/2007/11/shell-vidid/>

vididf() {
        mplayer -identify -frames 0 -ao null -vo null "$1" 2>/dev/null | grep ID_ | sort
}

for F in "$@"; do vididf "$F" ; done

Example:

$ vidid file.avi

ID_AUDIO_BITRATE=160000
ID_AUDIO_BITRATE=160000
ID_AUDIO_CODEC=mp3
ID_AUDIO_FORMAT=85
ID_AUDIO_ID=1
ID_AUDIO_NCH=0
ID_AUDIO_NCH=2
ID_AUDIO_RATE=0
ID_AUDIO_RATE=48000
ID_DEMUXER=avi
ID_FILENAME=file.avi
ID_LENGTH=2569.52
ID_VIDEO_ASPECT=0.0000
ID_VIDEO_BITRATE=1223960
ID_VIDEO_CODEC=ffodivx
ID_VIDEO_FORMAT=XVID
ID_VIDEO_FPS=25.000
ID_VIDEO_HEIGHT=360
ID_VIDEO_ID=0
ID_VIDEO_WIDTH=640
VCS version:
$ vcs -Z idonly somefile.avi
[...]
=========== Mplayer Identification ===========
Length: 42:39.52
Video
    Codec: XVID (Xvid (MPEG-4))
    Dimensions: 704x396
    FPS: 23.976
    Aspect:
Audio
    Codec: 85 (MPEG Layer III (MP3))
    Channels: 2
==============================================

=========== FFmpeg Identification ===========
Length: 42:39.51
Video
    Codec: mpeg4 (MPEG-4)
    Dimensions: 704x396
    FPS: 23.98
    Aspect: 16/9
Audio
    Codec: mp3 (MPEG Layer III (MP3))
    Channels: 2
=============================================

=========== Combined Identification ===========
Length: 42:38.01
Video
    Codec: XVID (Xvid (MPEG-4))
    Dimensions: 704x396
    FPS: 23.976
    Aspect: 16/9 (1.7778)
Audio
    Codec: 85 (MPEG Layer III (MP3))
    Channels: 2
=============================================

Discover more from OutlyerNet

Subscribe to get the latest posts to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top