Joined: 8/3/2008
Posts: 254
Will this also remove the borders on the sides?
Guernsey Adams Pierre
fsvgm777
She/Her
Senior Publisher, Player (221)
Joined: 5/28/2009
Posts: 1185
Location: Luxembourg
Yes, this will remove the borders on the sides. No, you absolutely don't need them for the resulting upload to be in HD.
Steam Community page - Cohost profile Oh, I'm just a concerned observer.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
Guernsey (PM) wrote:
What is your setup for AVISynth regarding SNES videos in HD as well as cropping the borders?
I usually don't crop borders. Preparation: 1. get Avisynth, AvsPmod (Avisynth editor), VirtualDub, x264vfw, lame, mkvtoolnix 2. get the movie's BizHawk version Dump video: 1. start BizHawk (EmuHawk), load ROM file, pause, disable "always double-size framebuffer" in "menu | SNES | Options" 2. load movie file, start AVI recording (Lagarith codec, enable null frames, use multithreading, RGB mode) 3. unpause, disable speed throttling, wait until movie finishes Edit video: 1. create directory with the same name as the AVI file, put it in there and rename to "00.avi" 2. create empty text file "00.avs", open in AvsPmod, enter text:
Language: Avisynth

Load("00") # assuming 256x224, convert to 512x720 # Several "Load" calls can be chained together: Load("00a") + Load("00b") + Load("00c") # Note that you should use the "hires_x" and "hires_y" parameters if you know that the game doesn't use horz. or vert. hi-res. # If at least one file is > 239p then they should all be loaded as 1080p to minimize blank lines. function Load(string FileName, bool "hires_x", bool "hires_y", bool "_1080p", bool "fix_audio", bool "fix_aspect") { hires_x = default(hires_x, false) hires_y = default(hires_y, false) _1080p = default(_1080p, false) # 720p if false fix_audio = default(fix_audio, false) fix_aspect = default(fix_aspect, false) AVISource(FileName + ".avi") # 60.0985 fps (NTSC) or 50.0070 fps (PAL) Fix_FPS # required for Youtube ((!hires_x) && (Width > 256)) ? ReduceX : last # reduce the width if it's known to be low-res ((!hires_y) && (Height > 239)) ? ReduceY : last # reduce the height if it's known to be low-res (fix_audio) ? Fix_AudioSampleRate : last # required if the audio encoder doesn't accept non-standard rates (!_1080p) ? Get_720p : Get_1080p # resize (fix_aspect) ? Fix_AspectRatio : Resize_X(2) # if false then at least adjust for h.264 color subsampling } function Fix_FPS(clip c) { # resulting audio is 44028 Hz (NTSC) or 44094 Hz (PAL) c i = (abs(FrameRate - 60) < abs(FrameRate - 50)) ? 60 : 50 AssumeFPS(i, true) } function ReduceX(clip c) {c.PointResize(c.Width / 2, c.Height )} function ReduceY(clip c) {c.PointResize(c.Width, c.Height / 2)} function Fix_AudioSampleRate(clip c) {c.ResampleAudio(44100)} function Get_720p(clip c) { c (Height == 224) ? Resize_Y(3).Letterbox( 720) : last # (NTSC) 48 blank lines (Height == 448) ? Letterbox( 720) : last # (NTSC) 272 blank lines (Height == 239) ? Resize_Y(3).Letterbox( 720) : last # (PAL) 3 blank lines (Height == 478) ? Letterbox( 720) : last # (PAL) 272 blank lines } function Get_1080p(clip c) { c (Height == 224) ? Resize_Y(4).Letterbox(1080) : last # (NTSC) 184 blank lines (Height == 448) ? Resize_Y(2).Letterbox(1080) : last # (NTSC) 184 blank lines (Height == 239) ? Resize_Y(4).Letterbox(1080) : last # (PAL) 124 blank lines (Height == 478) ? Resize_Y(2).Letterbox(1080) : last # (PAL) 124 blank lines } function Resize_X(clip c, int i) {c.PointResize(c.Width * i, c.Height )} function Resize_Y(clip c, int i) {c.PointResize(c.Width, c.Height * i)} function Letterbox(clip c, int new_Height) { c i1 = int((new_Height - Height) / 2) i2 = new_Height - Height - i1 AddBorders(0, i1, 0, i2) } function Fix_AspectRatio(clip c) { # not required if you put the output file into an MKV file and set the aspect ratio there c Spline64Resize(Height * 4 / 3, Height) }
3. save, open script file in VirtualDub Encode video: 1. set video encoding to "Fast Recompress" and video compression to x264vfw (convert to YUV, CRF=16, VirtualDub hack checked) 2. set audio encoding to "Full processing mode" and audio compression to Lame MP3, e.g. 44100Hz 192kbps CBR (or extract the audio and compress it with an external encoder) 3. encode to "01.avi" (and "01.wav" if using an external encoder) 4. open the new AVI (and WAV) file in MKVToolNix GUI, set the aspect ratio to 4:3 Then upload to Youtube.
Guernsey wrote:
Will this also remove the borders on the sides?
There should be no borders to the left or to the right, unless the game put them there. If so then they would appear on a real CRT TV, and should not be removed before the 4:3 resize. Likewise with the borders on the top or bottom. But even if a game uses horz. borders it wouldn't change much since 4:3 on a 16:9 display results in horz. borders anyway. You can use for example AvsPmod's preview function to add Crop commands to the script. Note that you need at least 720 lines to enable HD quality and the 60 Hz functionality on Youtube.
Joined: 8/3/2008
Posts: 254
creaothceann wrote:
Guernsey (PM) wrote:
What is your setup for AVISynth regarding SNES videos in HD as well as cropping the borders?
I usually don't crop borders. Preparation: 1. get Avisynth, AvsPmod (Avisynth editor), VirtualDub, x264vfw, lame, mkvtoolnix 2. get the movie's BizHawk version Dump video: 1. start BizHawk (EmuHawk), load ROM file, pause, disable "always double-size framebuffer" in "menu | SNES | Options" 2. load movie file, start AVI recording (Lagarith codec, enable null frames, use multithreading, RGB mode) 3. unpause, disable speed throttling, wait until movie finishes Edit video: 1. create directory with the same name as the AVI file, put it in there and rename to "00.avi" 2. create empty text file "00.avs", open in AvsPmod, enter text:
Language: Avisynth

Load("00") # assuming 256x224, convert to 512x720 # Several "Load" calls can be chained together: Load("00a") + Load("00b") + Load("00c") # Note that you should use the "hires_x" and "hires_y" parameters if you know that the game doesn't use horz. or vert. hi-res. # If at least one file is > 239p then they should all be loaded as 1080p to minimize blank lines. function Load(string FileName, bool "hires_x", bool "hires_y", bool "_1080p", bool "fix_audio", bool "fix_aspect") { hires_x = default(hires_x, false) hires_y = default(hires_y, false) _1080p = default(_1080p, false) # 720p if false fix_audio = default(fix_audio, false) fix_aspect = default(fix_aspect, false) AVISource(FileName + ".avi") # 60.0985 fps (NTSC) or 50.0070 fps (PAL) Fix_FPS # required for Youtube ((!hires_x) && (Width > 256)) ? ReduceX : last # reduce the width if it's known to be low-res ((!hires_y) && (Height > 239)) ? ReduceY : last # reduce the height if it's known to be low-res (fix_audio) ? Fix_AudioSampleRate : last # required if the audio encoder doesn't accept non-standard rates (!_1080p) ? Get_720p : Get_1080p # resize (fix_aspect) ? Fix_AspectRatio : Resize_X(2) # if false then at least adjust for h.264 color subsampling } function Fix_FPS(clip c) { # resulting audio is 44028 Hz (NTSC) or 44094 Hz (PAL) c i = (abs(FrameRate - 60) < abs(FrameRate - 50)) ? 60 : 50 AssumeFPS(i, true) } function ReduceX(clip c) {c.PointResize(c.Width / 2, c.Height )} function ReduceY(clip c) {c.PointResize(c.Width, c.Height / 2)} function Fix_AudioSampleRate(clip c) {c.ResampleAudio(44100)} function Get_720p(clip c) { c (Height == 224) ? Resize_Y(3).Letterbox( 720) : last # (NTSC) 48 blank lines (Height == 448) ? Letterbox( 720) : last # (NTSC) 272 blank lines (Height == 239) ? Resize_Y(3).Letterbox( 720) : last # (PAL) 3 blank lines (Height == 478) ? Letterbox( 720) : last # (PAL) 272 blank lines } function Get_1080p(clip c) { c (Height == 224) ? Resize_Y(4).Letterbox(1080) : last # (NTSC) 184 blank lines (Height == 448) ? Resize_Y(2).Letterbox(1080) : last # (NTSC) 184 blank lines (Height == 239) ? Resize_Y(4).Letterbox(1080) : last # (PAL) 124 blank lines (Height == 478) ? Resize_Y(2).Letterbox(1080) : last # (PAL) 124 blank lines } function Resize_X(clip c, int i) {c.PointResize(c.Width * i, c.Height )} function Resize_Y(clip c, int i) {c.PointResize(c.Width, c.Height * i)} function Letterbox(clip c, int new_Height) { c i1 = int((new_Height - Height) / 2) i2 = new_Height - Height - i1 AddBorders(0, i1, 0, i2) } function Fix_AspectRatio(clip c) { # not required if you put the output file into an MKV file and set the aspect ratio there c Spline64Resize(Height * 4 / 3, Height) }
3. save, open script file in VirtualDub Encode video: 1. set video encoding to "Fast Recompress" and video compression to x264vfw (convert to YUV, CRF=16, VirtualDub hack checked) 2. set audio encoding to "Full processing mode" and audio compression to Lame MP3, e.g. 44100Hz 192kbps CBR (or extract the audio and compress it with an external encoder) 3. encode to "01.avi" (and "01.wav" if using an external encoder) 4. open the new AVI (and WAV) file in MKVToolNix GUI, set the aspect ratio to 4:3 Then upload to Youtube.
Guernsey wrote:
Will this also remove the borders on the sides?
There should be no borders to the left or to the right, unless the game put them there. If so then they would appear on a real CRT TV, and should not be removed before the 4:3 resize. Likewise with the borders on the top or bottom. But even if a game uses horz. borders it wouldn't change much since 4:3 on a 16:9 display results in horz. borders anyway. You can use for example AvsPmod's preview function to add Crop commands to the script. Note that you need at least 720 lines to enable HD quality and the 60 Hz functionality on Youtube.
Do I copy the whole thing or just the part with the algorithms? Also, So just to be clear: PointResize(last.width * 8,last.height * 8) Do I replace the Point Resize with the width and height with the asterisk? Or do I remove the asterisk and just put in the numbers?
Guernsey Adams Pierre
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
Guernsey wrote:
Do I copy the whole thing or just the part with the algorithms?
You don't have to duplicate the whole thing when replying... For my own projects I'd just copy the whole thing and change the lines at the top. The functions are only there so that I don't have to repeat the code when I want to join several AVI files. Note that the functions aren't set in stone. They could for example be edited to add a scanline effect (not like a shader, just some darker lines). It's also important to not just copy them without understanding what they do...
Guernsey wrote:
PointResize(last.width * 8,last.height * 8) Do I replace the Point Resize with the width and height with the asterisk? Or do I remove the asterisk and just put in the numbers?
That's just a multiplication; that line makes the clip 8 times larger. A script is like a computer program - you can't just take one line from one script and put it into another script without understanding what it does and/or why it's at that location. Read the Avisynth documentation / wiki and do some experimenting.
Darth_Marios
He/Him
Joined: 5/11/2015
Posts: 106
Spikestuff wrote:
Ok, let's go through it. Tekken 3 is a 368x480 game (ignoring the overscan). And my target is 1080p (4:3) for this case since going over that for personal encodes is dumb. Upscale by x4 with a Nearest Neighbor. Readjust the X by making the video 4:3 (lanczos). Downscale back down to 1080p (lanczos). Now you have an encode. Now I can't recall which emulator Astaroth was using back then but if memory serves me correctly it was PSXjin (since you can tell by his Tekken 2 TASes). Due to his different methods he's gone and thrown a smoothing filter over it to "clean" it up. Which is why it looks "smooth", which in reality is worse than having the raw detail.
So that Easy HD temp encode isnt enough. Can you write, in AVIsynth, the steps you told? :D Upscale by x4 with a Nearest Neighbor. <-- This is PointResize(width * 4, height * 4) Readjust the X by making the video 4:3 (lanczos). <-- How this? Downscale back down to 1080p (lanczos). <-- This is just LanczosResize or Lanczos4Resize? And about the smoothing filter: is possible in avisynth? If yes, how? (BilinearResize isnt that good because make even the font and energy bars bluured, while in astaroth video only the 3d polygons was smooth)
Publisher
Joined: 4/23/2009
Posts: 1283
Can you post a sample clip somewhere? I am curious on testing out AreaResize on this.
Darth_Marios
He/Him
Joined: 5/11/2015
Posts: 106
Aktan wrote:
Can you post a sample clip somewhere? I am curious on testing out AreaResize on this.
I cant... i have troubles with internet and now im connected with smartphone. Anyway what AreaResize does?
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
Darth Marios wrote:
Anyway what AreaResize does?
https://forum.doom9.org/showthread.php?t=175297
Darth_Marios
He/Him
Joined: 5/11/2015
Posts: 106
creaothceann wrote:
Darth Marios wrote:
Anyway what AreaResize does?
https://forum.doom9.org/showthread.php?t=175297
Lol since im noob i dont know what it mean. Anyway is better or worse than Lanczos? Is this a good script? (assuming a 320x240 movie and i want 960x720 by upscale x4 and then downscale with lanczos) Video=AVISource("movie.avi") Audio=WAVSource("movie.wav") AudioDub(Video,Audio) PointResize(width * 4, height * 4) LanczosResize(960,720, taps=2) ConvertToYV24(matrix="Rec709", chromaresample="point") ConvertToYV12(matrix="Rec709", chromaresample="lanczos")
Publisher
Joined: 4/23/2009
Posts: 1283
AreaResize just does downscaling with weighted averaging so it might be sharper and less blurry for text. Edit: I made a sample test with AreaResize, here is my result: https://www.youtube.com/watch?v=IncF18TmI1Q&feature=youtu.be Is this what you are aiming for?
Darth_Marios
He/Him
Joined: 5/11/2015
Posts: 106
Aktan wrote:
AreaResize just does downscaling with weighted averaging so it might be sharper and less blurry for text. Edit: I made a sample test with AreaResize, here is my result: https://www.youtube.com/watch?v=IncF18TmI1Q&feature=youtu.be Is this what you are aiming for?
This is really good :D Write down the exact script, thanks. Besides, can i use AreaResize plugin with avisynth portable?
Publisher
Joined: 4/23/2009
Posts: 1283
Darth Marios wrote:
This is really good :D Write down the exact script, thanks. Besides, can i use AreaResize plugin with avisynth portable?
I'm still doing some tests, so be patient. The way I did this requires you have certain settings in Bizhawk (you are using Bizhawk, right?) and also requires fixing the output and then deinterlacing before using PointResize and AreaResize. It is also slow to render. How fast is your computer?
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
Aktan wrote:
deinterlacing
?
Publisher
Joined: 4/23/2009
Posts: 1283
creaothceann wrote:
?
Tekken 3 output is all interlaced. Some games are like that.
Spikestuff
They/Them
Editor, Publisher, Expert player (2292)
Joined: 10/12/2011
Posts: 6337
Location: The land down under.
Aktan wrote:
Some games are like that.
And the entire PS2 games library (or 90% of it).
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
Publisher
Joined: 4/23/2009
Posts: 1283
Here is another test clip of Tekken 3, this time with Spikestuff's TAS: https://www.youtube.com/watch?v=sU0pom91XsE&feature=youtu.be Edit: Just for fun, here is the same TAS with nnedi3 upscaling instead: https://www.youtube.com/watch?v=ShNMOZQjJ4Y&feature=youtu.be
Darth_Marios
He/Him
Joined: 5/11/2015
Posts: 106
Aktan wrote:
Darth Marios wrote:
This is really good :D Write down the exact script, thanks. Besides, can i use AreaResize plugin with avisynth portable?
I'm still doing some tests, so be patient. The way I did this requires you have certain settings in Bizhawk (you are using Bizhawk, right?) and also requires fixing the output and then deinterlacing before using PointResize and AreaResize. It is also slow to render. How fast is your computer?
Er... no :D I can't run hawk, and my pc is 10 years old xD (its a Dual Core 1.8GHz) Anyway, what 'interlaced' mean?
Publisher
Joined: 4/23/2009
Posts: 1283
Darth Marios wrote:
Er... no :D I can't run hawk, and my pc is 10 years old xD (its a Dual Core 1.8GHz) Anyway, what 'interlaced' mean?
Well, I'm not sure you can get the quality you want. A 10 year old computer (2008) IMO can still play BizHawk, just slow. It can also do all this render, just slow. Here is a site that explains interlacing better than I can: http://www.100fps.com/
Joined: 8/3/2008
Posts: 254
Is x264 8bit/10 bit the same as the regular x264vfw? OR is it different? What are the differences between the two?
Guernsey Adams Pierre
Publisher
Joined: 4/23/2009
Posts: 1283
Guernsey wrote:
Is x264 8bit/10 bit the same as the regular x264vfw? OR is it different? What are the differences between the two?
x264vfw is largely outdated. I'm not even sure if there is a 10-bit x264vfw. With H.264 support hacked into AVI anyway, I would really avoid x264vfw if you can. It is most likely 8-bit. x264 8-bit/10-bit EXE is the most up-to-date version of x264. Use those. 10-bit has better compression, but it is more complex, meaning encode and decode slower. If you are sending to YouTube, YouTube is 8-bit (I think?) and you should be sending 8-bit H.264.
Darth_Marios
He/Him
Joined: 5/11/2015
Posts: 106
Aktan wrote:
Darth Marios wrote:
Er... no :D I can't run hawk, and my pc is 10 years old xD (its a Dual Core 1.8GHz) Anyway, what 'interlaced' mean?
Well, I'm not sure you can get the quality you want. A 10 year old computer (2008) IMO can still play BizHawk, just slow. It can also do all this render, just slow. Here is a site that explains interlacing better than I can: http://www.100fps.com/
Ah, well, i still dont know what it mean lol But if deinterlacing is so useful, is possible to do with avisynth, and how? Anyway, if i can run hawk or can't, i installed everything necessary but keep giving me errors lol (sorry for OP). Somethings about sounds or what.
Publisher
Joined: 4/23/2009
Posts: 1283
Darth Marios wrote:
Ah, well, i still dont know what it mean lol But if deinterlacing is so useful, is possible to do with avisynth, and how? Anyway, if i can run hawk or can't, i installed everything necessary but keep giving me errors lol (sorry for OP). Somethings about sounds or what.
What version of Windows do you have and what version of BizHawk are you trying to run?
Darth_Marios
He/Him
Joined: 5/11/2015
Posts: 106
Aktan wrote:
Darth Marios wrote:
Ah, well, i still dont know what it mean lol But if deinterlacing is so useful, is possible to do with avisynth, and how? Anyway, if i can run hawk or can't, i installed everything necessary but keep giving me errors lol (sorry for OP). Somethings about sounds or what.
What version of Windows do you have and what version of BizHawk are you trying to run?
I've attempted to run the last version (2.3) but even a older one doesn't run. I have Windows 8 (Intel Dual Core 2 Duo 6300, Nvidia GeForce 2GB and 3GB of RAM) By the way - sorry for the OP again - this is the error i get: System.Exception: Initialization of Direct3d 9 Display Method failed; falling back to GDI+ ---> System.BadImageFormatException: Could not load file or assembly 'SlimDX, Version=4.0.13.43, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. ---> System.BadImageFormatException: Could not load file or assembly 'SlimDX, Version=4.0.13.43, Culture=neutral, PublicKeyToken=null'. This assembly was compiled for a different processor. at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence) at System.Reflection.Assembly.LoadFile(String path) at BizHawk.Client.EmuHawk.Program.CurrentDomain_AssemblyResolve(Object sender, ResolveEventArgs args) at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName) --- End of inner exception stack trace --- at BizHawk.Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9..ctor() at BizHawk.Client.EmuHawk.Program.SubMain(String[] args) --- End of inner exception stack trace --- and after i closed this message, it appear another one: System.BadImageFormatException: Could not load file or assembly 'SlimDX, Version=4.0.13.43, Culture=neutral, PublicKeyToken=null'. This assembly was compiled for a different processor. at BizHawk.Client.EmuHawk.KeyInput.Initialize() at BizHawk.Client.EmuHawk.Input.Initialize() at BizHawk.Client.EmuHawk.MainForm..ctor(String[] args) at BizHawk.Client.EmuHawk.Program.SubMain(String[] args)
Publisher
Joined: 4/23/2009
Posts: 1283
Did you install the prerequisites file?