How to make a patch
Hi10 Anime :: Hi10 Anime :: Hi10 Guides
Page 1 of 1
How to make a patch
The one and only, zeust presents another guide for noobs.
Let's get started.
Required Tools:
Get the required tool.
- xdelta3 GUI
It has xdelta3.exe plus the GUI to use it. It's quite simple and never gave me a problem.
X-1: Insert the old file. File that contains some kind of error that you need to patch up.
X-2: Insert the new file. File that you have corrected and contains no error as of the moment.
X-3: Browse files.
X-4: Same as X-1, except that you need to select the directory rather than a single file.
X-5: Same as X-2, except that you need to select directory again.
X-6: Browse directories.
X-7: Show command line, if you need to see it for any reason.
X-8: Creates the patch for a single file. When pressed, it will ask to choose a directory where patch should be created.
X-9: Same as X-8, except that it creates the patch for the batch.
X-10: Exit GUI, simply.
X-2: Insert the new file. File that you have corrected and contains no error as of the moment.
X-3: Browse files.
X-4: Same as X-1, except that you need to select the directory rather than a single file.
X-5: Same as X-2, except that you need to select directory again.
X-6: Browse directories.
X-7: Show command line, if you need to see it for any reason.
X-8: Creates the patch for a single file. When pressed, it will ask to choose a directory where patch should be created.
X-9: Same as X-8, except that it creates the patch for the batch.
X-10: Exit GUI, simply.
X-11: Compression level. Keep it to 9. That's what I choose.
Rest is not important.
Patching
Let's say the I create a patch for the 3rd Episode of Cuticle Tantei Inaba.
First file would be normal file.
Second would be v2 file.
I'll put both files in the GUI and hit Create Patch.
I'll be asked to choose a place for the patch.
Done. I'll get something like this.
All these three files are necessary to execute a patch correctly.
VCDIFF file: It contains the data that will change the normal file to v2.
xdelta3.exe: It is the platform which allows the transformation.
Batch file (.bat): It commands the system to start the process accordingly.
To patch the file.
- Place the normal file in the folder.
- Run .bat file.
- You'll get v2 file.
- Old file (normal file) will be deleted automatically. (Explained below.)
If I open the .bat file shown above for Cuticle Tantei Inaba via notepad or any text editor. It will show this.
Patching is done.
Time for some tips.
1- Technically, you can make a patch for any file. Let's say you have One Piece Episode you can make a patch that will change it to Naruto Shippuden Episode. But, obviously, the size would be the same as that of Naruto Shippuden Episode.
2- To avoid re-uploading a certain thing, you can simple create a patch and upload the patch.
3- The smaller the difference between 2 files, the smaller would be the size of the patch.
Example of how to use your brain (and logic).
- Let's say there is a 60sec encoded video.
- A glitch appears at (41-49)sec, from some reason whereas, source doesn't have the glitch.
There are four ways to get rid of this problem.
Method 1: Ignore it. (My fav.)
Method 2: Re-encode it and upload the new file.
Method 3: Re-encode it, make a patch by comparing it with old file and upload the patch.
Method 4: Use your brain. (Re-encode and patch carefully.)
Explanation of Method 4.
Get Mkvmerge, open the encoded and glitched file, cut the encoded 60sec video in this way.
- Part A, containing (01-40)sec.
- Part C, containing (50-60)sec.
- Part B, containing the glitched (41-49)sec. As it is glitched, ditch it. (Discard it).
Now, again using mkvmerge, open the source of 60sec video.
- Cut the source from (41-49)sec. As it is a source, it shouldn't have a glitch.
- Consider this the Part B_test.
- Encode this part with same settings as used for the 60sec video.
- Consider the encoded part as Part B, now.
_________________________________
Now, we have all the part A, B and C.
- Use mkvmerge, and append them.
- New v2 file is ready.
- Create a patch comparing the old file with the v2 file.
Advantages:
a)- You won't have to re-encode the whole file, thus time is saved.
b)- As only the glitched part is different from old file, the patch would be small sized.
c)- Since it's not as tedious as re-encoding a whole file, you'd be willing to patch things that you wouldn't have otherwise.
d)- It will make you proud as humans rarely use their brain.
An important fact:
A simple question arises, that is again if you used your brain to read all this.
- I encoded a file. It (v1) had a glitch for some reason.
- To fix that I re-encoded the file using the same setting and now glitch is gone from v2.
- So if I make a patch comparing the v1 and v2, wouldn't the patch be small as the only difference is the glitched part?
Answer: No.
__________________________________________
As far as I know and experienced, even if you encode a file using the exact same settings the encoded file will be different algorithmically. Visually it will be identical, though. So when you'll patch it up the patch size would be way too big.
For example,
I recently patched up an episode ~120MiB, using Method 4 and the patch size was ~50KiB.
I tried the Method 3 and patched it up and the patch size was ~120MiB. (same as v2 file.)
Yet another Important fact:
This one is not for noobs exactly, so I'll be kind XD.
- I said that cut the file using mkvmerge in a way that only the glitched part gets eradicated but, it is not necessary that mkvmerge will cut it accurately.
- Mkvmerge cuts video on the basis of keyframes. In simple language a keyframe occurs when a scene changes abruptly. (To visualize keyframes, you can open the video in Aegisub.)
- Whether a glitch happens at a keyframe or not is a matter of luck. If the glitch is away from keyframe, mkvmerge won't cut it accurately.
-In above case, you should try to cut the video as accurately as mkvmerge can get. Then observe how much of the part is cut and cut the same part from the source. I know it's difficult, but that's where your expertise is tested. Anyhow, I use Avisynth to keep tracks of the cut frames (rather than time) and cut the same frames from source, encode it and mux it.
Fun Fact:
- While making an Ordered Chapter file (OC), as scene usually changes abruptly just when OP and ED starts in Anime, amateurs think that their mkvmerge can cut things correctly. XD But actually it isn't. If your mkvmerge can cut OP, ED correctly, that just means that keyframes are at that positions. Means you're lucky.
Do good have good - As you sow so shall you reap.
This world is full of evil. Evil is spreading and good (white) deeds are vanishing. My point is...
Now that I have shown you the way to patch files and given you some cool tips, it will be nice to stand up and help us out when you have the time.
Like, if you find any err file and you have the source of that file, you can patch it for us and let us know so that we can add it to the site / post. (Given that encoder is busy or not willing to patch it, for some reason.) Consequently, it will help others out.
Such nice deeds are what make us human(e) and you will certainly find inner peace. As once found by panda in Kung-Fu Panda 2. XD
______________________________________________________________________
If i get the time, or if I'm in mood, I'll make a guide for keyframes. (Tools: Avisynth, Mkvmerge, Aegisub)
Rest is not important.
Patching
Let's say the I create a patch for the 3rd Episode of Cuticle Tantei Inaba.
First file would be normal file.
Second would be v2 file.
I'll put both files in the GUI and hit Create Patch.
I'll be asked to choose a place for the patch.
Done. I'll get something like this.
All these three files are necessary to execute a patch correctly.
VCDIFF file: It contains the data that will change the normal file to v2.
xdelta3.exe: It is the platform which allows the transformation.
Batch file (.bat): It commands the system to start the process accordingly.
To patch the file.
- Place the normal file in the folder.
- Run .bat file.
- You'll get v2 file.
- Old file (normal file) will be deleted automatically. (Explained below.)
If I open the .bat file shown above for Cuticle Tantei Inaba via notepad or any text editor. It will show this.
- Code:
@echo off
echo Applying Patch %progress%
xdelta3.exe -d -vfs "(Hi10)_Cuticle_Tantei_Inaba_-_03_(720p)_(HorribleSubs).mkv" "(Hi10)_Cuticle_Tantei_Inaba_-_03_(720p)_(HorribleSubs) Patch file.vcdiff" "(Hi10)_Cuticle_Tantei_Inaba_-_03_v2_(720p)_(HorribleSubs).mkv"
echo File successfully patched! Deleting old file...
Del "(Hi10)_Cuticle_Tantei_Inaba_-_03_(720p)_(HorribleSubs).mkv"
@pause
- Code:
@echo off
echo Applying Patch %progress%
xdelta3.exe -d -vfs "(Hi10)_Cuticle_Tantei_Inaba_-_03_(720p)_(HorribleSubs).mkv" "(Hi10)_Cuticle_Tantei_Inaba_-_03_(720p)_(HorribleSubs) Patch file.vcdiff" "(Hi10)_Cuticle_Tantei_Inaba_-_03_v2_(720p)_(HorribleSubs).mkv"
echo File successfully patched!
@pause
Patching is done.
Time for some tips.
1- Technically, you can make a patch for any file. Let's say you have One Piece Episode you can make a patch that will change it to Naruto Shippuden Episode. But, obviously, the size would be the same as that of Naruto Shippuden Episode.
2- To avoid re-uploading a certain thing, you can simple create a patch and upload the patch.
3- The smaller the difference between 2 files, the smaller would be the size of the patch.
Example of how to use your brain (and logic).
- Let's say there is a 60sec encoded video.
- A glitch appears at (41-49)sec, from some reason whereas, source doesn't have the glitch.
There are four ways to get rid of this problem.
Method 1: Ignore it. (My fav.)
Method 2: Re-encode it and upload the new file.
Method 3: Re-encode it, make a patch by comparing it with old file and upload the patch.
Method 4: Use your brain. (Re-encode and patch carefully.)
Explanation of Method 4.
Get Mkvmerge, open the encoded and glitched file, cut the encoded 60sec video in this way.
- Part A, containing (01-40)sec.
- Part C, containing (50-60)sec.
- Part B, containing the glitched (41-49)sec. As it is glitched, ditch it. (Discard it).
Now, again using mkvmerge, open the source of 60sec video.
- Cut the source from (41-49)sec. As it is a source, it shouldn't have a glitch.
- Consider this the Part B_test.
- Encode this part with same settings as used for the 60sec video.
- Consider the encoded part as Part B, now.
_________________________________
Now, we have all the part A, B and C.
- Use mkvmerge, and append them.
- New v2 file is ready.
- Create a patch comparing the old file with the v2 file.
Advantages:
a)- You won't have to re-encode the whole file, thus time is saved.
b)- As only the glitched part is different from old file, the patch would be small sized.
c)- Since it's not as tedious as re-encoding a whole file, you'd be willing to patch things that you wouldn't have otherwise.
d)- It will make you proud as humans rarely use their brain.
An important fact:
A simple question arises, that is again if you used your brain to read all this.
- I encoded a file. It (v1) had a glitch for some reason.
- To fix that I re-encoded the file using the same setting and now glitch is gone from v2.
- So if I make a patch comparing the v1 and v2, wouldn't the patch be small as the only difference is the glitched part?
Answer: No.
__________________________________________
As far as I know and experienced, even if you encode a file using the exact same settings the encoded file will be different algorithmically. Visually it will be identical, though. So when you'll patch it up the patch size would be way too big.
For example,
I recently patched up an episode ~120MiB, using Method 4 and the patch size was ~50KiB.
I tried the Method 3 and patched it up and the patch size was ~120MiB. (same as v2 file.)
Yet another Important fact:
This one is not for noobs exactly, so I'll be kind XD.
- I said that cut the file using mkvmerge in a way that only the glitched part gets eradicated but, it is not necessary that mkvmerge will cut it accurately.
- Mkvmerge cuts video on the basis of keyframes. In simple language a keyframe occurs when a scene changes abruptly. (To visualize keyframes, you can open the video in Aegisub.)
- Whether a glitch happens at a keyframe or not is a matter of luck. If the glitch is away from keyframe, mkvmerge won't cut it accurately.
-In above case, you should try to cut the video as accurately as mkvmerge can get. Then observe how much of the part is cut and cut the same part from the source. I know it's difficult, but that's where your expertise is tested. Anyhow, I use Avisynth to keep tracks of the cut frames (rather than time) and cut the same frames from source, encode it and mux it.
Fun Fact:
- While making an Ordered Chapter file (OC), as scene usually changes abruptly just when OP and ED starts in Anime, amateurs think that their mkvmerge can cut things correctly. XD But actually it isn't. If your mkvmerge can cut OP, ED correctly, that just means that keyframes are at that positions. Means you're lucky.
Do good have good - As you sow so shall you reap.
This world is full of evil. Evil is spreading and good (white) deeds are vanishing. My point is...
Now that I have shown you the way to patch files and given you some cool tips, it will be nice to stand up and help us out when you have the time.
Like, if you find any err file and you have the source of that file, you can patch it for us and let us know so that we can add it to the site / post. (Given that encoder is busy or not willing to patch it, for some reason.) Consequently, it will help others out.
Such nice deeds are what make us human(e) and you will certainly find inner peace. As once found by panda in Kung-Fu Panda 2. XD
______________________________________________________________________
If i get the time, or if I'm in mood, I'll make a guide for keyframes. (Tools: Avisynth, Mkvmerge, Aegisub)
Last edited by zeust on Sat Jun 21, 2014 6:46 am; edited 6 times in total (Reason for editing : Bite me)
zeust- Admin
- Posts : 69
Points : 4750
Reputation : 33
Join date : 2013-06-05
Age : 29
Location : 無 - Nothingness
Character sheet
Character Name: Uchiha Itachi
Profession: Nukenin
Level:
(1/1)
Hi10 Anime :: Hi10 Anime :: Hi10 Guides
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum