Skip to content

About

bad apple rendered by the C preprocessor

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

Bad Apple!! Played in CPP

This project uses the C preprocessor to render individual frames from the well known Bad Apple!! music video, without sound.

It cannot play the whole video without a little scripting help (a simple bash loop is well enough) but even then I found it very slow, so in addition to the scripts to run the "pure" version which truly renders entirely using the C preprocessor, I have also added a C program player.c which allows playing the entire video at 30fps.

First, frames.h was generated by turning each individual frame from the video in its "C macro encoding" equivalent. Then, by including decoder.h the preprocessor naturally expands each frame into its uncompressed, ASCII equivalent.

Pure version

To run the pure version, it is sufficient to run:

$ bash play.sh

in the terminal. In case your CPU is monstrously fast and runs the thing at more than 30fps, you can tweak the usleep delay in the script. My computer runs the video 10-15x slower than real time this way.

Impure version

To run the impure version it's sufficient to compile player.c before running it:

$ gcc -o player player.c && ./player

If you want audio in the background:

$ mpv --script=script.lua --no-video bad_apple.mp4 

And if you want to compare it with the real video in real time:

$ mpv --script=script.lua bad_apple.mp4 

Enjoy this little demo video:

https://imgur.com/a/uCOGgVd


This program was only tested with GCC.

About

bad apple rendered by the C preprocessor

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages