]>
git.rmz.io Git - dotfiles.git/blob - bin/rename-video.sh
   6     mediainfo
=( $
(mediainfo 
--Output='Video;%Width%,%Height%,%ScanType%,%Format%,%Codec%' "$1") ) 
   7     #TODO ffprobe returns better parseable output but doesn't give info on scan_type (use it for audio only?) 
   9 #    mediainfo=( $(ffprobe -select_streams v -show_entries stream=codec_name,width,height -of compact=nk=1 -i file:"$1" 2> /dev/null) ) 
  10     local width
=${mediainfo[0]} 
  11     local height
=${mediainfo[1]} 
  12     local scan
=${mediainfo[2]} 
  13     local format
=${mediainfo[3]} 
  14     local codecid
=${mediainfo[4]} 
  16     # same tests xbmc does: 
  17     # https://github.com/xbmc/xbmc/blob/master/xbmc/utils/StreamDetails.cpp#L514 
  18     if (( $width <= 720 && $height <= 480 )); then 
  20     elif (( $width <= 768 && $height <= 576)); then 
  22     elif (( $width <= 960 && $height <= 544)); then 
  24     elif (( $width <= 1280 && $height <= 720)); then 
  30     if [[ "$scan" == "Progressive" ]]; then 
  32     elif [[ "$scan" == "Interlaced" ]]; then 
  37     if [[ "$format" == "AVC" ]]; then 
  39     elif [[ "$format" == "VC-1" && "$codecid" == "WVC1" ]]; then 
  41     elif [[ "$codecid" == "XVID" ]]; then 
  43     elif [[ "$codecid" == "DIV3" || "$codecid" == "DX50" || "$codecid" == "DIVX" ]]; then 
  45     elif [[ "$codecid" == "V_MPEG2" ]]; then 
  47     elif [[ "$codecid" == "MP42" ]]; then 
  59     mediainfo
=( $
(mediainfo 
--Output='General;%Audio_Format_List%,%Audio_Language_List%,%AudioCount%' "$1") ) 
  61     local format
=( ${mediainfo[0]} ) 
  62     local lang
=( ${mediainfo[1]} ) 
  63     local cnt
=${mediainfo[2]} 
  67     while (( $i < $cnt )) ; do 
  68         local iformat
=${format[$i]} 
  69         local ilang
=${lang[$i]} 
  72         if [[ "$iformat" == "DTS" ]]; then 
  74         elif [[ "$iformat" == "AC-3" ]]; then 
  76         elif [[ "$iformat" == "MPEG Audio" ]]; then 
  83         if [[ "$ilang" == "English" ]]; then 
  85         elif [[ "$ilang" == "German" ]]; then 
  87         elif [[ "$ilang" == "French" ]]; then 
  93         audio
+="[${alang}]{${acodec}}" 
 102 #    echo "{$resolution}{$vcodec}$audio"