I use mediainfo at the moment.
It's too detailed
$ mediainfo vine.mp4 | wc -l
66
I wish a command with only short summary. 6 lines of output.
I use mediainfo at the moment.
It's too detailed
$ mediainfo vine.mp4 | wc -l
66
I wish a command with only short summary. 6 lines of output.
First define a shell function:
shortinfo() {
mediainfo --Inform="General;Duration=%Duration/String3%\nFile size=%FileSize/String1%" "$@"
mediainfo --Inform="Video;Resolution=%Width%x%Height%\nCodec=%CodecID%" "$@";
}
Now, use this shell function on your video file. For example:
$ shortinfo sample.mp4
Duration=00:00:10.027
File size=13 MiB
Resolution=1920x1080
Codec=avc1
To make the shell function permanent, place it in your ~/.bashrc
file.
mediainfo
allows for custom output but, as far as I can tell, the custom output can only come from one section (general, video, audio) at a time. This leads us to need two mediainfo
commands. The first selects information from the general
category:
mediainfo --Inform="General;Duration=%Duration/String3%\nFile size=%FileSize/String1%" "$@"
The second selects information from the Video
category:
mediainfo --Inform="Video;Resolution=%Width%x%Height%\nCodec=%CodecID%" "$@";
As you can see, the output allows us to insert any text we like and then substitute in file parameters using a string surrounded by percent signs, such as %CodecID%
. Information can be put on one line or spread out over several. To insert a line break, use the string \n
.
For a list of all the possible file parameters that you can put in your custom output, run:
mediainfo --info-parameters | less
Also now possible on the command line:
mediainfo --Output=$'General;File=%FileName%\\nDuration=%Duration/String3%\\nFile size=%FileSize/String1% \nVideo;Resolution=%Width%x%Height%\\nCodec=%CodecID%\\n\\n' *.mkv
Note the "\n" between the sections
Tested on Ubuntu 18.04
MediaInfo Command line, MediaInfoLib - v17.12