Skip to content

jeffreybergier/Retro-Stream-Tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iMac G4 Streaming Youtube

Retro Stream Tutorial

A tutorial on how to stream Youtube or any other video content to PowerPC Macs. To see a video of the kind of quality you can expect, check this recording on my Google Drive. I have noticed that the streaming quality from Google Drive directly is not always great, so download it to be sure you are seeing the full quality.

Who Am I

I'm Jeff, a fan of Mac OS X, NeXT, a software developer, and general retro tech enthusiast. I have other retro tech guides as well as software I have developed for retro Macs, so please check it out.

My iMac G4 (Lamps Plus)

I recently got an iMac G4 and restored it with SSD and max RAM. I got this machine because when I was in High School I desperately wanted one but could never get it. But I didn't want to get it if it was going to sit on a shelf and collect dust.

So before I bought it I tried this streaming setup to make sure it could work. And I am very happy to report that I am happy with the results and this machine now makes a great music video display for my KPOP listening enjoyment while I'm working.

Background

I am writing this in 2025 and I would say that it has been a good 10 years since pretty much any computing device we may have can easily easily stream 1080p and 4K content directly from the internet with absolutely no issues.

However, before 2015, this was not always the case. I will paste in specs for the iPhone 5 and the original iPhone. You can see from the specs that even with special decoding hardware, the iPhone could only do 480p H.264.

iPhone 5 - 2012 (Source):

H.264 video up to 1080p, 30 frames per second

iPhone - 2007 (Source)

H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile

As another anecdote, I remember having a 1.67GHz PowerBook G4 from late 2005 and being super amazed that it could rip DVD's into MPEG4 format (not H.264 yet) at 1x meaning that it ONLY took 2 hours to rip a 2 hour DVD. This was incredible speed during this era.

So while we may feel like high-quality Youtube video playback has been a given forever, it actually has not. And so when when we use old Macs we may get frustrated by their inability to do "simple" tasks like play Youtube. But the reason I am giving this background is to illustrate that this is no simple task.

Why Can't Old Computers Play Youtube

1) The TLS Apocalypse: Means PowerPC macs can't connect to Youtube at all.

  • A few years ago, there was a big push for web servers to disable support for TLSv1.1 because there were fundamental flaws found in its cryptography. However, on pretty much any system older than 2015, TLS v1.2 is not supported. If the web were working as expected, then these systems would just negotiate a TLSv1.1 or v1.0 connection. Hell, even start the connection with no TLS for 90's system. But basically the entire internet decided that just rejecting the connection all together was better than allowing an insecure connection. So now what you see is any Mac running an OS older than macOS 10.9 Maverics (2013), basically can't browse the internet at all.

2) H.264 is too Sophisticated: Even if these Macs could connect to Youtube, H.264 is such a computationally intensive codec, that these old Macs can barely play back postage stamp sized video in H.264.

  • H.264 was such a huge success because it meant extremely high quality videos used very little bandwidth compared to its predecessors like Xvid and MPEG2. So while old Macs have not much trouble MPEG1, MPEG2, and Xvid, we never got high quality videos back in the day because there was not enough bandwidth on the internet to get quality video out of these codecs.

How to Stream High Quality Video on a PowerPC Mac

We are basically going to use the fact that we have a local high speed ethernet network that our PowerPC Mac sits on to stream an incredibly high bit rate yet simple to decode video codec like MPEG1, MPEG2, or Xvid. We are going to use so much bandwidth that even a modern internet connection would have trouble streaming this video over the internet (10+Mbps).

The approach replaces the limited CPU power of PowerPC Macs and replaces it with tons of bandwidth which they can handle thanks to their 10/100Mbps ethernet ports.

Known Limitations

Video Quality:

I want to be clear here that we are not going to get beautiful 4K content playing on our PowerPC Macs. They just do not have enough power. But depending on the system you have you will probably at least get:

  • 720p video (480p on Tiger)
    • 1080p may be possible on fast G4's and G5's
  • 20-30FPS
  • Decently clear picture without too many blocky compression artifacts

Audio Quality

Audio quality is excellent. We get full AAC 192k or MP3 320k at 44,100Hz with no issues. However, disabling audio will let you get higher video quality. So if you are OK using your Apple Silicon Mac as the audio output device (which may be preferred if you use Airpods for example), then you can push the video codec further.

System Requirements

  1. PowerPC Mac running at least Mac OS X 10.4 Tiger (10.5 Leopard preferred)
    1. What about Jaguar? VLC claims they have a version that supports 10.2 Jaguar but when I launched it on 10.2.8 it just crashed and I didn't try to troubleshoot at all. But theoretically this would work on any version of OS X if you could get VLC to start.
    2. Why is Leopard preferred? In the many hours of testing I have done, Leopard seems to have a better networking stack that can handle 10+Mbps onslaught of UDP packets we are going to throw at the system. I was able to get almost double the resolution in Leopard (1152x720p) than I was able to in Tiger. But Tiger still works fine, just lower quality.
  2. PowerPC Mac connected to your home network over ethernet: Sorry, the Airport cards on these old Macs are too slow for this.
  3. Apple Silicon Mac: This will be the streaming server. Theoretically, any computer that runs FFMPEG could be the streaming server. But this tutorial is for Apple Silicon Macs.

My Setup

Tools

  1. UTM - A UI wrapper around the venerable QEMU virtualization and emulation tool
  2. Debian 12 - You can use any Linux you like, but I found Debian 12 to be easiest
  3. FFMPEG - The one-stop-shop for all video encoding and decoding
  4. VLC - The one-stop-shop for all video playback on OS X for 25 years

Why Use a Virtual Machine

The original version of this tutorial was entirely Mac based however, I still used a VM because AVFoundation only lets FFMPEG capture entire screens and I thought it was not very convenient to give up a whole monitor streaming. But primary, there is some sort of bug in FFMPEG that makes capturing high quality audio via AVFoundation not work properly. I think its Bug #11398 but I'm not sure.

But as could be expected, FFMPEG works great with Linux. That said, I did many many hours of troubleshooting and I found some critical things you need from your Linux Video Streaming Server. This tutorial is the easiest way I found to do this. But you can use your own Linux server as long as:

  • It runs X11: This is not the default for many years, but Ubuntu 25.10 drops X11 entirely
  • It runs Pipewire 1.4.2: Debian 12 by default runs a very old version of Pipewire and it does not work properly for this streaming setup
  • It supports hardware GPU acceleration

Tutorial

I tried to add as many screenshots as possible. So if you are getting lost, use Command+F and search for "Screenshot" to highlight all of the screenshot links in the tutorial.

Also note that if you use the Debian VM image I link below, then copy and paste works between the Host Mac and the VM Linux. However, remember that Linux uses the Control key instead of Command. Also, the terminal in Linux uses Conotrol + Shift + C and Control + Shift + V.

Step 1: Prepare your Virtual Machine

  1. Install UTM
  2. Open UTM - Screenshot
  3. Download the Debian 12 image for UTM
  4. Choose a place on your hard drive you want the VM image to live and move it there
  5. Extract the Zip file - Screenshot
  6. Double click to open it in UTM - Screenshot
  7. Click the "Edit Selected VM" in the toolbar at the top right of the UTM window
    1. [Required] In Network change the "Network Mode" to Bridged - Screenshot
    2. [Optional] In Display uncheck "Resize display to window size automatically" - Screenshot
      1. This is a nice feature normally, but for our streaming server we never want the resolution to change
    3. [Optional] In USB Drive delete the USB CD-ROM Drive: We won't use it - Screenshot
    4. [Optional] In Sharing change the "Directory Sharing Mode" to None: We won't need to share files - Screenshot
  8. Boot up your VM
  9. [Required] At the login window change to 1 of the Xorg (X11) options - Screenshot
    1. Username and Password are both debian
  10. [Optional] Open the Settings app and change the following
    1. [Optional] Privacy→Screen - Disable screen blanking - Screenshot
    2. [Optional] Users - Enable Automatic Login - Screenshot
    3. [Optional] Appearance - Enable Dark Mode - Screenshot
    4. [Optional] Date&Time - Set your time zone - Screenshot
    5. [Optional] Keyboard - Add your keyboard if you don't use a US keyboard - Screenshot
    6. [Optional] Mouse&Keyboard - Enable Natural Scrolling - Screenshot
      1. If you are a Mac user you are probably used to natural scrolling at this point (no judgement 🤣)
    7. [Optional] Sharing - Change the system name - Screenshot
      1. If you want to use SSH to login to the VM: ssh debian@Chosen-Sharing-Name.local
  11. Open FireFox and browse to Youtube to ensure your network and sound are working
  12. Open Terminal and ping a Mac on your network (preferably not the host Mac) - ping Retro-Mac-Bonjour-Name.local
    1. If the host is not reachable then there is a network issue (probably not bridged)

Step 2: Install Updates

Sorry, some of these steps say to use vi in the terminal. You may need to look up how to use this text editor, its not easy. If there is another text editor you already know how to use like nano feel free to use that instead.

Install Updates from Debian Backports

Debian 12 has many quite old pieces of software because Debian tries to maintain a reputation of being stable. But they also offer "backports" which will install newer versions of packages to your system. Specifically we need a much newer version of Pipewire which is the audio system in Linux that FFMPEG will capture from.

sudo vi /etc/apt/sources.list

At the bottom of the file, paste the following

deb http://deb.debian.org/debian bookworm-backports main contrib non-free

Save the file and exit, then update apt

sudo apt update

Now we need to tell apt to install all of the backport updates. This will tell you there are 400+ updates needed, just confirm Yes. Note that it may present some text files that give you info about the updates. If those appear, press q to exit and allow the updates to install.

sudo apt -t bookworm-backports upgrade

Now we need to update any remaining updates

sudo apt upgrade

Now you can test to make sure a new version of pipewire is installed. The version should be 1.4.2 but if its below 1, then we have a problem.

pipewire --version

Now you can restart the system

sudo shutdown -r now

Step 2: Install FFMPEG

FFMPEG is a legendary tool for video and audio encoding, decoding, and streaming. In this tutorial I will probably only cover 1% of its functionality. However, it gives us the power to tweak everything so we can stream to our Retro Mac with unexpectedly good quality.

sudo apt install ffmpeg pulseaudio-utils

Set the default Pipewire audio capture device to be the "monitor". The default capture device is usually the microphone, which makes sense, but is also not what we want. I will give you the specific commands for my system, but be careful to make sure the long names with numbers all match your system.

pactl list short sources

Now set the default to the device that ends in "monitor". Again, make sure the name you type in matches your system if it happens to be different from mine.

pactl set-default-source alsa_output.pci-0000_00_03.0.analog-stereo.monitor

Step 3: Test Video Streaming to your Apple Silicon Mac

Because the Retro Mac might have other problems we can't control, first we are going to try to stream video from the VM directly to your Apple Silicon Mac Host. This will let us know the video streaming is working without worrying about 20+ year old hardware and software.

On the Host

  1. [Host] Install VLC
  2. [Host] Open VLC and choose File→Open Network… and type in udp://@:1234 - Screenshot
  3. [Host] Now the host is waiting for a UDP stream from the VM

On the VM

Open terminal and paste the following. I'll explain the options later. But for now the only thing you need to change is the bonjour name on the last line.

ffmpeg \
  -f x11grab -framerate 20 -draw_mouse 0 -i $DISPLAY \
  -f pulse -i default \
  -c:v mpeg4 -qscale:v 5 -vtag XVID \
  -c:a aac -b:a 192k -ac 2 -ar 44100 \
  -vf "scale=640x400" \
  -f mpegts "udp://Host-Mac-Bonjour-Name.local:1234?pkt_size=1316"

You should see that VLC on the host Mac is now playing video of the terminal on the VM. So on the VM you can open FireFox and play a Youtube video. If the sound comes through twice, then mute the audio in the VM by clicking on the menu item at the top right of the screen.

To end the stream, type q in the terminal of the VM.

Success Screenshot

Step 5: Prepare the PowerPC Mac

Note that for Leopard, the VLC website say you can use VLC 2.0.10 but I found this version to have terrible performance. A search online revealed the same thing. Instead you should use the newest version of 1.0 that you can find. Credit to PowerPC Liberation: Video on PowerPC: Part 1 - Playback on G4/G5

Note that due to the The TLS Apocalypse mentioned above, you will almost certainly not be able to download these directly on the PowerPC Mac. Instead you will need to download them on your modern Mac and then transfer them over file sharing.

Install VLC on your Retro Mac

  1. On the Apple Silicon Mac: Download an old version of VLC
    1. Leopard: VLC 1.1.12 from Macintosh Repository - Screenshot
    2. Tiger: VLC 0.9.10 from VLC Website - Screenshot
    3. Transfer the downloaded file to the PowerPC Mac via File Sharing
      1. New Macs can still connect to the AFP servers on old versions of OSX.
  2. On the PowerPC Mac: Install and run VLC
    1. Leopard Screenshot
    2. Tiger Screenshot
  3. On the PowerPC Mac: Get the Bonjour Name
    1. Note that this used to be called Rendezvous. So you might see that name used instead of Bonjour in the UI.
    2. System Preferences→Sharing - Leopard Screenshot
    3. System Preferences→Sharing - Tiger Screenshot
  4. On the PowerPC Mac: Open VLC and choose File→Open Network - type udp://@:1234 - Screenshot
    1. Your PowerPC Mac is now waiting for the stream to start
  5. (Optional) On the PowerPC Mac: Save the playlist for easy opening later - Screenshot

Start the Video Stream in the Linux VM

In the terminal paste the following. Note this is an extremely low quality stream. We are just making sure it works. We will optimize later.

ffmpeg \
  -f x11grab -framerate 20 -draw_mouse 0 -i $DISPLAY \
  -f pulse -i default \
  -c:v mpeg4 -qscale:v 10 -vtag XVID \
  -c:a aac -b:a 192k -ac 2 -ar 44100 \
  -vf "scale=640x400" \
  -f mpegts "udp://Your-Retro-Mac-Bonjour-Name.local:1234?pkt_size=1316"

🥳Congratulations🎉

You have a successful streaming setup completed. Now its time to optimize playback performance for your PowerPC Mac

Optimize Playback Performance

All of my testing was done on my 1GHz iMac G4. But if you have a more powerful Mac, you can get more bandwidth and quality out of it. Likewise, if you have a slower Mac, you can reduce quality.

To increase the speed of debugging, know that you can press Q to quit the FFMPEG server and then change the settings and restart it again. The PowerPC Mac will just pause until you restart FFMPEG. Note that you can only change minor settings like framerate and quality settings. If you change resolution or codecs, then you will need to stop the stream on the PowerPC Mac and restart it.

High Quality FFMPEG Command

Here is our example command which I find to have very quality and performance on the iMac G4 1GHz. But based on your specific Mac, you may want to change these settings.

ffmpeg \
  -f x11grab -framerate 20 -draw_mouse 0 -i $DISPLAY \
  -f pulse -i default \
  -c:v mpeg4 -qscale:v 3 -vtag XVID \
  -c:a aac -b:a 192k -ac 2 -ar 44100 \
  -vf "eq=gamma=0.80,scale=1152x720" \
  -f mpegts "udp://Your-Retro-Mac-Bonjour-Name.local:1234?pkt_size=1316"

FFMPEG Command Explanation

Command Explanation
ffmpeg
-f x11grab -framerate 20 -draw_mouse 0 -i $DISPLAY \ This specifies the video input - Modify the framerate to find the right balance between quality and performance
-f pulse -i default \ This specifies the audio input - The default capture device we specified earlier in this tutorial
-c:v mpeg4 -qscale:v 3 -vtag XVID \ This specifies video codec (XVID) - Modify QSCALE from 1 (highest) to 31 (lowest) to find the right balance between quality and performance
-c:a aac -b:a 192k -ac 2 -ar 44100 \ This specifies the audio codec (AAC) - If your Mac has trouble with AAC, you can change to MP3
-vf "eq=gamma=0.80,scale=1152x720" \ This specifies the video filter - You can do add many filters, but here we scale the video to be lower resolution and change the gamma to be darker (older Macs had a brighter gamma, so modern content can look washed out)
-f mpegts "udp://Your-Retro-Mac-Bonjour-Name.local:1234?pkt_size=1316" This specifies the destination for the UDP stream (Your retro Mac)

Modifying FFMPEG Commands

As FFMPEG is extremely complex, I highly recommend using ChatGPT or another LLM to help you with FFMPEG. This is where I learned everything for FFMPEG. I only use the free ChatGPT account and its perfectly adequate. For example, here is a sample prompt and a screenshot of the response. You can see that it exactly modified the one line that needed to change.

Hi, I need help with FFMPEG. I am using Debian 12 with Backports installed to
stream to an iMac G4 running Leopard and VLC. The iMac doesn't have much
processor power and so I am trying to optimize performance. I have this FFMPEG
command that streams in XVID and it plays pretty smoothly on my iMac, but I
want to try MPEG2. Can you update the command to use MPEG2?

ffmpeg \
  -f x11grab -framerate 20 -draw_mouse 0 -i $DISPLAY \
  -f pulse -i default \
  -c:v mpeg4 -qscale:v 3 -vtag XVID \
  -c:a aac -b:a 192k -ac 2 -ar 44100 \
  -vf "eq=gamma=0.80,scale=1152x720" \
  -f mpegts "udp://Your-Retro-Mac-Bonjour-Name.local:1234?pkt_size=1316"

ChatGPT Help

FAQ

  1. Isn't this hard on a Retro Mac?
    1. Yeah, this is very hard on your old Mac. My iMac G4 can do it for hours with no stability challenges, but we are talking 100% CPU and many many gigabytes of network traffic.
    2. I think this is more of a philosophical question than a technical one. I feel like these beautiful, powerful machines were meant to be used rather than sitting on a shelf.
  2. Won't this slow down my Apple Silicon Mac?
    1. I have the absolute slowest Apple Silicon Mac. Its an M1 MacBook Air with no fan. Its true that this solution takes about 100% of 1 core of the CPU. But I have not noticed any slow downs or throttling. This includes when I am using Xcode to develop software for iOS and Mac apps.
  3. Can this be done without an Apple Silicon Mac?
    1. Absolutely! The server could be any machine that runs FFMPEG which is pretty much any machine. I look forward to seeing a future tutorial that uses a Raspberry Pi 🍓
    2. I just created this tutorial using UTM and Apple Silicon because thats what I have. But there is no reason the exact same thing can't be done with an Intel Mac and VMWare Fusion (which is free now by the way)

Advanced

FFMPEG Multi-Stream

FFMPEG with MPEGTS streaming protocol can actually stream to multiple computers at once over UDP. Why would you want to do this? Well, if you have a whole army of retro computers, you could have them all play the same video at once… Or more likely, you are interested in using modern bluetooth audio options to listen to the stream while using the retro Mac to display the content.

Unfortunately, this will not result in every computer playing in sync. The UDP stream just flies out of the Linux VM and the client computers play it as quickly as they can with no regard to eachother.

Whats different in this command?

ffmpeg \
  -f x11grab -framerate 20 -draw_mouse 0 -i $DISPLAY \
  -f pulse -i default \
  -c:v mpeg4 -qscale:v 3 -vtag XVID \
  -c:a aac -b:a 192k -ac 2 -ar 44100 -async 1 \
  -vf "eq=gamma=0.80,scale=1152x720,tpad=start_duration=0" \
  -af "adelay=0|0" \
  -f mpegts "udp://Lamps-Plus.local:1234?pkt_size=1316" \
  -f mpegts "udp://Pinkinium.local:1234?pkt_size=1316"
  1. -f mpegts 2x - Specify as many destinations as you like
  2. -vf - Added tpad=start_duration=0 - Change the zero to a number in seconds to cause video to be delayed in order aid with syncing
  3. -af - Added Audio Filter - adelay=0|0" - Change the 0|0 to a number in milliseconds to cause audio to be delayed in order aid with syncing. Each side of the | is left and right channel, so the numbers should be the same.

Set Exact Resolution in Debian

The Debian VM boots to 1280x800 which is a pretty good resolution for a lot of retro Macs as long as they are widescreen. However, you may want to set the virtual machine to a different resolution. This can be done pretty easily in the Settings app under Displays. However, not all resolutions are in there. Also, all of those resolutions are at 60Hz which makes sense because thats a typical desktop refresh rate. So why would you want to change the resolution?

  1. Using the -vf scale option is actually kind of compute intensive because FFMPEG has to scale the video before sending it over the wire
  2. 60Hz is likely way faster than your Retro Mac will be able to render. So this is also wasting performance of the Virtual Machine and the Host Mac.

How to Set the Resolution Manually on the Debian VM

Declare to the system which resolution you want

cvt 1152 720 30

The output will look something like this, and we are interested in the Modeline

debian@debian:~$ cvt 1152 720 30
# 1152x720 29.96 Hz (CVT) hsync: 22.05 kHz; pclk: 31.75 MHz
Modeline "1152x720_30.00"   31.75  1152 1184 1296 1440  720 723 729 736 -hsync +vsync

Add the resolution to the windowing system. Execute the 2 commands and make sure the first one matches the Modeline output exactly.

xrandr --newmode "1152x720_30.00" 31.75 1152 1184 1296 1440 720 723 729 736 -hsync +vsync
xrandr --addmode Virtual-1 "1152x720_30.00"

Now set the resolution. After you run this command, the resolution should change and the UTM window will resize.

xrandr --output Virtual-1 --mode "1152x720_30.00"

Now the issue is that this will not persist across reboots and you will have to run these 3 commands every time. To fix that we need to save the monitor configuration in X11.

sudo mkdir -p /etc/X11/xorg.conf.d
sudo vi /etc/X11/xorg.conf.d/10-monitor.conf

And put the text in the configuration file. Again, make sure the Modeline matches exactly.

Section "Monitor"
    Identifier "Virtual-1"
    Modeline "1152x720_30.00" 31.75 1152 1184 1296 1440 720 723 729 736 -hsync +vsync
    Option "PreferredMode" "1152x720_30.00"
EndSection

Section "Screen"
    Identifier "Screen0"
    Monitor "Virtual-1"
    DefaultDepth 24
    SubSection "Display"
        Modes "1152x720_30.00"
    EndSubSection
EndSection

Now when you restart, it should boot into the resolution you specified. Note that it will have 3 resolutions during boot. The basic 800x600 used by Grub, then it resizes to 1280x800 as the default resolution before X11 starts up, and then when you get to the login screen or the desktop, it will resize to your selected resolution.

Reduce System Requirements of the VM

After you get everything working, and you know everything works smoothly and without hiccups most of the time, then you can reduce the amount of resources the VM is allowed to use. By default its 4 cores and 4GB of RAM.

When you have your streaming setup running, use HTOP to see how much RAM and how much CPU is in use. HTOP does not come on debian so you can install it.

sudo apt update
sudo apt install htop
htop

In my system. I found it rarely used more than 2GB of RAM and all 4 CPU cores were at about 25% when streaming was running. So I decided to reduce the available resources to 2 Cores and 3GB of RAM… I found 1 Core caused skipping and other problems with the stream. In UTM you can change the settings however you like to reduce the burden on your host Mac.

UTM System Settings

About

A tutorial on how to stream Youtube or any other video content to PowerPC Macs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors