View Full Version : Solving the BinkPack Problem [+Oggre]
Masquerade
15-03-2022, 10:05
TL;DR - Stop using FreeArc!
I am sure you will agree that at some point you will have found a game which contains bink videos that BPK can compress, but you get a CRC check error or broken file crash when you try to extract your archive.
The issue with this is that BPK is slightly bugged in that it can extract the files it compresses, but a couple of bytes will be incorrect which causes the crash with FreeArc. FreeArc checks each file it extracts to ensure that the CRC is the same as the file that was compressed.
Since the file that BPK unpacks is different in some places, you can easily just patch the extracted bink video to the original video.
I will demonstrate with a video from Forza Horizon 5 - the issue with this video is that CLS-BPK.DLL will get stuck when decoding and endlessly output to the file. But, by using the EXE version of bpk and a little HDIFFZ magic, we can now avoid all the issues and have a significantly smaller repack.
This works for oggre too! Use the EXE versions of both and ignore the CLS.
https://i.ibb.co/XCj6H3B/Capture.png
*.BINKDIFF = HDiffZ patch between original bink and tmp extracted bink from bugged BPK
*.BK2 = original video.
*.BPK = packed video.
*.TMP = tmp extracted bink from bugged BPK
All binks I got so far were bpk bugs out keeps unpacking infinitely without any error message from arc.exe. Only installers telling me that something is wrong :(
https://i.imgur.com/hXFgZDq.png
But thanks anyway for this topic and especially for the information.
Masquerade
15-03-2022, 10:33
...
Can you upload the file? I tested on such a video that would endlessly unpack in the example above.
Oh well, I didn't read your tldr.. All is clear now :)
L33THAK0R
16-03-2022, 16:15
Fascinating stuff, will definitely test this method out, got a couple dozen repacks I put on hold due to "Oggre" failing to properly decompress with FreeArc, fingers crossed I can finally finish em now!
Can someone upload a small sample bik file that causes this error? Would like to test.
:( Sad8669
19-03-2022, 07:03
It's been a while.
Here (https://pixeldrain.com/u/4y8WxmDg)
P.S : i asked KaktoR once, while i was looking into bink files, he sent me this sample.
Tested the "Kro001_ExoIntro_Drop.bik" file compressed with use various CLS-BPK dll's (91.5/227/663kB size) again and again from decompressing.
unarc.exe: Get "failed CRC check" error message, not decompressing the BIK file from archive.
Arc.exe: Process not finished and still in 100% and infinitely looping decompress the BIK file, writing to again and again in whole time.
Screen: https://i.kek.sh/qtDtatG5oGo.png
Infinitely extracted "Kro001_ExoIntro_Drop.bik" file sample from analyze: https://pixeldrain.com/u/sJHwUPKB
Don't use the cls.
Use bink_pack.exe and bink_unpack.exe
i try this, but failed, what wrong with this ?
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3dBEdRgW4OgX5uqHesF875hl5Bd2EukBHVOG5ewuHkT XtHyUXzG7-KkM4mHqCZu_0DJkHwC4juWJMA_MaDzYRPIbAcL8r4O4zGez4s9 pKeWoBJZiVwgIrOG_doHHOtp8O4R9C_L75iqVI-82q_yxqzMXCDjjdBlmDXO7Ewppe0QsKRyr_ZBilAQBI2A/s1110/what%20wrong.png
Hexagon123
04-09-2022, 23:54
i try this, but failed, what wrong with this ?
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3dBEdRgW4OgX5uqHesF875hl5Bd2EukBHVOG5ewuHkT XtHyUXzG7-KkM4mHqCZu_0DJkHwC4juWJMA_MaDzYRPIbAcL8r4O4zGez4s9 pKeWoBJZiVwgIrOG_doHHOtp8O4R9C_L75iqVI-82q_yxqzMXCDjjdBlmDXO7Ewppe0QsKRyr_ZBilAQBI2A/s1110/what%20wrong.png
You did it wrong, hdiffz (insert temp file) (insert original file) (insert diff file), then hpatchz (insert temp file) (insert diff file) (insert new file)
You did it wrong, hdiffz (insert temp file) (insert original file) (insert diff file), then hpatchz (insert temp file) (insert diff file) (insert new file)
yeah, thanks,
hpatchz :D and hdiffz (insert temp file) (insert original file) (insert diff file)
Maybe something is not clear enough, here is a example batch.
PS: You can delete echo and pause commands. I just made them to show the steps
@echo off
echo. Compress bink files
for /r %%f in (*.bik) do bink_pack "%%f" "%%~df%%~pf%%~nf.bpk_compressed
pause
echo. Unpack compressed file
for /r %%f in (*.bpk_compressed) do bink_unpack "%%f" "%%~df%%~pf%%~nf.tmp_for_patch_creation"
pause
echo. Create diff from original vs unpacked file
for /r %%f in (*.tmp_for_patch_creation) do hdiffz "%%f" "%%~df%%~pf%%~nf.bik" "%%~df%%~pf%%~nf.BinkDIFF"
pause
echo. Delete unpacked files ("*.tmp_for_patch_creation") which were just extracted for patch creation purposes, you no longer need them
del /Q /F /S "*.tmp_for_patch_creation"
pause
echo. ------------------------------------------------------------
echo. On this point you should exclude all "*.bik" files or move them to a backup dir (you can use robocopy for ease)
echo. because you only need to pack "*.bpk_compressed" and "BinkDIFF" files.
echo. Now you have to pack your game files like you normally would
echo. ------------------------------------------------------------
echo.
echo. ------------------------------------------------------------
echo. After installing with Setup or similar, app folder should contain
echo. "*.bpk_compressed" and "*.BinkDIFF" files instead of original "*.bik* files
echo. ------------------------------------------------------------
echo. Unpack compressed to "*.bik_bad_crc"
for /r %%f in (*.bpk_compressed) do bink_unpack "%%f" "%%~df%%~pf%%~nf.bik_bad_crc"
pause
echo. Patch "*.bik_bad_crc" back to original with "*.BinkDIFF" files ("input_file"" input_diff" "output_file")
for /r %%f in (*.bik_bad_crc) do hpatchz.exe "%%~df%%~pf%%~nf.bik_bad_crc" "%%~df%%~pf%%~nf.BinkDIFF" "%%~df%%~pf%%~nf.bik_good_crc"
pause
echo. Rename all file extensions from "*.bik_good_crc" to "*.bik"
ren "*.bik_good_crc" "*.bik"
pause
echo. Remove all temp files
del /Q /F /S "*.bik_bad_crc"
del /Q /F /S "*.BinkDIFF"
del /Q /F /S "*.bpk_compressed"
del /S "hdiffz.exe"
del /S "hpatchz.exe"
pause
Maybe something is not clear enough, here is a example batch.
PS: You can delete echo and pause commands. I just made them to show the steps
@echo off
echo. Compress bink files
for /r %%f in (*.bik) do bink_pack "%%f" "%%~df%%~pf%%~nf.bpk_compressed
pause
echo. Unpack compressed file
for /r %%f in (*.bpk_compressed) do bink_unpack "%%f" "%%~df%%~pf%%~nf.tmp_for_patch_creation"
pause
echo. Create diff from original vs unpacked file
for /r %%f in (*.tmp_for_patch_creation) do hdiffz "%%f" "%%~df%%~pf%%~nf.bik" "%%~df%%~pf%%~nf.BinkDIFF"
pause
echo. Delete unpacked files ("*.tmp_for_patch_creation") which were just extracted for patch creation purposes, you no longer need them
del /Q /F /S "*.tmp_for_patch_creation"
pause
echo. ------------------------------------------------------------
echo. On this point you should exclude all "*.bik" files or move them to a backup dir (you can use robocopy for ease)
echo. because you only need to pack "*.bpk_compressed" and "BinkDIFF" files.
echo. Now you have to pack your game files like you normally would
echo. ------------------------------------------------------------
echo.
echo. ------------------------------------------------------------
echo. After installing with Setup or similar, app folder should contain
echo. "*.bpk_compressed" and "*.BinkDIFF" files instead of original "*.bik* files
echo. ------------------------------------------------------------
echo. Unpack compressed to "*.bik_bad_crc"
for /r %%f in (*.bpk_compressed) do bink_unpack "%%f" "%%~df%%~pf%%~nf.bik_bad_crc"
pause
echo. Patch "*.bik_bad_crc" back to original with "*.BinkDIFF" files ("input_file"" input_diff" "output_file")
for /r %%f in (*.bik_bad_crc) do hpatchz.exe "%%~df%%~pf%%~nf.bik_bad_crc" "%%~df%%~pf%%~nf.BinkDIFF" "%%~df%%~pf%%~nf.bik_good_crc"
pause
echo. Rename all file extensions from "*.bik_good_crc" to "*.bik"
ren "*.bik_good_crc" "*.bik"
pause
echo. Remove all temp files
del /Q /F /S "*.bik_bad_crc"
del /Q /F /S "*.BinkDIFF"
del /Q /F /S "*.bpk_compressed"
del /S "hdiffz.exe"
del /S "hpatchz.exe"
pause
help out, thanks kaktor
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.