Masterjun
He/Him
Site Developer, Skilled player (1987)
Joined: 10/12/2010
Posts: 1185
Location: Germany
This is a guide for how to quickly create a watchable file from BizHawk. This watchable file is what we call an encode and is usually in the format .mp4 or .mkv. Step 0 First, pause BizHawk, and then advance to where you want your encode to start. If you made a movie file and want to record your encode from the very beginning, open your movie and then select File > Movie > Play from Beginning. Step 1 (only once) If you haven't done this before, click File > AVI/WAV > Config and Record AVI/WAV. Select FFmpeg writer and click OK. Step 2 (only once) Now a window will appear saying you don't have FFmpeg yet. FFmpeg is the encoder tool compressing your movie file so it doesn't take up several GBs. So download it by clicking Download. It's around 14 MB so it shouldn't take long. (If this window didn't appear you already downloaded it before. Just continue with the next step.) Step 3 In the window that appears, select [Custom] and enter a certain command into the Command: text field. The command will be sent directly to FFmpeg and what you need to enter depends on how you want your video to look like. You can enter this for a quick 4x upscale with good quality: -vf scale=iw*4:ih*4 -crf 18 -sws_flags neighbor -pix_fmt yuv420p -b:a 384k -f mp4 Or if your video is on a TV console with a game that needs to be scaled to 4:3 (e.g. NES/SNES), you can use this: -vf scale=floor(((ih*4)*(4/3)+1)/2)*2:(ih*4),setsar=0 -crf 18 -sws_flags neighbor -pix_fmt yuv420p -b:a 384k -f mp4 Here the iw*4 and ih*4 mean it will be upscaled x4 from the original resolution. You can replace the two 4's with a higher or lower integer if you want a higher or lower resolution. Finally click OK. Step 4 You will be asked where to save the encode. Just select a location and click Save. Step 5 You are now recording an encode. You can unpause the emulator and advance to where you want to stop the encode. Here it doesn't matter if you slow down or fast forward, the resulting file will have the normal speed no matter what. (Note: Don't be surprised if you can't fast forward as much as you normally can, recording video takes extra processing power.) Once you're at the point where you want to stop, click File > AVI/WAV > Stop AVI/WAV. You're done. That's it. You just created your encode. The next time you create an encode, you can click File > AVI/WAV > Record AVI/WAV (instead of Config and Record AVI/WAV) and go immediately to step 3. Edit 2021-06-17: Resized large image embed. Edit 2021-06-19: Added integer upscale options. Edit 2021-06-22: Added setsar=0 to unset SAR. BizHawk sets it for some reason, making ffmpeg reverse every aspect ratio change from rescaling. Edit 2023-02-14: Color reformatting.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Dimon12321
He/Him
Editor, Reviewer, Experienced player (596)
Joined: 4/5/2014
Posts: 1222
Location: Romania
I check "Resize Video" on Step 1 and calculate the resolution I want to get. If you simply upscale a native resolution in 4 times, it won't usually match YouTube patterns. For example, 320x240 * 4 = 1280*960 will be downgraded by YT to 720p. I don't know why YT downgrades the quality as well, but such a video doesn't look much better after YT's processing then the same one in 960x720, so YT doesn't resize it on its own. I do like that: 1) 1080 / (native height) = X,1562 2) X,1562 * (native width) = Y,8645. Rounding up to Y + 1. That's your output resolution for resizing. Example for 320 x 224. 1) 1080 / 224 = 4,82142857 2) 4,82142857 * 320 = 1542,85714. Rounding up to 1543. So, your resolution is 1543 x 1080. Maybe nowadays it makes sense to simply upscale it in 5 times, so it is more than enough for YT's 1080p, but I don't know if it's still compresses custom reses so dramatically.
TASing is like making a film: only the best takes are shown in the final movie.
Editor, Player (69)
Joined: 6/22/2005
Posts: 1050
Don't some codecs have restrictions on the resolution values, such as requiring them to be multiples of two or four? What happens when these calculations produce an odd number?
Current Projects: TAS: Wizards & Warriors III.
xxezrabxxx
He/Him
Joined: 7/15/2017
Posts: 199
Location: Kentucky
Dacicus wrote:
Don't some codecs have restrictions on the resolution values, such as requiring them to be multiples of two or four? What happens when these calculations produce an odd number?
At that point I would encourage adding a spot recommend to install Lagaraith Loseless Codec, using that the file sizes along with the ffmpeg script get crazy small!
I like to comment on submissions and look around the site. You have probably seen me before (if you have been around for a while) either on the site, Discord, or any other social media. I recently took up making temporary encodes for new submissions. Also, I never forget to greet Tompa wherever I find him! "when resyncing stuff sucks it's called Resuccing" - EZGames69 “If an emulator stops being accepted to the site it should be called an emuLAMEr” - EZGames69 "oh no discord, everything I say will now be logged forever, sdfsdf, time to hide" - Masterjun "just had to give therapy to a taxi with daddy issues" - psx Current Projects: Mother 3 (75% complete)
Spikestuff
They/Them
Editor, Publisher, Expert player (2642)
Joined: 10/12/2011
Posts: 6438
Location: The land down under.
Never upscale Nearest to an odd resolution, always use even. Then once that's done scale down with something like Lanczos for instance. So in your 1080p case Dimon you want to go up x6 then Lanczos down to 1080p. Which in this case would be this: -vf scale=iw*6:ih*6:sws_flags=neighbor,scale=(4/3)*1080:1080:flags=lanczos -crf 18 -pix_fmt yuv420p -b:a 384k -f mp4 (Note: Someone can probably clean this up to be neater, but there you go.) For those wanting 720p: -vf scale=iw*4:ih*4:sws_flags=neighbor,scale=(4/3)*720:720:flags=lanczos -crf 18 -pix_fmt yuv420p -b:a 384k -f mp4 You're also only assuming this is for S/NES only despite it being stated that it's for a TV console usecase and only in brackets are two consoles just so happen to be the same reesolution. Meaning A2600, PlayStation, Saturn (etc) and keeping with the Odd Logic you'll eventually get hit with the error of "Height/Width not divisible by 2" using your method Dimon. (This also answers Dacicus' query somewhat.)
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
Masterjun
He/Him
Site Developer, Skilled player (1987)
Joined: 10/12/2010
Posts: 1185
Location: Germany
Dimon12321 wrote:
If you simply upscale a native resolution in 4 times, it won't usually match YouTube patterns.
Don't worry, YouTube will adjust it for you. No need to do it yourself.
Dacicus wrote:
Don't some codecs have restrictions on the resolution values, such as requiring them to be multiples of two or four?
Good point, I changed the aspect ratio width calculation to round to the nearest multiple of two, required by the yuv420p pixel format. Everything else assumes the base width and height to be even.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Zinfidel
He/Him
Player (206)
Joined: 11/21/2019
Posts: 247
Location: Washington
If you just want to create a quick encode, do not worry about anything I am saying in this post. On the topic of resolutions that YouTube likes, it's a bit of a mystical art. The gist of how YouTube decides on what resolution to present your encode in is that it has certain width and height values that it "likes" and will try to set one of your dimensions to those values, and then let the other dimension vary a bit however you like. Some values I happen to know about near 4K resolution are 3840 for width, and either 2160 or 1920 for height. So, if you upload a video with a vertical resolution of, say, 1920, YouTube will be happy and you can vary your horizontal resolution to custom values and it will retain your resolution. Same thing for a width of 3840 - if your video is 3840 wide, your vertical resolution can vary and YouTube won't try to resize it so long as you still have enough total pixels to get close to 4k. If however you miss one of these magic dimensions, YouTube will resize your video proportionally to the nearest value that it likes. Whether this is a problem or not for you depends on how much you care about controlling the scaling algorithm that is used on your video. For 1080p I only know that YouTube likes a vertical dimension of 1080, but there are probably other values it's fine with. The trick is that your horizontal dimension then needs to be large enough to have enough pixels to make YouTube recognize it as 1080p. 1440 definitely works, less might too. For vertical dimensions less than 1080 - they may exist, I'm not sure, but your horizontal resolution might need to be larger than a strict 4:3 aspect to get YouTube to recognize it as "1080p". Anyway, if you are dealing with console footage that does not scale cleanly to 1080p or whatever resolution you're aiming for, you're SOL for getting a pure integer-scaled video uploaded. Your options are to pad the video with borders to a resolution that will get there (For instance, pad a vertical resolution of 224 to 240), or do non-integer scaling using more sophisticated algos like lanczos or area (Spikestuff posted examples above).
Dimon12321
He/Him
Editor, Reviewer, Experienced player (596)
Joined: 4/5/2014
Posts: 1222
Location: Romania
Spikestuff wrote:
Never upscale Nearest to an odd resolution, always use even. Then once that's done scale down with something like Lanczos for instance. So in your 1080p case Dimon you want to go up x6 then Lanczos down to 1080p. Which in this case would be this: -vf scale=iw*6:ih*6:sws_flags=neighbor,scale=(4/3)*1080:1080:flags=lanczos -crf 18 -pix_fmt yuv420p -b:a 384k -f mp4 (Note: Someone can probably clean this up to be neater, but there you go.)
Ok, I'll keep it in mind. The script works well. Thank you!
TASing is like making a film: only the best takes are shown in the final movie.
Joined: 8/3/2008
Posts: 254
Can those scripts work for individual flies?
Guernsey Adams Pierre
Joined: 8/3/2008
Posts: 254
What are some good commands for PlayStation, Nintendo 64 and Sega Saturn era video dumping?
Guernsey Adams Pierre
Post subject: What about the NDS?
MrTASer
He/Him
Player (231)
Joined: 7/3/2021
Posts: 147
Location: Udaipur, Rajasthan, India, God'sBeautifulWorld
What should I paste in the Custom tab for encoding the video of a NDS TAS movie?
My TASing channel ; My MUSIC channel ; My SoundCloud ; My HomePage ; Music Composer ; Mr.TASer#5922 VCop 2 TAS completed, but in a completely different way ; And SMB - GAGOTO (WL) TAS COMPLETED TILL W-4 ; Some more...
Post subject: What about PAL Encode?
MrTASer
He/Him
Player (231)
Joined: 7/3/2021
Posts: 147
Location: Udaipur, Rajasthan, India, God'sBeautifulWorld
I want to use the same configuration but record the game in its native 30 fps, how to do it???
My TASing channel ; My MUSIC channel ; My SoundCloud ; My HomePage ; Music Composer ; Mr.TASer#5922 VCop 2 TAS completed, but in a completely different way ; And SMB - GAGOTO (WL) TAS COMPLETED TILL W-4 ; Some more...
Spikestuff
They/Them
Editor, Publisher, Expert player (2642)
Joined: 10/12/2011
Posts: 6438
Location: The land down under.
This does not work with BizHawk due to the custom ffmpeg not actually doing stereo mode but regardless here's VBoy done with proper 3D. Set your mode to Side By Side. This ffmpeg script is made for BizHawk 2.9 or Newer: -vf colorlevels=romax=0.655:gomax=0.655:bomax=0.655,scale=iw*6:ih*6:sws_flags=neighbor,scale=-1:1080:flags=lanczos,scale=iw/2:ih:flags=lanczos -crf 18 -pix_fmt yuv420p -metadata:s:v:0 stereo_mode=1 -max_muxing_queue_size 1024 -b:a 384k -f mkv For those wanting 720p: -vf colorlevels=romax=0.655:gomax=0.655:bomax=0.655,scale=iw*4:ih*4:sws_flags=neighbor,scale=-1:720:flags=lanczos,scale=iw/2:ih:flags=lanczos -crf 18 -pix_fmt yuv420p -metadata:s:v:0 stereo_mode=1 -max_muxing_queue_size 1024 -b:a 384k -f mkv This ffmpeg script is made for BizHawk 2.8 or Older: -vf colorlevels=romax=0.615:gomax=0.615:bomax=0.615,scale=iw*6:ih*6:sws_flags=neighbor,scale=-1:1080:flags=lanczos,scale=iw/2:ih:flags=lanczos -crf 18 -pix_fmt yuv420p -metadata:s:v:0 stereo_mode=1 -max_muxing_queue_size 1024 -b:a 384k -f mkv For those wanting 720p: -vf colorlevels=romax=0.615:gomax=0.615:bomax=0.615,scale=iw*4:ih*4:sws_flags=neighbor,scale=-1:720:flags=lanczos,scale=iw/2:ih:flags=lanczos -crf 18 -pix_fmt yuv420p -metadata:s:v:0 stereo_mode=1 -max_muxing_queue_size 1024 -b:a 384k -f mkv
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
Darth_Marios
He/Him
Joined: 5/11/2015
Posts: 109
someone have script with black bars removed? (assuming its a PSX game)
Player (56)
Joined: 9/10/2021
Posts: 17
Location: Peru
This command is for 4:3 resolution, right? So what is the command for 16:9 resolution?
Editor, Active player (458)
Joined: 2/11/2018
Posts: 240
CyanTheGamerhog01 wrote:
This command is for 4:3 resolution, right?
It's not
Player (56)
Joined: 9/10/2021
Posts: 17
Location: Peru
oh cr*p
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
If the game changes resolution on the fly, you'll end up having many segments, even tho they will all have the same resolution. To concat them together, this ffmpeg command can be used: Download concat.bat
Language: batch

(for %%i in (*.mp4) do @echo file '%%i') > list.txt ffmpeg -safe 0 -f concat -i list.txt -c copy output.mp4
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.

1732221264