Advertisement
Guest User

mediainfo get videos by resolution

a guest
Jan 21st, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. # mediainfo get videos by resolution 20240121043425
  2.  
  3. lsvideoheight_core() {
  4. # $1 = height
  5. # $2 = current file name
  6. mediainfo_result=$(mediainfo "$2" |egrep "(Complete name|Height.*: $1)");
  7. mediainfo_height=$(echo "$mediainfo_result" | tail -n 1 )
  8. if ( [[ $mediainfo_height == *"$1"* ]] ); # if video height matches
  9. then { echo "$mediainfo_result" | head -n 1 | grep "$2" |sed -r "s/^.*: //g"; }; fi # remove everything except the file path
  10. }
  11.  
  12.  
  13. lsvideoheight() {
  14. # iterate though multiple files
  15. argument_count=1; # skip height argument
  16. for filenames in "$@"; # not using "${@:2}" for sh compatibility
  17. do { if (test $argument_count -ge 1 ); then lsvideoheight_core "$1" "$filenames"; fi;
  18. argument_count=$(( argument_count + 1 ));
  19. }
  20. done
  21. }
  22.  
  23. ls4320p() { lsvideoheight "2 160" "$@"; } # 8K
  24. ls2160p() { lsvideoheight "2 160" "$@"; } # 4K
  25. ls1440p() { lsvideoheight "1 440" "$@"; } # QHD / WQHD
  26. ls1080p() { lsvideoheight "1 080" "$@"; } # Full HD
  27. ls720p() { lsvideoheight "720" "$@"; } # HD
  28. ls480p() { lsvideoheight "480" "$@"; } # HQ ("high quality") / SD ("standard definition")
  29.  
  30. # aliases
  31. alias ls8K=ls4320p;
  32. alias ls4K=ls2160p;
  33. alias lsQHD=ls1440p;
  34. alias lsFHD=ls1080p;
  35. alias lsHD=ls720p;
  36. # no alias for 480p because the abbreviations "HQ" and "SD" have ambiguous meanings such as "SD card".
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement