Skip to content
Snippets Groups Projects
Commit 6fd1e2f2 authored by Florian Meißner's avatar Florian Meißner
Browse files

fix(video/stats.fish): ignore header while sorting

parent f0a22d75
No related branches found
No related tags found
No related merge requests found
......@@ -13,22 +13,22 @@ end
set extract __t-nil_helper_extract
filter_by_video | while read f
while read f
echo -ne $f\t
set blah (ffprobe -v error -select_streams v -show_entries stream=width,height,r_frame_rate:format=duration,bit_rate -of default=noprint_wrappers=1 $f 2>/dev/null | string trim)
set duration ($extract duration $blah)
set width ($extract width $blah)
set height ($extract height $blah)
set fps ($extract r_frame_rate $blah)
set fps (math ($extract r_frame_rate $blah)) # we often get FPS as ratio in FFprobe. That converts it to a classical number
set bit_rate ($extract bit_rate $blah)
# if all values are there, calc bits per pixel
for x in blah width height fps bit_rate
for x in width height fps bit_rate
$is_numeric $$x || set bits_per_pixel "N/A"
end
set -q bits_per_pixel && [ "$bits_per_pixel" != "N/A" ] && set bit_rate (math $bit_rate / \( $width \* $height \* $fps \) )
set -q bits_per_pixel || [ "$bits_per_pixel" != "N/A" ] && set bits_per_pixel (math $bit_rate / \( $width \* $height \* $fps \) )
# formatting at the end, so values can be used for calculations until then
......@@ -41,4 +41,4 @@ filter_by_video | while read f
end | pv -l | column --separator=\t --output-separator=\t --table \
--table-columns 'FILE,DURATION,BIT RATE,RESOLUTION,FPS,BITS PER PIXEL' \
--table-right 'DURATION,BIT RATE,RESOLUTION,FPS,BITS PER PIXEL' \
| sort -nt\t -k$_flag_sort_by
| begin; sed -u 1q; sort -nt\t -k$_flag_sort_by; end # sed trick ignores header for sorting
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment