Gstreamer wrapper (#33)

* Add DTS; EAC3; TrueHD support for GStreamer
pull/76/head
Alex 3 years ago committed by GitHub
parent 7e38c0a5ff
commit 64b96840ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,5 +43,20 @@ A clear and concise description of what the bug is.
- Copy paste those lines in another new [gist](https://gist.github.com/)
- Copy paste all the gists links in the issue
## `gstreamer.log` (containing the ffmpeg-wrapper execution logs)
- Go to the temporary directory: `cd /tmp`
- Type `ls -al | grep gst` to list all files containing "ffmpeg" and check you have one named `gstreamer.log`
- Type `tail -200 gstreamer.log` to print the last 200 lines to the console
- Copy paste those lines in a new [gist](https://gist.github.com/)
- Add the gist link to the issue
## `gstlaunch-xxxx.stderr` (containing chunks transcoding operations)
- When you ran `ls -al | grep gst` you should have seen another file that looks like `gstreamer-xxxx.stderr` in case of error, the file may not be there, in that specific case, you can ignore these steps.
- Type `tail -100 gstlaunch-xxxx.stderr` (replacing the filename by the correct one)
- Copy paste those lines in a new [gist](https://gist.github.com/)
- Type `head -300 gstlaunch-xxxx.stderr` (replacing the filename by the correct one)
- Copy paste those lines in another new [gist](https://gist.github.com/)
- Copy paste all the gists links in the issue
**Additional context**
Add any other context about the problem here.

@ -15,10 +15,10 @@ Huge thanks to [Benjamin Poncet](https://github.com/BenjaminPoncet), [Vincent Fo
- Video Station 2.4.6-1594 (and above)
- SynoCommunity ffmpeg 4.x.x, ffmpeg 5.x.x or ffmpeg 6.x.x ([help](https://synocommunity.com/#easy-install))
## Supported / Unsupported scenarios
## Supported scenarios
- **[DTS or EAC3 or TrueHD] + [Any non HEVC standard video format]**: ✅
- **[no DTS, no EAC3, no TrueHD] + [HEVC]**: ✅
- **[DTS or EAC3 or TrueHD] + [HEVC]**: ⚠️ Not working on architectures where Advanced Media Extensions uses GStreamer for audio decoding (Please don't submit any more issue related to this scenario, I'm working on it, see [#33](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/pull/33))
- **[DTS or EAC3 or TrueHD] + [HEVC]**: ✅ (credits to @nap-liu)
## Instructions
- Check that you meet the required [dependencies](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher#dependencies)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,5 +1,3 @@
The patcher was redesigned to include an unpatch procedure.
I'm aware of an issue with HEVC and I'm working on it.
The patcher now supports every scenarios including gstreamer (credits to @nap-liu).
As always, please let me know of any issue you could have.

@ -5,21 +5,83 @@
###############################
source "/etc/VERSION"
cpu_platform=$(</proc/syno_platform)
dsm_version="$productversion $buildnumber-$smallfixnumber"
repo_base_url="https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher"
version="2.0"
action="patch"
branch="main"
ffmpegversion=""
wrappers=("ffmpeg")
wrappers=(
"ffmpeg"
"gst-launch-1.0"
"gst-inspect-1.0"
)
vs_path=/var/packages/VideoStation/target
libsynovte_path="$vs_path/lib/libsynovte.so"
cp_bin_path=/var/packages/CodecPack/target/bin
cp_path=/var/packages/CodecPack/target/pack
cp_bin_path="$cp_path/bin"
cp_to_patch=(
"ffmpeg41:ffmpeg"
"ffmpeg27:ffmpeg"
"ffmpeg33:ffmpeg"
"gst-launch-1.0:gst-launch-1.0"
"gst-inspect-1.0:gst-inspect-1.0"
)
gstreamer_platforms=(
"REALTEK_RTD1296"
)
gstreamer_plugins=(
"libgstdtsdec"
"libgstlibav"
)
gstreamer_libs=(
"libavcodec-ffmpeg.so.56"
"libavformat-ffmpeg.so.56"
"libavutil-ffmpeg.so.54"
"libbluray.so.1"
"libdca.so.0"
"libgme.so.0"
"libgnutls-deb0.so.28"
"libgsm.so.1"
"libhogweed.so.4"
"libmodplug.so.1"
"libnettle.so.6"
"libnuma.so.1"
"libopenjpeg.so.5"
"libopenjpeg_JPWL.so.5"
"libopus.so.0"
"liborc-0.4.so.0"
"libp11-kit.so.0"
"libpng12.so.0"
"librtmp.so.1"
"libschroedinger-1.0.so.0"
"libshine.so.3"
"libsoxr.so.0"
"libspeex.so.1"
"libssh-gcrypt.so.4"
"libssh-gcrypt_threads.so.4"
"libswresample-ffmpeg.so.1"
"libtasn1.so.6"
"libtheora.so.0"
"libtheoradec.so.1"
"libtheoraenc.so.1"
"libtwolame.so.0"
"libva.so.1"
"libvpx.so.2"
"libvpx.so.2.0"
"libwavpack.so.1"
"libwebp.so.5"
"libx264.so.146"
"libx265.so.59"
"libxvidcore.so.4"
"libzvbi.so.0"
"libzvbi-chains.so.0"
"dri/dummy_drv_video.so"
"x264-10bit/libx264.so.146"
"x265-10bit/libx265.so.59"
)
###############################
@ -57,10 +119,16 @@ function welcome_motd() {
function restart_packages() {
if [[ -d $cp_bin_path ]]; then
info "Clearing CodecPack gstreamer cache..."
rm -f "$cp_path/etc/gstreamer-1.0/registry.*.bin"
info "Restarting CodecPack..."
synopkg restart CodecPack
fi
info "Clearing VideoStation gstreamer cache..."
rm -f "$vs_path/etc/gstreamer-1.0/registry.*.bin"
info "Restarting VideoStation..."
synopkg restart VideoStation
}
@ -93,7 +161,7 @@ function patch() {
mv -n "$vs_path/bin/$filename" "$vs_path/bin/$filename.orig"
info "Downloading and installing $filename's wrapper..."
wget -q -O - "$repo_base_url/blob/$branch/$filename-wrapper.sh?raw=true" > "$vs_path/bin/$filename"
wget -q -O - "$repo_base_url/blob/$branch/wrappers/$filename.sh?raw=true" > "$vs_path/bin/$filename"
chown root:VideoStation "$vs_path/bin/$filename"
chmod 750 "$vs_path/bin/$filename"
chmod u+s "$vs_path/bin/$filename"
@ -114,6 +182,34 @@ function patch() {
done
fi
if [[ "${gstreamer_platforms[*]}" =~ $cpu_platform ]]; then
info "Downloading gstreamer plugins..."
for plugin in "${gstreamer_plugins[@]}"; do
info "Downloading $plugin to gstreamer directory..."
wget -q -O - "$repo_base_url/raw/$branch/plugins/$plugin.so" \
> "$vs_path/lib/gstreamer/gstreamer-1.0/$plugin.so"
done
mkdir -p "$vs_path/lib/gstreamer/dri"
mkdir -p "$vs_path/lib/gstreamer/x264-10bit"
mkdir -p "$vs_path/lib/gstreamer/x265-10bit"
for lib in "${gstreamer_libs[@]}"; do
info "Downloading $lib to gstreamer directory..."
wget -q -O - "$repo_base_url/raw/$branch/libs/$lib" \
> "$vs_path/lib/gstreamer/$lib"
done
info "Saving current GSTOmx configuration..."
mv -n "$vs_path/etc/gstomx.conf" "$vs_path/etc/gstomx.conf.orig"
info "Injecting GSTOmx configuration..."
cp -n "$cp_path/etc/gstomx.conf" "$vs_path/etc/gstomx.conf"
fi
info "Setting ffmpeg version to: ffmpeg$ffmpegversion"
sed -i -e "s/@ffmpeg_version@/ffmpeg$ffmpegversion/" "$vs_path/bin/ffmpeg"
@ -148,6 +244,21 @@ function unpatch() {
done
fi
if [[ "${gstreamer_platforms[*]}" =~ $cpu_platform ]]; then
for plugin in "${gstreamer_plugins[@]}"; do
info "Removing gstreamer's $plugin plugin"
rm -f "$vs_path/lib/gstreamer/gstreamer-1.0/$plugin.so"
done
for lib in "${gstreamer_libs[@]}"; do
info "Removing gstreamer's $lib library"
rm -f "$vs_path/lib/gstreamer/$lib"
done
info "Restoring GSTOmx configuration..."
mv -T -f "$vs_path/etc/gstomx.conf.orig" "$vs_path/etc/gstomx.conf"
fi
restart_packages
echo ""

Binary file not shown.

Binary file not shown.

@ -50,6 +50,9 @@ newline
info "========================================[start ffmpeg $pid]"
info "DEFAULT_ARGS: $*"
/var/packages/@ffmpeg_version@/target/bin/ffmpeg "$@" 2> $stderrfile
/var/packages/@ffmpeg_version@/target/bin/ffmpeg "$@" <&0 2> $stderrfile &
child=$!
wait $child
endprocess

@ -0,0 +1,56 @@
#!/bin/bash
#########################
# VARS
#########################
pid=$$
stderrfile="/tmp/gstinspect-$pid.stderr"
logfile="/tmp/gstreamer.log"
#########################
# UTILS
#########################
function log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $logfile
}
function newline() {
echo "" >> $logfile
}
function info() {
log "INFO" "$1"
}
function handle_error() {
log "ERROR" "An error occurred, here is the $stderrfile content: "
newline
cat "$stderrfile" >> $logfile
newline
endprocess
}
function endprocess() {
info "========================================[end gst $pid]"
newline
rm "$stderrfile"
exit 1
}
#########################
# ENTRYPOINT
#########################
trap endprocess SIGTERM
trap handle_error ERR
newline
info "========================================[start gst-inspect $pid]"
info "GST_ARGS: $*"
/var/packages/VideoStation/target/bin/gst-inspect-1.0.orig "$@" 2> $stderrfile &
child=$!
wait $child
endprocess

@ -0,0 +1,56 @@
#!/bin/bash
#########################
# VARS
#########################
pid=$$
stderrfile="/tmp/gstlaunch-$pid.stderr"
logfile="/tmp/gstreamer.log"
#########################
# UTILS
#########################
function log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $logfile
}
function newline() {
echo "" >> $logfile
}
function info() {
log "INFO" "$1"
}
function handle_error() {
log "ERROR" "An error occurred, here is the $stderrfile content: "
newline
cat "$stderrfile" >> $logfile
newline
endprocess
}
function endprocess() {
info "========================================[end gst $pid]"
newline
rm "$stderrfile"
exit 1
}
#########################
# ENTRYPOINT
#########################
trap endprocess SIGTERM
trap handle_error ERR
newline
info "========================================[start gst-launch $pid]"
info "GST_ARGS: $*"
/var/packages/VideoStation/target/bin/gst-launch-1.0.orig "$@" 2> $stderrfile &
child=$!
wait $child
endprocess
Loading…
Cancel
Save