In Dolphin, a file’s properties can be brought up (Alt+Return) containing filetype-specific info like album artist, dimensions, aspect ratio, bitrate, rating, tags, frame rate, track number, etc. I’m looking for a way to list these properties for a given file in commandline.
I understand it’s possible to display permissions, ownership, size, and created/accessed/modified time using ls -l
and stat
, mime type with xdg-mime query filetype
and file
, something called the file “attributes” using lsattr
, and some media-specific properties via ffprobe
.
I’d like a way to either list all properties of a file like Dolphin can, or otherwise to probe a file for a property of a certain name, to then make a bash script to do the former for myself.
How can I do this?
I use exiftool
from the package perl-image-exiftool
to get photo/image details and mutagen-inspect
from the package python-mutagen
for music.
Alternatively, you can use exiv2
for photos/images.
Those do exactly what I’m looking for, thanks. Does Dolphin just utilise type-specific tools like that to get the properties to display, or does it have some other method? Is there a similar command for video files? ffprobe seems to have all the information but it’s quite buried in information related to the media streams in the file. Is there a way to view tags, rating and comment, which seem to apply to every kind of file?
exiftool
will dump the basic data for most files, not only images.
For example, here is the output from a video:
File Size : 160 MB
File Modification Date/Time : 2015:06:03 18:41:10-05:00
File Access Date/Time : 2020:01:21 12:37:42-06:00
File Inode Change Date/Time : 2020:02:09 12:20:55-06:00
File Permissions : -rw-rw-r--
File Type : MKV
File Type Extension : mkv
MIME Type : video/x-matroska
EBML Version : 1
EBML Read Version : 1
Doc Type : matroska
Doc Type Version : 2
Doc Type Read Version : 2
Timecode Scale : 1 ms
Muxing App : libebml v0.8.0 + libmatroska v0.9.0
Writing App : mkvmerge v3.4.0 ('Rapunzel') built on May 15 2010 09:38:20
Duration : 0:11:52
Date/Time Original : 2013:07:30 22:31:48Z
Video Codec ID : V_MPEG4/ISO/AVC
Video Frame Rate : 23.976
Image Width : 1280
Image Height : 720
Video Scan Type : Undetermined
Display Width : 1280
Display Height : 720
Audio Codec ID : A_AC3
Default Duration : 32 ms
Audio Sample Rate : 48000
Audio Channels : 2
Track Number : 3
Track UID : 36a29b87
Track Type : Subtitle
Track Used : Yes
Track Default : No
Track Forced : No
Track Timecode Scale : 1
Codec ID : S_TEXT/UTF8
Codec Decode All : Yes
Track Language : eng
Image Size : 1280x720
Megapixels : 0.922
I have never looked at the code but I would guess it is using libraries, not commands to read the metadata.
Ah yeah this is perfect. Are tags, ratings and comments stored in exif data too, or are they Dolphin-specific? They uniquely don’t appear to be displayed by exiftool, and exist for even empty files (who retain 0 B size even with those properties set).
Comments and ratings seem to be implemented differently in each application.
If I set the comments in dolphin, they can’t be read by exiftool
. However, if I set them in my music player, they can. Likewise, for ratings I tried 4 different applications which all produced different results.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.