]>
git.rmz.io Git - dotfiles.git/blob - bin/rename-video.sh
017179db274a2fdebc4d3162a8aaf1a209f91615
6 mediainfo
=( $(mediainfo --Output='Video;%Width%,%Height%,%ScanType%,%Format%,%Codec%' "$1") )
7 mediainfo
=( $(ffprobe -select_streams v -show_entries stream=codec_name,width,height -of compact "$1" 2> /dev/null) )
8 local width
=${mediainfo[0]}
9 local height
=${mediainfo[1]}
10 local scan
=${mediainfo[2]}
11 local format
=${mediainfo[3]}
12 local codecid
=${mediainfo[4]}
17 # same tests xbmc does:
18 # https://github.com/xbmc/xbmc/blob/master/xbmc/utils/StreamDetails.cpp#L514
19 if (( $width <= 720 && $height <= 480 )); then
21 elif (( $width <= 768 && $height <= 576)); then
23 elif (( $width <= 960 && $height <= 544)); then
25 elif (( $width <= 1280 && $height <= 720)); then
31 if [[ "$scan" == "Progressive" ]]; then
33 elif [[ "$scan" == "Interlaced" ]]; then
38 if [[ "$format" == "AVC" ]]; then
40 elif [[ "$format" == "VC-1" && "$codecid" == "WVC1" ]]; then
42 elif [[ "$codecid" == "XVID" ]]; then
44 elif [[ "$codecid" == "DIV3" || "$codecid" == "DX50" || "$codecid" == "DIVX" ]]; then
46 elif [[ "$codecid" == "V_MPEG2" ]]; then
48 elif [[ "$codecid" == "MP42" ]]; then
60 mediainfo
=( $(mediainfo --Output='General;%Audio_Format_List%,%Audio_Language_List%,%AudioCount%' "$1") )
62 local format
=( ${mediainfo[0]} )
63 local lang
=( ${mediainfo[1]} )
64 local cnt
=${mediainfo[2]}
68 while (( $i < $cnt )) ; do
69 local iformat
=${format[$i]}
70 local ilang
=${lang[$i]}
73 if [[ "$iformat" == "DTS" ]]; then
75 elif [[ "$iformat" == "AC-3" ]]; then
77 elif [[ "$iformat" == "MPEG Audio" ]]; then
84 if [[ "$ilang" == "English" ]]; then
86 elif [[ "$ilang" == "German" ]]; then
88 elif [[ "$ilang" == "French" ]]; then
94 audio
+="[${alang}]{${acodec}}"
103 # echo "{$resolution}{$vcodec}$audio"