compare media example (exiftool, ffprobe)
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 14 Nov 2022 23:31:16 +0000 (00:31 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 21 Nov 2022 15:42:04 +0000 (16:42 +0100)
Personal use case featuring two popular tools with different strengths and
interfaces.

Omit a third alternative with similar results due to being objectively much
worse in my experience:

mediainfo --inform='General;%Duration% %OverallBitRate% %FileNameExtension%\n' *

barcat
t/examples.t

diff --git a/barcat b/barcat
index d8deee4b6834d3893ce71e706feba5e2f522d449..37445908b20682e1d56c06fc962a989c750c78bf 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -609,6 +609,16 @@ Same from formatted results, selecting the first numeric value:
 
     tree -s --noreport | barcat -H -f+
 
+Compare media metadata, like image size or play time:
+
+    exiftool -T -p '$megapixels ($imagesize) $filename' * | barcat
+
+    exiftool -T -p '$duration# $avgbitrate# $filename' * | barcat -H
+
+    find -type f -print0 | xargs -0 -L1 \
+    ffprobe -show_format -of json -v error |
+    jq -r '[.format|.duration,.bit_rate,.filename]|join(" ")' | barcat -H
+
 Memory usage of user processes with long names truncated:
 
     ps xo rss,pid,cmd | barcat -l40
index c5648ad06c1b2bec403a211146811662282b1f7e..874b94adbdcccb783fd735f4120ff17b7533c791 100755 (executable)
@@ -34,6 +34,7 @@ while (readline $input) {
                s/\\\n\s*//g;         # line continuations
                s/^[(\h]+//;          # subshell
                s/^echo\ .*?\|\s*//;  # preceding input
+               s/'(\S+)[^']*'/$1/g;  # quoted arguments
                s/\|.*//;             # subsequent pipes
                s/^cat\ //;           # local file
                s/^curl\ // and do {  # remote url