Last active
July 22, 2023 23:47
-
-
Save andrewmackrodt/973142f3112e8a3f7d20cad7a7695354 to your computer and use it in GitHub Desktop.
Vaudeville Proton Video Fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to transcode Vaudeville 4K AVC1 media to 1080p X264/Opus so that Proton | |
# Experimental or Proton GE can play cutscene video and audio. | |
# | |
# Move the script to ${steam_library}/steamapps/common/Vaudeville and run. This | |
# script requires ffmpeg. If ffmpeg crashes with a segfault, re-run the script | |
# until it succeeds. Files which have successfully been transcoded already will | |
# be skipped on subsequent runs. | |
# | |
# Clear steam's shadercache for the game after running this script: | |
# rm -rf ~/.steam/steam/steamapps/shadercache/2240920/ | |
# | |
# The original files will be moved to "./Vaudeville_Data/avc1", move them back | |
# into the "Vaudeville_Data" directory to undo changes made by this script, or | |
# revalidate game files from Steam. | |
set -euo pipefail | |
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)/Vaudeville_Data" | |
# for f in $(ls -1); do file "$f"; done | awk '$0 ~ /MP4/ { print $1 }' | sed 's/://' | |
video_files=$(cat <<'EOF' | |
sharedassets0.resource | |
sharedassets13.resource | |
EOF | |
) | |
# original avc1 directory | |
avc1_dir="avc1" | |
if [[ ! -d "$avc1_dir" ]]; then | |
mkdir -p "$avc1_dir" | |
fi | |
# x264 directory | |
x264_dir="x264" | |
if [[ ! -d "$x264_dir" ]]; then | |
mkdir -p "$x264_dir" | |
fi | |
for video_file in $video_files; do | |
# move original file into avc1 directory | |
avc1_file="$avc1_dir/$video_file" | |
if [[ ! -f "$avc1_file" ]] && [[ -f "$video_file" ]] && [[ ! -L "$video_file" ]]; then | |
mv "$video_file" "$avc1_file" | |
fi | |
# x264 file | |
x264_file="$x264_dir/$video_file" | |
if [[ ! -f "$x264_file" ]] && [[ -f "$avc1_file" ]]; then | |
set +e | |
if ! ffmpeg -i "$avc1_file" -hide_banner \ | |
-c:v libx264 -preset slow -crf 18 \ | |
-vf scale=1920:-1 \ | |
-tune animation \ | |
-pix_fmt yuv420p10le -profile:v high10 \ | |
-x264-params 'bframes=8:psy-rd=1:aq-mode=3' \ | |
-c:a libopus -b:a 128k \ | |
-f mp4 -movflags +faststart "$x264_file" \ | |
; then | |
if [[ -f "$x264_file" ]]; then | |
rm "$x264_file" | |
fi | |
exit 1 | |
fi | |
set -e | |
fi | |
# remove file in assets directory | |
if [[ -f "$video_file" ]]; then | |
rm "$video_file" | |
fi | |
# create symlink to x264 file | |
ln -s "$x264_file" "$video_file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment