Tuesday, January 17, 2023

My recommended settings for the highest-quality videos on PSP

Everyone knows the resolution of the PSP is 480x272, but did you know the PSP is capable of playing videos in 720x480? That's a higher resolution than what every video encoder uses for their own PSP presets. 720x480 at 2000 kbps is also the quality of purchased PSN standard-definition videos back when they were downloadable. They were playable on PSP and PS3 and looked great. 

While a PSP firmware update would eventually allow us to encode our own videos in 720x480 (and match UMD video quality), there was still the aspect ratio problem: we always had to hit Triangle and select "full screen" if the source material was 16:9 (gets annoying fast), and if the videos were 4:3, we were sort of out of luck.

Well, after nearly two decades, I've finally solved it, so now I can encode in the highest resolution at the proper aspect ratio. Looking through my notes, some guy on Dash Hacks long, long ago already got most of it: 
(re: Constant Quantizer) remember lower numbers = higher picture quality = larger file size. going from 21 to 26 will make the files smaller, but they won't look as good, esp on a TV.

Also all of the CQ profiles tend to get too aggressive on simple scenes so smooth gradients and dark scenes will have visible artifacts on a larger display. It's not bad on the PSP screen, but on a larger screen it can be distracting.

One more tip: If you are doing a 720x480 profile, be sure to turn off autocrop and set AR correction to SAR, otherwise you'll lose the anamorphic benefits and end up with a letterboxed 4x3 video and waste lots of CPU time encoding black bars.

Now having said all that, I do things a little differently myself. I make a HQ encode that will look great on my 60+" tv, one that I can play on PSP, PS3, or PC. I try to avoid any PSP specific optimizations. I can always reduce the PQ and PSP optimize it later if I need to. 

Essentially, I imitate the settings used on the PSN Video store. Start with the MP4 PSP AVC TV profile, set the video encoder to CBR 2000 mb/s AVC, set the audio encoder to AAC-LC ABR 256k, set video cropping to 0 (turn off autocrop) and AR correction to SAR. Disable mpeg2fix. Movies will average 1gig/hour, but they will look excellent over TV out, on a PC/laptop, or PS3 on a big screen.

If I need a PSP only (small screen) version, I'll use the big one as the source, and reduce it to 480x272 using the standard MP4 PSP AVC profile with autocrop and AR correction set to black and mpeg2fix/ghostbusters turned on. If you know you are never going to watch it on anything bigger than a PSP screen you can get really aggressive with the encoder.

Changing SAR was one of the big points (although he didn't say to what...), and disabling B-Pyramid (whatever the hell that is) was the other.

I'm using Megui here, which in some ways isn't as flexible as the older versions of Xvid4PSP, but I'm never going back to that. Even the old (i.e. good) versions of Xvid4PSP seemed bloated and I wasn't able to add in chapter data for my other (non-PSP) encodes without running the finished video through YAMB. 

General tab:

  • Make a new OneClick profile (at the bottom). I named mine "PSP 720x480 at 16:9"
  • Video: load AviSynth script here... more on that later
  • Audio: FFmpeg AAC
    • (Config button) Profile: MPEG-4 LC-AAC 
      • ABR 256k

Advanced Config tab:

  • Encoder settings: Config button
    • Create a new preset (at the bottom). I named mine "PSP 720x480 16:9 Best" 
    • Select PS3 under Target Playback Device.
    • AVC Profile: Main Profile
    • AVC Level: Level 3
    • (Frame-Type tab) B-Pyramid Disabled (Easy to miss and most important! Otherwise the video won't play on a PSP!)
    • (Misc tab) Input/Output: Force SAR: (This is what we're here for: making sure we get 16:9!)
      • 40:33 for 16:9 content
      • 10:11 for 4:3 content
    • Encoding Mode: Automated 2pass / Bitrate: 2000
  • AviSynth settings: CHECK "Keep Input Resolution (disable crop & resize)"

The one drawback to this method is you have to load the clip via AviSynth because Megui doesn't let you change the frame rate. Well, I guess it does, but in a way that's more complicated than just writing your own damn AviSynth script to begin with. The AviSynth script does three things:
  1. Loads any format, no fuss, no muss.
  2. Lets you change the frame rate to 29.97, which is crucial because the PSP can't seem to play videos well at higher framerates, even if you do overclock (to do: try videos at 60 FPS 480x272).
  3. Lets you know for damn sure that you're inputting a 720x480 video, so you can check the "Keep Input Resolution (disable crop & resize)" box with full confidence.
For that first one, we're using the LSMASHSource plugin. Loading scripts with it in VirtualDub might take a while, but it's necessary. Here's the script in full (after I trimmed the fat):

LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins64+\LSMASHSource.dll")

rawfile1v=LWLibavVideoSource("Untitled 05.avi")
rawfile1a=LWLibavAudioSource("Untitled 05.avi")
AudioDubEx(rawfile1v, rawfile1a)
rawfile1=last.BilinearResize(720,480)  

return rawfile1.ChangeFPS(29.970, linear=true)

Easy. 

Other fun links:

Saturday, January 7, 2023

Finding the mythical "compromise crop" between 4:3 and 16:9



I was watching a DuckTales movie from 1990 on Disney+, which was almost certainly originally 4:3, but it was presented in widescreen with thinner-than-usual pillarboxes. So that got me looking for the only good compromise for viewing zoomed-in 4:3 content on a 16:9 display: zooming in just enough to keep the original aspect ratio, but without cropping all the way so as not to lose too much information on the top and bottom of the screen.

This is what I'm talking about: 


The area in green is the full 16:9 1080p image. The area in black is the 4:3 image. The area in red is the left and right sides of the zoomed-in 4:3, with the empty selection on the top and bottom showing what's cropped.

Getting the numbers in GIMP:

1080p is 1920x1080.

4:3 content in a 1080p frame is 1440x1080.

The remaining pillar bars (the green in my illustration) have a width of 240 pixels each.

Half of 240 is 120 (this is the "compromise" part), so in GIMP I had to create a rectangle from the inner columns (the red in my illustration) with the Rectangle Select Tool until it said the rectangle was 1.33:1. (1.33:1 = 4:3). 

The numbers I got were 1680x1260... but I could be off a few pixels. It needs to reduce to exactly 4:3...

1680/420=4

1260/420=3

So yeah, 1680x1260 is what I need for a 4:3 clip before chopping it for the compromise crop.

In practice, what this means starting with a 1080p raw capture, I have to:

  1. Crop from 1920x1080 to 1440x1080 (that is, crop 240 on the left and right) to get a clip that's 4:3.
  2. Resize the clip to 1680x1260. Luckily this is still mod16 for quick, clean, no-fuss resizing with BicubicResize.
  3. Because 1260-1080=180, I need to crop 90 off the top and bottom. Clip so far is 1680x1080.
  4. Because 1920-1680=240, I need to add 120 to the left and right. Clip is now 1920x1080.
In AviSynth: 
.Crop(240,0,-240,0).BicubicResize(1680,1260).Crop(0,90,0,-90).AddBorders(120,0,120,0)

Bonus: Resolution cheat sheet

Thursday, January 5, 2023

2023: A new movie (or similar) every day

Trying this again. Last year I only made it to mid-April I think, but I did catch up on everything MCU at the time.

Will update this post very frequently!

January 2023:

  1. The Incredibles
  2. Strange World
  3. Incredibles 2
  4. Incredibles 2 bonus features (almost two hours, not including the full commentary track!)
  5. Dan in Real Life
  6. DuckTales the Movie: Treasure of the Lost Lamp
  7. Toy Story 2
  8. Toy Story 2 bonus features

Friday, December 2, 2022

My experience upgrading my Nintendo Switch to the OLED model

I decided to upgrade to the OLED Switch as a Christmas present to myself, allowing me to also give my cousin my old Switch. On eBay there are plenty of listings for just the OLED Switch tablet itself, and I got one with a screen protector already supplied. PROTIP: You can find plenty of parted-out Switch OLED Buy It Now listings on eBay thanks to the compatibility of the accessories of the OLED Switch with the original model.

Turns out I needed to replace the screen protector anyway because it was smaller, crooked, and it had a piece of dirt or something on the lower left corner that was actually big enough to create its own little air bubble... and when I removed the screen protector with the help of this tutorial I discovered that the mark from the dirt wouldn't buff out, all because the idiot couldn't bother to actually turn on the screen after applying the screen protector. But that's okay; I bought a pack of iVoler screen protectors for the OLED Switch a month earlier. They fit perfectly and were 100% idiot-proof. Fantastic brand and great value; the included frame for lining up the screen protector is just genius, and I still have three more full screen protectors left! And what's more, the usual tiny marks and streaks are invisible with the screen protector applied.

The account transferring on the Nintendo side was idiot-proof as well, even when one of my accounts was a Japanese account. All my saves across all accounts transferred survived. I need to especially note three things:

  1. There's no getting around redownloading when moving your micro SD card to the new OLED model because your games will be deleted. I had over 300 games and I split the redownloading into two or three days.
  2. There's no need to connect your micro SD to your computer at all; while the OLED Switch will make you redownload your games, it won't touch your album. Well, I'm 90% sure of this, anyway. After transferring accounts but before putting my micro SD in the OLED Switch, I copied my album to my computer. Then I put the micro SD card into the OLED Switch so it'll play nice or whatever, and then loaded the micro SD card back in my computer to copy, but the files were already there.
  3. I had a hell of a time removing my SanDisk micro SD card from the OLED Switch, but the GameFAQs boards came through. I just needed to get a barbecue stick with a pointy end (I couldn't find any toothpicks) and I dragged the micro SD card out by grabbing hold of the notch, which thankfully that much was exposed at least.

So after playing around with the OLED Switch with Tetris Effect Connected, the game I'm most familiar with, I can say that the incremental upgrade was worth it. On paper, the slightly larger screen real estate didn't seem like much, but it's noticeable. The OLED screen did seem not as bright, though maybe that's because I wasn't used to such deep colors. Be sure to turn off Auto Brightness if you don't care about battery life.

What else did I need to buy in order to give my cousin a complete original model Switch? Just another right Joy-Con and wrist straps. It was my sudden realization that I already bought doubles of most other Switch hardware:

  • I wanted a second dock to go in my RLSOCO Carrying Case (more on that later), so a while back I got a parted-out bundle consisting of the OLED Switch dock, HDMI cable, and power adapter. The second dock was neat to have and I figured I might as well get the newest one, and the power adapter was useful when playing the Switch in handheld mode, as my first one was already used in my dock. But I traded my OLED Switch dock with my brother's original since the OLED Switch dock barely fit in my carrying case. Anyway I didn't really need the dock or the charger because I already had the excellent Genki Covert Dock. They've since then made a Covert Dock Mini which I guess you should buy instead.
  • I already had a Left Joy-Con from a failed attempt at a Saturn d-pad mod, so I got a second red Right Joy-Con that only cost me about $25 shipped.
  • Joy-Con wrist straps were about $8 shipped, though as of this writing I don't believe they've even been shipped yet...

Back to the RLSOCO Carrying Case. It's the best case out there in my opinion, but while the OLED Switch dock was a tight fit in the dock compartment, the OLED Switch did not fit at all in the Switch compartment, so it's little wonder they redesigned the case. And I was just about to purchase the new one, but I actually didn't need to!

  • I have no need for the original dock with my Genki Covert Dock, so I moved the OLED Switch to the dock compartment, which fits.
  • Filling the rest of the space in the dock compartment, my Hori Split Pad Pro & D-Pad Controller (L) fit there nicely.
  • And lastly, the Hori Compact Playstand fits perfectly in the original Switch compartment. (I love that thing; it's cheap, small, and works with Vita and 3DS too!)

I've also solved the problem of Joy-Cons and Pro Controllers turning on accidentally in transit (providing you are also using the RLSOCO Carrying Case) thanks to Nintendo's colossal failure of making every button capable of turning the controllers, and possibly the Switch itself, back on. 

  1. Before putting your Switch in a bag, put it in Airplane Mode. You can do this quickly by holding the Home button and selecting it.
  2. De-sync your controllers. I forget if you only need to do this once, or with every controller you have, but maybe this doesn't even matter because...
  3. ...the real trick is putting something firm, yet squishy, and long but not too long where your controllers would be, specifically between where the the shoulder buttons would be if they were, oh, I don't know, stored upside-down. I like "Silicone Flexible Cable Wire Protector," or what I would just call cable strain relief, though apparently that's a different thing that didn't yield the result I wanted.
  4. Lastly, put your Joy-Cons in the comfort grip and put the whole thing in the case upside-down! Put your Pro Controller upside-down too. It'll fit snugly in the RLSOCO Carrying Case with the little pouch. By putting the controllers upside-down, the only buttons that would ever be activated are the shoulder buttons, but the strain relief -- sorry, "silicone flexible cable wire protector" protects it from ever touching the carrying case.

And now that I've written all this, I'm sure the Switch 2 will come out any day now...

Wednesday, July 20, 2022

TESmart HDMI switcher quirks

 Back in October 2021 I purchased a TESmart 16 Port HDMI Switch 4K UHD 3840x2160@60Hz HDMI Switcher Box with RS232 LAN Port Support HDCP 2.2 × 1 straight from the manufacturer; as it was near Halloween I got a coupon, but at that point it was already cheaper than its listing on Amazon. How could I say no?

So I got it, and it does switch automatically. I'm still not sure if the switching works on a priority system like the DVDO Edge, and I'm still not exactly sure how to stop it from auto-switching and then turn the auto-switching back on. 

There were some quirks, so I'll just repost my findings from the shmups forum.



Jefferson wrote:

Just bought the TESmart 16x1 switch 4k60 switch. So far I really like it (after I disabled the beeping). I have tested the following:

N64Digital

DCDigital

PS1Digital

RetroTINK 5X Pro


All work fine, with the exception of CEC not working on my PS1Digital unless I power cycle the switch. CEC works fine for the N64Digital.



I got mine too the other day! Straight from the manufacture's website (ordered 10/23; arrived 11/10), and with a Halloween coupon code, about $50 cheaper than Amazon, and that's before Amazon taxes.


Seems great except for one major issue: no audio out of my PS4! The same PS4 settings give me audio when going from PS4 straight to the Dell monitor (it's not an actual TV, but I can't see why that would make a difference). PSVR doesn't seem to have anything to do with it. PS3, Xbox 360, and Switch work fine. :?


I tried the various YouTube folklore home remedies like unplugging the PS4 and monitor and waiting before trying again, and playing around with the audio settings; switching from HDMI Linear PCM to anything else just gave me two different flavors of loud and potentially speaker-damaging noise. The PS4 said it recognized 7.1 and gave me the option to check 5.1, but checked or unchecked, I'm still not getting audio.


Audio from the controller works as usual, and it's neat that I can choose to get all audio from that little port (not just chat), but since I work with headphones on, I kinda don't want to play with headphones on too.


Switching ports on the TESmart and swapping out my older HDMI 1.4 cables for my fancier HDMI 2.x cables didn't help either.


And although I do have an HDMI extractor that lets me do PS4 > PSVR > HDMI audio extractor (plus yet another power outlet used) > RCA to DVDO Edge (and setting the DVDO Edge to output Stereo instead of HDMI) > TESmart switch... I really don't want to do that every time, just for the PS4, especially when everything else is switched automatically.


Help?


---


EDIT: I hooked up the full setup of PS4+PSVR > TESmart (with mClassic) to my older Dell monitor that only has VGA and DVI with the good ol' Tendak and that works, so there you go. Tried it again without the mClassic and the mClassic didn't affect compatibility.


---


EDIT 2: Today I chained some HDMI cables to an actual TV (i.e. not a PC monitor) in another room and I get sound with the PS4! So I dunno why this TESmart scaler doesn't like to play nice with my Dell S2716DG.


---


EDIT 3: Today's crazy chain combo that works on the troublesome Dell S2716DG (optional components in italics):


PS4+PSVR > TESmart > mClassic (requires USB power) > Tendak HDMI-to-VGA adapter > Toodles T-SLG (VGA scanline generator) > VGA-to-HDMI adapter (requires USB power)


Picture quality still looks good, and yay, I can have fake scanlines on 1080p sources again!


---


EDIT 4: I get PS4 audio through the TESmart with my Genki ShadowCast!


---


EDIT 5: I noticed I would occasionally get no audio playing certain consoles, and while I'm not sure if it's the TV or the TESmart, here's what I do now to absolutely got-dang-guarantee I get audio:


I try to make sure the console is the LAST thing I power on. I always set the TV input first, wait for the "no input detected" screen, then turn on my USB-powered stuff (RetroTinks, gscartsw and gcompsw, HDMI splitters and whatnot) along with the TESmart, wait for the RT5X blue screen, and finally turn on the console.


---


EDIT 6: This gets me audio on a TV, although restarting after a firmware update made the audio glitchy until I put the PS4 to rest and then woke it up:

PS4+PSVR > TESmart > HDMI splitter > HDMI splitter

Although it's probably the case that only one HDMI splitter is necessary.

Wednesday, July 6, 2022

AutoHotkey ideas

AutoHotkey scripts using three keys (but the first one should be Shift): https://www.autohotkey.com/board/topic/61408-hotkeys-composed-of-three-keys/

RAlt + Q, W, E, R, T, etc

LAlt + Y, U, I, O, P, etc

End + Q, W, E, R, T, etc (with End::Send {End} ; Make the release of End produce an End keystroke.)

Home & End::

Friday, June 17, 2022

Back to the Dreamcast

I was having trouble updating my GDEMU firmware; my Dreamcast was in a DreamCase and that meant a different power supply and an SD card extension. I'm only 50% sure I used the listed compatible SD cards (including the one that my games were on), so after putting my Dreamcast back in its original shell with its original power supply (not even with resistors added) and using the somewhat well-known SD card popular with GameCube homebrew, I was finally able to update my GDEMU firmware.

Why was I so insistent on updating the GDEMU firmware?

Turns out, the GDEMU freezes on certain sections, apparently for loading certain sections too fast. I can reliably get Soulcalibur to freeze by going to Museum > Exhibition Mode > Yoshimitsu; the game will freeze during the fade to black after Yoshimitsu's demo ends. I also learned the hard way that House of the Dead 2 will freeze after beating the game, right before you get to save your game, losing any progress you may have made along the way. I can confirm setting the GDEMU load speed to 600 fixes the Soulcalibur problem, and hopefully all other freezing problems. My characters in Phantasy Star Online 2 still loaded from the GDEMU much faster than from disc at 600, so I may just keep it at that speed.

I don't know if the GDEMU is getting any more updates, but if there are any, I'll need clear access to the SD card slot (no extensions), and I'll need to watch out for LED patterns, which not only means the DreamCase is out, but also a good number of 3D-printed trays are out as well.

Other things I've learned when swapping cases:

Generally helpful vid here

Not all replacement shells are equal. (I will link to a future Twitter post with pictures)

You can't do a case swap for the Broadband Adapter. The hole is a little wider and all the 3rd party shells I've seen are only big enough for the standard modem.

If your Dreamcast turns off after a while, especially shortly after turning it on, cleaning the power pins with alcohol may or may not help, but bending them towards the back of the console most certainly will. HOWEVER, THE MOST IMPORTANT PART IS TO CHECK IF YOU REATTACHED THE SMALL RIBBON CABLE FROM THE CONTROLLER PORT. MY DUMB ASS KEEPS MISSING THIS!

SD card compatibility here (TLDR: up to 32 GB for SDHC; with SDXC being unsupported), and the best, largest, cheapest officially compatible SD cards here. Format in FAT32, with 64kB clusters.

Screws needed: Lists from iFixit, or just buy the screw sets here.

 Or to put it another way:

  • 9 black medium screws
    • 4 for the bottom of the Dreamcast
    • 5 for the motherboard
    • (VA0 units only) 1 for the fan 
  • 9 short brass screws
    • 2 for the power supply
    • 3 for the GDROM drive
    • 2 for the power button switch
    • 2 for the motherboard
  • 6 long brass screws
    • 4 for the controller port
    • 2 for modem
  • (VA1 and maybe VA2 models only)
    • 2 tiny black screws for the fan