Fix issue report and Fix AAC (#89)

* Update issue-report.sh

* Fix vsync

* Better look and feel

* Fix -acodec

* Fix vaapi pixel format

* Fix scale_vaapi

* Update motd
pull/91/head 2.2
Alex 3 years ago committed by GitHub
parent 84446f36b9
commit d4e0e4d93d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,8 +4,11 @@
# VARS
###############################
ffmpeg_version=ffmpeg
# shellcheck source=/.github/workflows/mock/VERSION
source "/etc/VERSION"
# shellcheck source=/patch_config.sh
source "/var/packages/VideoStation/patch_config.sh" || echo "No patch_config.sh"
dsm_version="$productversion $buildnumber-$smallfixnumber"
vs_path=/var/packages/VideoStation
cp_path=/var/packages/CodecPack
@ -29,6 +32,7 @@ root_check
echo "
================ ISSUE REPORT TOOL ================
https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher
System Details.....................................
DSM Version: $dsm_version
@ -36,37 +40,44 @@ System Details.....................................
Package Details....................................
VideoStation version: $(synopkg version VideoStation || echo "Not installed")
FFMPEG version: $(synopkg version ffmpeg || echo "Not installed")
FFMPEG version ($ffmpeg_version): $(synopkg version "${ffmpeg_version}" || echo "Not installed")
CodecPack version: $(synopkg version CodecPack || echo "Not installed")
Patch Details......................................
Is patched ? $([ -f "$vs_path/target/lib/libsynovte.so.orig" ] && echo "yes" || echo "no")
Has gstreamer ? $([ -f "$vs_path/target/bin/gst-launch-1.0" ] && echo "yes" || echo "no")
FFMPEG VAAPI.......................................
$("/var/packages/${ffmpeg_version}/target/bin/vainfo" || echo "No VAAPI Support")
CodecPack Details..................................
Has AAC ? $([ -f "$cp_path/target/pack/HAS_AAC" ] && echo "yes" || echo "no")
Has HEVC ? $([ -f "$cp_path/target/pack/HAS_HEVC" ] && echo "yes" || echo "no")
"
echo " CodecPack target/bin content:"
echo "CodecPack target/bin content......................."
ls -l "$cp_path/target/bin"
echo ""
echo " CodecPack target/pack/bin content:"
echo "CodecPack target/pack/bin content.................."
ls -l "$cp_path/target/pack/bin"
echo ""
echo " CodecPack status:"
echo "CodecPack status..................................."
cat "$cp_path/var/codec_requirements.json" || echo "file not exists"
echo ""
echo ""
echo "GSTInspect last stderr logs........................."
echo "GSTInspect last stderr logs........................"
tail -22 /tmp/gstinspect*.stderr
echo ""
echo "GSTInspect last stderr.prev logs........................."
tail -22 /tmp/gstinspect*.stderr.prev
echo "GSTInspect stderr.prev logs........................"
cat /tmp/gstinspect*.stderr.prev
echo ""
echo "GSTLaunch last stderr logs........................."
tail -22 /tmp/gstlaunch*.stderr
echo ""
echo "GSTLaunch last stderr.prev logs........................."
tail -22 /tmp/gstlaunch*.stderr.prev
echo "GSTLaunch stderr.prev logs........................."
cat /tmp/gstlaunch*.stderr.prev
echo ""
echo "FFMPEG head logs..................................."
@ -76,8 +87,6 @@ echo "FFMPEG last stderr logs............................"
tail -22 /tmp/ffmpeg*.stderr
echo ""
echo "FFMPEG prev head logs..................................."
head /tmp/ffmpeg*.stderr.prev
echo "FFMPEG prev logs..................................."
cat /tmp/ffmpeg*.stderr.prev
echo ""
echo "FFMPEG prev tail logs..................................."
tail -22 /tmp/ffmpeg*.stderr.prev

@ -1,6 +1,4 @@
The patcher now supports every scenario including gstreamer (credits to @nap-liu).
A new version of the wrapper was deployed (v2.1).
You can find the changelog here: https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/releases/tag/2.1
A new version of the wrapper was deployed (v2.2) fixing some issues with HEVC and AAC transcoding.
You can find the changelog here: https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/releases/tag/2.2
As always, please let me know of any issue you could have.

@ -0,0 +1,4 @@
#!/bin/bash
# shellcheck disable=SC2034
ffmpeg_version=@ffmpeg_version@

@ -89,31 +89,32 @@ gstreamer_libs=(
###############################
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2"
printf "\e[0;37m[%s] \e[0m[%s] %b" "$(date '+%Y-%m-%d %H:%M:%S')" "$1" "$2$3"
}
info() {
log "INFO" "$1"
log "INFO" "\e[0m" "$1\n"
}
error() {
log "ERROR" "$1"
log "ERROR" "\e[0;31m" "$1\n"
}
root_check() {
if [[ "$EUID" -ne 0 ]]; then
error "This tool needs root access (please run 'sudo -i' before proceeding)."
exit 1
fi
success() {
log "SUCCESS" "\e[0;32m" "$1\n"
}
welcome_motd() {
info "ffmpeg-patcher v$version"
download "$repo_base_url/$branch/motd.txt" /tmp/tmp.wget
download "motd" "$repo_base_url/$branch/motd.txt" /tmp/tmp.wget
log "Message of the day" "\033[1;33m" "\n\n$(cat /tmp/tmp.wget)\n\n"
sleep 3
}
log "Message of the day"
echo ""
cat /tmp/tmp.wget
echo ""
root_check() {
if [[ "$EUID" -ne 0 ]]; then
error "This tool needs root access (please run 'sudo -i' before proceeding)."
exit 1
fi
}
check_dependencies() {
@ -164,16 +165,20 @@ clean() {
}
download() {
wget -q -O - "$1" > /tmp/temp.wget
log "INFO" "\e[0m" "Downloading $1... "
wget -q -O - "$2" > /tmp/temp.wget
downloadStatus=$?
if [[ $downloadStatus == 0 ]]; then
mv -f /tmp/temp.wget "$2"
mv -f /tmp/temp.wget "$3"
printf "\e[0;32mDone\n"
else
error "An error occurred while downloading $1. Rolling back changes..."
printf "\e[0;31mError\n"
error "An error occurred while downloading $2. Rolling back changes..."
unpatch
error "An error occurred while downloading $1, every changes were rolled back."
error "An error occurred while downloading $2, every changes were rolled back."
error "Please check your internet connection / GithubStatus. If you think this is an error, please file an issue to the repository."
exit 1
fi
@ -198,8 +203,7 @@ patch() {
info "Saving current $filename script as $filename.orig"
mv -n "$vs_base_path/scripts/$filename" "$vs_base_path/scripts/$filename.orig"
info "Downloading $filename script..."
download "$repo_base_url/$branch/scripts/$filename.sh" "$vs_base_path/scripts/$filename"
download "$filename.sh" "$repo_base_url/$branch/scripts/$filename.sh" "$vs_base_path/scripts/$filename"
info "Injecting script variables..."
repo_full_url="$repo_base_url/$branch"
@ -214,8 +218,7 @@ patch() {
info "Saving current $filename as $filename.orig"
mv -n "$vs_path/bin/$filename" "$vs_path/bin/$filename.orig"
info "Downloading and installing $filename's wrapper..."
download "$repo_base_url/$branch/wrappers/$filename.sh" "$vs_path/bin/$filename"
download "$filename.sh" "$repo_base_url/$branch/wrappers/$filename.sh" "$vs_path/bin/$filename"
chown root:VideoStation "$vs_path/bin/$filename"
chmod 750 "$vs_path/bin/$filename"
chmod u+s "$vs_path/bin/$filename"
@ -240,8 +243,7 @@ patch() {
info "Downloading gstreamer plugins..."
for plugin in "${gstreamer_plugins[@]}"; do
info "Downloading $plugin to gstreamer directory..."
download "$repo_base_url/$branch/plugins/$plugin.so" "$vs_path/lib/gstreamer/gstreamer-1.0/$plugin.so"
download "Gstreamer plugin: $plugin" "$repo_base_url/$branch/plugins/$plugin.so" "$vs_path/lib/gstreamer/gstreamer-1.0/$plugin.so"
done
mkdir -p "$vs_path/lib/gstreamer/dri"
@ -249,8 +251,7 @@ patch() {
mkdir -p "$vs_path/lib/gstreamer/x265-10bit"
for lib in "${gstreamer_libs[@]}"; do
info "Downloading $lib to gstreamer directory..."
download "$repo_base_url/$branch/libs/$lib" "$vs_path/lib/gstreamer/$lib"
download "Gstreamer library: $lib" "$repo_base_url/$branch/libs/$lib" "$vs_path/lib/gstreamer/$lib"
done
info "Saving current GSTOmx configuration..."
@ -260,8 +261,10 @@ patch() {
cp -n "$cp_path/etc/gstomx.conf" "$vs_path/etc/gstomx.conf"
fi
download "patch_config.sh" "$repo_base_url/$branch/patch_config.sh" "$vs_base_path/patch_config.sh"
info "Setting ffmpeg version to: ffmpeg$ffmpegversion"
sed -i -e "s/@ffmpeg_version@/ffmpeg$ffmpegversion/" "$vs_path/bin/ffmpeg"
sed -i -e "s/@ffmpeg_version@/ffmpeg$ffmpegversion/" "$vs_base_path/patch_config.sh"
info "Saving current libsynovte.so as libsynovte.so.orig"
cp -n "$libsynovte_path" "$libsynovte_path.orig"
@ -273,8 +276,7 @@ patch() {
restart_packages
clean
echo ""
info "Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
success "Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
}
unpatch() {
@ -327,11 +329,13 @@ unpatch() {
fi
fi
info "Remove patch config."
rm -f "$vs_base_path/patch_config.sh"
restart_packages
clean
echo ""
info "unpatch complete"
success "Unpatch complete"
}
################################

@ -4,11 +4,15 @@
# VARS
#########################
ffmpeg_version=ffmpeg
pid=$$
child=""
stderrfile="/tmp/ffmpeg-$pid.stderr"
errcode=0
# shellcheck source=/patch_config.sh
source "/var/packages/VideoStation/patch_config.sh"
#########################
# UTILS
#########################
@ -49,6 +53,51 @@ endprocess() {
exit $errcode
}
fix_args() {
while [[ $# -gt 0 ]]; do
case "$1" in
-acodec)
shift
if [[ "$1" = "libfaac" ]]; then
args+=("-acodec" "aac")
else
args+=("-acodec" "libfdk_aac")
fi
;;
-vf)
shift
arg="$1"
if [[ "$arg" =~ "scale_vaapi" ]]; then
scale_w=$(echo "$arg" | sed -e 's/.*=w=//g' | sed -e 's/:h=.*//g')
# shellcheck disable=SC2001
scale_h=$(echo "$arg" | sed -e 's/.*:h=//g')
if [[ "$scale_w" != "" && "$scale_h" != "" ]]; then
arg="scale_vaapi=w=$scale_w:h=$scale_h:format=nv12,hwupload,setsar=sar=1"
else
arg="scale_vaapi=format=nv12,hwupload,setsar=sar=1"
fi
fi
args+=("-vf" "$arg")
;;
-r)
shift
;;
-pix_fmt)
shift
;;
*) args+=("$1") ;;
esac
shift
done
}
#########################
# ENTRYPOINT
#########################
@ -58,11 +107,14 @@ trap handle_error ERR
rm -f /tmp/ffmpeg*.stderr.prev
fix_args "$@"
newline
info "========================================[start ffmpeg $pid]"
info "DEFAULT ARGS: $*"
info "UPDATED ARGS: ${args[*]}"
/var/packages/@ffmpeg_version@/target/bin/ffmpeg "$@" <&0 2>> $stderrfile &
"/var/packages/${ffmpeg_version}/target/bin/ffmpeg" "${args[@]}" <&0 2>> $stderrfile &
child=$!
wait "$child"

Loading…
Cancel
Save