HOME WORKS MOTION PRODUCTS DOCS ABOUT

VHS Demastering

I've been making 3D animations on and off for a couple of years and I've been degrading (or demastering) most of them using VHS. The idea to do this came from my friend Yuya. I've seen this process back in my Tumblr GIF artist days and I've always been interested in giving it a shot, but Yuya doing it actually encouraged me into going for it. (Thanks man!!!)

Get an analog output, record it on tape, put it back into digital format. Sound easy enough, right? Apparently not.

Hardware hurdle

Yuya got away with a very simple solution: HDMI to AV adapter, but Yuya also lives in NTSC-J region. Unfortunately for me, a PAL dweller, things weren't so simple despite adapters having a toggle switch for PAL and NTSC. The output was fine, but once I tried the playback, there was no color. After toggling PAL/NTSC a few times, trying different computers (and even my Nintendo Switch), and setting the resolution lower, I couldn't get the color on tape no matter what. With this in mind, I decided to give my Raspberry Pi 3 a shot, since it has a native analog video output, and lo and behold, that worked just fine and I've used Raspberry Pi for it ever since.

While I could've called this thing done and moved on, unfortunately my Raspberry Pi is quite a busy little thing with so many things running on it at once that I could write a whole other article about it, so having analog video output enabled isn't an option and shutting it down to swap to dedicated VHS degrading would affect my entire home network, so I needed a dedicated piece of hardware for this project. Without breaking a bank.

So I started looking into what I have on hand. None of which are working solutions, unfortunately. I have one of those chinese Raspberry Pi alternatives called Orange Pi (mine being Orange Pi Lite) running AllWinner CPU. While mine isn't stable in the long run (mysterious crashing over time) I figured it would be enough for turning it on once in a while to run a video or two before shutting it down again. While the Orange Pi does have pin for analog video output, all the ready OS images available are running on modern kernel for which don't have support for it. Using image building tool I've tried to have a suitable OS image with legacy kernel, but despite following instructions, my Armbian image turned out to run modern kernel anyways. I may be patient, but this was one of those battles that I didn't want to engage in and moved on. The next best thing was my HP Vectra with its ATI All-in-Wonder GPU that has composite video output with an adapter, but 166MHz Pentium doesn't cut it for running videos. And my Windows XP machine's mysterious GPU refused to work entirely so...

Plan Pi

After giving up on my on-hand options and I ordered Raspberry Pi Zero W. This was a minimum cost solution as it has enough processing power to run videos, easily accessible composite video output, built-in WiFi and bluetooth on W model, and low power consumption so no special power supplies are needed. For reference, Raspberry Pi 3 needs a 5V 2.5A power supply to run stable. Phone chargers tend to be unstable and dip from time to time. My phone's 5V 2A caused me more than enough power dipping on Pi 3 and I had to buy a proper power supply for it. With Zero W, this is another cost avoided!

With power requirements in check, I only needed to order OTG adapter for USB, and a Mini HDMI-to-HDMI adapter. I could have avoided buying those two, since I run video playback commands over SSH and I could have preconfigured entire Raspberry Pi OS image on my existing Raspberry Pi 3, but I wanted to avoid any incompatibilities and to be absolutely sure. Doesn't hurt to have them as a backup either. I also have plenty of microSD cards available, so there weren't any need for that either. Living in Finland and having weirdly limited availablity, the best option for me was a Raspberry Pi Zero W essentials kit from ElectroKit in Sweden as it contains everything described AND some nice rubber feet that I'll be using in a future post on this topic. (Not sponsored, I paid for everything with art commission money, BUT they delivered so fast that I'm more than happy to give them a shoutout here.)

Keep in mind! If you decide to get Raspberry Pi and follow this documentation, please note that Raspberry Pi Zero option requires soldering. There isn't much to solder, but if you're feeling uncertain, I don't recommend getting into it or simply ask someone you know who solders electronics to help you out! If you have or choose Raspberry Pi 2B or 3B, you will need a special adapter for its 3.5mm TRRS connector. Some of the adapters have yellow and red RCA connectors backwards, so if yellow connector doesn't work, don't give up just yet. Raspberry Pi 4B is an unknown territory for me and official documentation states that 4 has some clock rate issues or whatever and it's not something I can cover in this documentation or help you with. If you have original Raspberry Pi model B, you already have an analog output. Carry on!

Additionally, you will require AV capable capture card/stick. Personally I'm using a very generic USB capture stick and it's been enough for my use. It's plug'n'play and works as capture device in OBS Studio, a free and open source streaming and capturing software.

Finally making things happen

First and foremost, we need the OS. Raspberry Pi foundation has made things easier than ever before with their own Raspberry Pi Imager which handles both image download AND flashing it onto microSD card. When it comes to choosing the OS, my go to for this project is "Raspberry Pi OS (Other) -> Rasberry Pi OS Lite (32-bit)" as the package doesn't include desktop user interface nor applications that require it. Very economic on terms of power and performance requirements, storage space, and download and flashing time. For dedicated hardware project like mine, it's a definite go-to option. Once the OS is flashed onto the microSD card, it's time to slot into Raspberry Pi and turn it on!

If you're already familiar with setting up Raspberry Pi, you can skip ahead. Otherwise, let's get into the process of setting up the basics. On first launch, Raspbery Pi OS will expand the filesystem to use the entire card's capacity and reboot. By default, image uses only as much as it requires to install and expands depending on the microSD card's size. (A very clever one-image-fits-them-all thinking on developers' part). Once that is done and text is done scrolling on the screen, login into your Raspberry Pi with default user 'pi' and password 'raspberry'. Once logged in, activate your inner hackerman, and let's get into configuration tool by using following command:

sudo raspi-config

If you have problems typing - try the key right of 0 on the number row. Raspberry uses English keyboard layout by default so it might be different from yours. Once you're in the settings you have an option to change your password. Highly recommended as your RPi will be connected to the internet. You can also change your password with 'passwd' command.

If you use a different keyboard layout, you want to head to "Localisation Options" first. You can select your timezone if you think you need it, but the most important thing right now is your keyboard layout. Simplest solution is to select Generic 105-Key (or 104 if US ANSI keyboard), but you can choose your keyboard if it's on the list. After selecting the keyboard itself, select the language. If it doesn't show up, select "Other", and pick it from the list. After that, depending on language, there will be options. Usually the first one works for me, but if you use special keybaord, such as Mac keyboard, you might want to select that layout as well. Follow given instructions on screen for select appropriate option. Default options work perfectly for most keyboards, but if you have special keys such as compose key, you can pick accordingly.

Time to conenct your Raspberry Pi to the network. If you're not using ethernet or have a model of Raspberry Pi without one, let's connet to the WiFi using "Network options" in the menu. There you can input your router's SSID name and password and your Pi is now connected to the network!

This isn't required, but it will save you some time logging into Raspberry Pi if you're using it directy rather than remotely. Go to "Boot Options", select "Desktop/CLI", and finally "Console Autologin". When powered and booted, Raspbery will automatically login with "pi" user and you can input commands right away. Unless you don't want another person to use it.

Finally, you will want to enable SSH for easy transfer of video files to Raspberry Pi and even using remote commands if you don't want to have a keyboard attached to it. Go to "Interfacing Options" and select "SSH", and select "Yes". This will enable SSH server and we can use SFTP in variety of clients such as WinSCP (Windows Only) and FileZilla (Multiplatform).

Next, we'll adjust Raspberry Pi's base configuration to use analog video output rather than HDMI. If you're comfortable vi/vim, more power to you. If you're unfamiliar with quirky UNIX text editors, let's do it the easy way with nano editor and run following command:

sudo nano /boot/config.txt

First we want to locate "#sdtv_mode". You can look for it manually and scroll up and down with Page Up/Down keys, or we can use nano's search with Ctrl+W. Once located, remove # and set appropriate value. If you're here, you're most likely PAL/SECAM user, so the appropriate number for you is 2. At this point I haven't tried out progressive scan on PAL, so I can't vouch for value "18", but I will update this post with my findings once I've tested it. If you're brave and know how to form SSH connection in case it doesn't work, you're free to try it out and maybe tell me. Otherwise, leave it as normal.

UPDATE 1: While preparing material for VHS glitching documentation, I gave progressive PAL a shot and it made no difference. The best I hoped for was no more interlacing, but it was present regardless. While there may be difference in some scenarios (I don't know, I have no other hardware to try it on), recording onto VHS remains the same and footage is very much interlaced and requires deinterlacing if that's not something you want.

UPDATE 2: In a very likely case that you'll be handling 16:9 footage, I highly recommend adding "sdtv_aspect=3" below previously uncommented and "sdvt_mode" variable. This variable is not there by default, so you'll have to input it manually. This will make Raspberry's composite output 16:9 which will work with tape just fine AND will make cropping and scaling of the footage much easier. Turns out I learned something here as well. ¯\_(ツ)_/¯

Make sure "hdmi_force_hotplug" value is either set as 0 or has # in front of it. Enabling it will permanently use HDMI regardless of whether you have HDMI cable connected or not. Once everything looks as described, hit Ctrl-O to save and Ctrl-X to exit the editor. Alternatively you can save upon exiting with Ctrl-X and hitting Y and enter/return key.

Once you're all done, it's time to update repositories, update Raspberry Pi OS if you feel like it (recommended), and install the real star of the show, omxplayer, which will become your best friend. Use following commands to complete this task:

sudo apt-get update sudo apt-get upgrade sudo apt-get install omxplayer

Once omxplayer has been installed, let's try it out to make sure it works. Open your (S)FTP client of choice, select SFTP as protocol, input username, password, Raspberry's local IP address, and make sure the port is 22. If you don't know your Raspberry's local IP with 'ifconfig' command. Most common addresses begin with 192.168. titled "inet" on the command line.

Once connected, upload any video through your client to Raspberry Pi's home directory. Most clients default to home directory on first run, but if that's not the case, navigate to /home/pi and upload the file there. Now we can test omxplayer in action with following command:

omxplayer your-video-file.mp4

Those who paid close attention might have noticed the lack of 'sudo' in this command. Since running omxplayer doesn't require admin/root/elevated privileges, you don't need to use sudo either. If you find it tedious to type out some of the file names, you can use Tab key to autocomplete file and command names!

At this point your video should be playing (or played) if it's short. You can stop the playback by terminating the process with Ctrl-C and we can get the show on the road. Use following command to shut down Raspberry and disconnect the power cable once the power indicator LED has turned off:

sudo halt

The scary part (for Pi Zero)

Now that your Pi has been powered down, it's time to make the composite output happen! If you're using 2B or 3B model, connect your adapter now. As previously mentioned, if your yellow RCA connector isn't working, try red one. If you're original Model B user, good on you! Your composite output should be good to go. If you're Pi Zero (W) user, get ready to get sweaty and prepare that soldering iron.

Aside from the price point, Raspberry Pi Zero (W) is my absolute go-to for a project like this for its dedicated TV solder points on the PCB. You can solder your RCA cable directly, or be like me, and use something like header pins. Note that the square shaped point is the composite out and circular is ground. Correct polarity is important! In my case, there was very little vertical space, so I used 90° pins to make up for that while my RCA connector has dupont connectors on the wires.

Once everything is ready and composite output works, connect your keyboard or connect to Raspberry Pi remotely using SSH client. I won't get into SSH connections here since it's not required for operating this project, but with a quick search online with "SSH Client" followed by your operating system will help you out.

Tape it!

At this point the process is pretty straightforward for those who ever had to record anything on tape. Connect Raspberry Pi's composite output to VCR's input and select appropriate input, output from VCR to your capture device, and open your capture software. As I've previously mentioned, I use OBS Studio. It allows me to monitor capture stick's input, which is great for timing capture on VCR and allows me to rewind/fastforward tape to appropriate position before recording back to digital.

VCRs come with a passthrough. You should be seeing Raspberry Pi as long as you're not playing anything from the tape and your selected input is correct. Then, input your omxplayer run command with your keyboard as you've done previously when testing it after installation (or through a remote terminal via SSH), but don't hit enter/return just yet. Start recording on your VCR, hit enter/return, and watch it get taped, and stop when the video has stopped playing!

When preparing the footage, remember the limitations of the format. NTSC is 24fps, PAL is 25fps. I've done some animations with 30fps and there's been a bit of an issue with it. However, if you like higher framerate, there's a solution for this as well. Make animation in double of your format (48 for NTSC, 50 for PAL), but make your digital video run half speed at the appropriate framerate. It will take twice as long to record on tape and it will take twice as long to record back to digital, but it's a way to achieve higher framerate while keeping the authetic VHS look.

You can also repeat your video indefinitely by adding '--loop' run argument to omxplayer command:

omxplayer --loop your-video-file.mp4

In my process I like to let it repeat 2-5 times before stopping recording to give me more tape to damage and save time rewinding all the time. Either way, your work here is done and you can move onto the easier part.

And then take it back to digital format!

Now with the footage on tape, go ahead and rewind to before the video starts playing. Make sure your recording software matches the framerate of the tape (24 or 25) as any interpolation won't be of any use to you. Or at least I've found 25fps footage recorded into 30fps video a pain in the ass to cut frame accurately due to interpolation. Use tape's framerate even if you're using half-speed method for higher framerate. Then, start recording in your capturing software, play the tape, stop when the video has ended!

And that's it! Your video has been demastered/degraded by VHS! All that's left is to take resulting video to an editor of your choosing, snip out the frames before and after the animation, and do whatever you're going to do with it!

If you opted for half-speed method, you will need to import your clips to editor as 48/50fps footage and put it into matching composition. That way it will run at double speed resulting in original speed animation at twice the framerate! Is it authentic VHS experience? No. Is that cheating? Yes. But does it allow your video run smoother while having authentic VHS quality? Absolutely!

Additional tip! Footage will be interlaced. Either it's something you want, or it's something you want gone. OBS Studio users can right-click their capture device in the preview and select interlacing to have footage interlaced as it records. It's an easy solution that saves time and eliminates the need for deinterlacing in post.


And now, if you're up to it, you can try VHS glitching as well!

▲ BACK TO TOP ▲