Renamed render script for Future Diary
This commit is contained in:
parent
034397535a
commit
95608bfe2d
38
src/render_mirai_nikki_script.sh
Executable file
38
src/render_mirai_nikki_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" --sid=1 "--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