Added render script for Netoge Bot
This commit is contained in:
parent
0637cb6217
commit
a7df40ae62
38
src/render_netoge_script.sh
Executable file
38
src/render_netoge_script.sh
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#! /usr/bin/env sh
|
||||||
|
|
||||||
|
# src/render_script.sh
|
||||||
|
|
||||||
|
# ISSUES:
|
||||||
|
# - https://github.com/mpv-player/mpv/issues/5498
|
||||||
|
# MPV has an issue when outputting to jpg.
|
||||||
|
# Colors look washed out and faded compared to png screenshots.
|
||||||
|
# As a workaround this script will output to png then convert to jpg.
|
||||||
|
#
|
||||||
|
# - https://trac.ffmpeg.org/ticket/2391
|
||||||
|
# I want to just use ffmpeg for this script, however it
|
||||||
|
# does not support dvd subtitles. For now, I have to
|
||||||
|
# rely on mpv to render dvdsubs correctly :(
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# - Tidy up this script and add some safety checks
|
||||||
|
# - Add some logic to the bot to detect if this script failed
|
||||||
|
# - Research more mpv options to avoid having to use mpv + convert
|
||||||
|
|
||||||
|
# Requiered args supplied by the bot
|
||||||
|
INPUT_PATH="$1"
|
||||||
|
OUTPUT_PATH="$2"
|
||||||
|
PICKED_FRAME="$3"
|
||||||
|
|
||||||
|
PNG_PATH="${OUTPUT_PATH%.*}.png"
|
||||||
|
|
||||||
|
echo "$INPUT_PATH"
|
||||||
|
echo "$OUTPUT_PATH"
|
||||||
|
echo "$PICKED_FRAME"
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
||||||
|
mkdir -p "$(dirname "$PNG_PATH")"
|
||||||
|
|
||||||
|
mpv "$INPUT_PATH" "--start=${PICKED_FRAME}" --frames=1 -o "$PNG_PATH"
|
||||||
|
convert -quality 95 "$PNG_PATH" "$OUTPUT_PATH"
|
||||||
|
|
||||||
|
rm -fv "$PNG_PATH"
|
Reference in New Issue
Block a user