Просмотр исходного кода

Merge branch 'master' of github.com:profplump/UberZach-Video

Zachary Kotlarek 10 лет назад
Родитель
Сommit
a459d2941d
3 измененных файлов с 39 добавлено и 1 удалено
  1. 10 0
      m3u8-fetch.sh
  2. 28 0
      m3u8-uri.sh
  3. 1 1
      toMKV.sh

+ 10 - 0
m3u8-fetch.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+
+URI="${1}"
+FILE="${2}"
+if [ -z "${URI}" ] || [ -z "${FILE}" ] || [ -e "${FILE}" ]; then
+	echo "Usage: ${0} URI output_file" 1>&2
+	exit 1
+fi
+
+ffmpeg -i "${URI}" -bsf:a aac_adtstoasc -vcodec copy -c copy "${FILE}"

+ 28 - 0
m3u8-uri.sh

@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Command-line parameters
+URI="${1}"
+if [ -z "${URI}" ]; then
+	wcho "Usage: ${0} uri" 1>&2
+	exit 1
+fi
+
+# Fetch the M3U8
+M3U8="`mktemp -t 'M3U8'`"
+curl -o "${M3U8}" "${URI}"
+PREFIX="`echo "${URI}" | sed 's%^\(.*\)\/.*$%\1%'`"
+
+# Find the highest-resolution/highest-bandwidth stream
+BANDWIDTH="`cat "${M3U8}" | grep '^#EXT-X-STREAM-INF:' | \
+	sed 's%^.*[,:]BANDWIDTH=\([0-9]*\).*,RESOLUTION=\([0-9]*\)x\([0-9]*\).*$%\2 \1%' | \
+		sort -n | tail -n 1 | cut -d ' ' -f 2`"
+
+# Extract the URI from the line after that stream
+URI="`cat "${M3U8}" | grep -A1 "BANDWIDTH=${BANDWIDTH}" | tail -n 1`"
+
+# Output
+echo "${PREFIX}/${URI}"
+
+# Cleanup
+rm -f "${M3U8}"
+exit 0

+ 1 - 1
toMKV.sh

@@ -2,7 +2,7 @@
 
 # Defaults
 if [ -z "${MIN_AVI_SIZE}" ]; then
-	MIN_AVI_SIZE=$(( 350 * 1024 * 1024 ))
+	MIN_AVI_SIZE=$(( 250 * 1024 * 1024 ))
 fi
 
 # Functions