From bad38f691ec8cebb02f3d63292f28dd9d9f21cb9 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 15 Nov 2022 00:31:16 +0100 Subject: [PATCH] compare media example (exiftool, ffprobe) 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 | 10 ++++++++++ t/examples.t | 1 + 2 files changed, 11 insertions(+) diff --git a/barcat b/barcat index d8deee4..3744590 100755 --- 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 diff --git a/t/examples.t b/t/examples.t index c5648ad..874b94a 100755 --- a/t/examples.t +++ b/t/examples.t @@ -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 -- 2.30.0