Explorar o código

Always recode MPEG-1 streams

Zachary Kotlarek %!s(int64=14) %!d(string=hai) anos
pai
achega
612f5aeeae
Modificáronse 2 ficheiros con 30 adicións e 9 borrados
  1. 18 7
      folderToMov.sh
  2. 12 2
      toMov.sh

+ 18 - 7
folderToMov.sh

@@ -20,15 +20,31 @@ if [ $LOAD -gt $(( 2 * $CPU_COUNT )) ]; then
 	exit 0
 fi
 
+# Bail if WoW is running
+if ps auwx | grep -v grep | grep -q "World of Warcraft/World of Warcraft.app/Contents/MacOS/World of Warcraft"; then
+	exit 0
+fi
+
 # Prefer recoding to rewrapping if the file is overrate
 ~/bin/video/findRecode0 "${inFolder}" | xargs -0 -n1 ~/bin/video/recode
 
+# MPEGs must be recoded, not just re-wrapped
+for i in "${inFolder}/"*.[mM][pP][gG] "${inFolder}/"*.[mM][pP][eE][gG]; do
+	# Make sure the file is reasonable
+	if [ ! -e "${i}" ]; then
+		continue
+	fi
+
+	# Recode
+	~/bin/video/recode "${i}"
+done
+
 # Move to the input folder
 inFolder="`cd "${inFolder}" && pwd`"
 cd "${inFolder}"
 
 # Cycle through the folder looking for certain video files that should be converted to better containers
-for i in *.[aA][vV][iI] *.[wW][mM][vV] *.[mM][kK][vV] *.[dD][iI][vV][xX] *.[fF][lL][vV] *.[mM][pP][gG]; do
+for i in *.[aA][vV][iI] *.[wW][mM][vV] *.[mM][kK][vV] *.[dD][iI][vV][xX] *.[fF][lL][vV]; do
 	# Construct the full path
 	file="${inFolder}/${i}"
 
@@ -37,11 +53,6 @@ for i in *.[aA][vV][iI] *.[wW][mM][vV] *.[mM][kK][vV] *.[dD][iI][vV][xX] *.[fF][
 		continue
 	fi
 
-	# Bail if WoW is running
-	if ps auwx | grep -v grep | grep -q "World of Warcraft/World of Warcraft.app/Contents/MacOS/World of Warcraft"; then
-		exit 0
-	fi
-
-	# Convert to M4V/MOV
+	# Rewrap as MOV
 	~/bin/video/toMov.sh "${file}"
 done

+ 12 - 2
toMov.sh

@@ -9,14 +9,24 @@ if [ -z "${inFile}" ] || [ ! -e "${inFile}" ]; then
 	exit 1
 fi
 
-# Exclude files with DTS soundtracks
-ACODECS="`~/bin/video/movInfo.pl "${inFile}" | grep AUDIO_CODEC`"
+# Grab some codec info
+INFO="`~/bin/video/movInfo.pl "${inFile}"`"
+ACODECS="`echo "${INFO}" | grep AUDIO_CODEC`"
 if [ -z "${ACODECS}" ]; then
 	echo "`basename "${0}"`: Could not determine audio codec" 1>&2
 	exit 2
 fi
+VCODECS="`echo "${INFO}" | grep VIDEO_CODEC`"
+if [ -z "${VCODECS}" ]; then
+	echo "`basename "${0}"`: Could not determine video codec" 1>&2
+	exit 2
+fi
+
+# Exclude files with DTS soundtracks or MPEG-1 streams
 if echo "${ACODECS}" | grep -q ffdca; then
 	exit 1
+elif echo "${VCODECS}" | grep -q ffmpeg1; then
+	exit 1
 fi
 
 # Construct the output file name