Last active
October 19, 2022 22:44
-
-
Save andrewmackrodt/c94bd40dffd0b6c966727954adf16e16 to your computer and use it in GitHub Desktop.
Persona 4 Arena Ultimax 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 P4AU Microsoft ASF media to X264/Opus so that Proton Experimental | |
# or Proton GE can play cutscene video and audio. If there is no audio, go to | |
# "Options" > "System Options" and disable "Mute when not in focus" from within the game. | |
# | |
# Move the script to ${steam_library}/steamapps/common/P4U2 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. | |
# | |
# The original Microsoft ASF files will be moved to "./asset/wmv", move them back into | |
# the "asset" 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)/asset" | |
# for f in $(ls -1); do file "$f"; done | awk '$0 ~ /ASF/ { print $1 }' | sed 's/://' | |
video_files=$(cat <<'EOF' | |
020fa419c16441753ec90b2dcd2c5863 | |
02dda45f9db9d218ff77fad1f13ea240 | |
06bd565f966f89dca8c79219b50717bf | |
071e67fa6f81425c58baf1fa10e7be4a | |
08da063a6afd9ad985293284c2516f31 | |
093c4c6d48ba5e3828b013da96fd71c6 | |
0f30d0128e0c0c6b64321453d4d56b7e | |
131d8940f0d16d5e6ada3231830a6492 | |
1ad8fdd5c8bcbc21f6dd9733cd3d22ad | |
1d5b74ae23e5d954ca59520210087caf | |
1da1a41dad378a26cdb902f97a9d7d29 | |
266e03cc68d45a7c59a524ce26798634 | |
332efee9c47f35500b69717ae2640a90 | |
3626f6e01d606975293c5ccb4b3d9cc4 | |
3ca39d8d867eb6d7c237aec1782899af | |
421bd1bb679f2a5b9795363fda820485 | |
47cca3c326567b6b1d1c0619c54d73ca | |
48b70de9bd52e4bf7508001509d5794a | |
4d85718d723c1e238a399714589530c4 | |
570998842a7639081b2abdec43b0eaae | |
57eacf26e839c180758917411e1a3a14 | |
5f87cf0f28be367d1860d35f4c9cf97d | |
611a21eced9011b8139ecffffc2fc4ae | |
611d3bc8133b06909ca53b31f22eb71f | |
62653eff47d340aa535dba785a88e528 | |
6c78d58f23f1aa0e2fbeafc701529716 | |
77539be366b080158fd7fb22df460995 | |
7a7ae225e4e9f6f9be8261ee2d6286ab | |
7cae9410a2f26c43d6666ef630afed4d | |
7fc7ecc7d603b020e5eb16a4a52e455d | |
804aec782932b255f2d78ebf7a058e05 | |
860f7a9725ecc25609390c29f6ee9e50 | |
86bb037f881dcdfae5d8e3b782f4a14c | |
872c9838ebe127b693f486f37db70965 | |
88aa3b1a1093fa7c7972a2283b13ee0b | |
88dfb15f3eb61c93be6e3aa3ae656059 | |
90a47aa5ebb9abebcafb1ff8ac74770d | |
934be5befa188690f3c19ae4d7b2ef29 | |
939eb6d46fd22e5f849bee815332a0d9 | |
944099c666af24757423d10d5d87d6a6 | |
9f0fdb831252d9024b6b54348fc97d32 | |
9fa7e9fecaa0642dab7923b84e596e42 | |
a258ea062605f4d457c1435fb4282af3 | |
a529d2b026eea8434a7a48a15ef6bc86 | |
a66fa80a6a5d80217e7c095971ff1458 | |
a6ab5d188ba192b4a1c82496afafa3e4 | |
a821d7ebc44afb2b284f62d84332393e | |
abeeec0f5c876d44fc63cfbd31f8a44a | |
ac11ea8f22b941c35a97a62beffd915c | |
afaf21ffa425af947d2db072fb4d86b4 | |
b2c6fa064d94ed563927f7c6aa2af4cf | |
b4010ef4b6bc31e2fa768b0db5d01c71 | |
b8fb651e567d1759d940c00d1e13a802 | |
bfa3d50313885c0d7b2dfb259eee8ebd | |
c1201ed0fa81102b70d67627a9df724c | |
ca2bd7d4e9649fd35078beeb4d7a4811 | |
cb5033a145e6431a5975a52635a22876 | |
d0d598c62815a52e82cecd8e67d0173d | |
d212ea560646515a8df2e03e14f40b05 | |
d7ac284350145ce7023c7ab84bb11bae | |
e5a343a4d811cd0b39314b125b33a876 | |
e5de39e90950de93d0edf92631f1df71 | |
e631b2d34161ac5b7b78f561f3a906a8 | |
e6a0d65e15e5e4a8e91f69e58e6d8f0a | |
e85efde2ec4da92a0b2da9ac7f79a18a | |
e86bbd4d4989dff539c73aa05070c8f6 | |
ee184a7a180a5743e1fc79a4a53f9322 | |
f07268f2ae41bb86aa2ca715e17d3e7f | |
f07d083b75f06a6c6bdda3e951d95b30 | |
f3d79342089f8633ee80be97a49a500b | |
f6bb770c23a626bb07f65d8eb58b7287 | |
fde2b5bb87fe32535bcb4a4b7adae502 | |
fe6f25ab9171626215cd287bd5a12260 | |
EOF | |
) | |
# original microsoft asf directory | |
wmv_dir="wmv" | |
if [[ ! -d "$wmv_dir" ]]; then | |
mkdir -p "$wmv_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 wmv directory | |
wmv_file="$wmv_dir/$video_file" | |
if [[ ! -f "$wmv_file" ]] && [[ -f "$video_file" ]] && [[ ! -L "$video_file" ]]; then | |
mv "$video_file" "$wmv_file" | |
fi | |
# x264 file | |
x264_file="$x264_dir/$video_file" | |
if [[ ! -f "$x264_file" ]] && [[ -f "$wmv_file" ]]; then | |
set +e | |
if ! ffmpeg -i "$wmv_file" -hide_banner \ | |
-c:v libx264 -preset slow -crf 18 \ | |
-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