16th of March 2022 – Bad Apple again!

About 6 years ago I wrote one of my first Vectrex blog entries about Bad Apple.

This is sort of a “follow up”. “The Times They Are a-Changin’

Steve Jobs might have been quite mad with me, migrating from my iMac to a Windows PC – especially by quoting Bob Dylan when doing so… nonetheless this did happen.

Above mentioned blog entry does not “work” for me anymore – since it was mainly written for Mac-Users. Being now (again) a member of the windows world and wanting to test out movie generation for vectrex again, I was faced with a dilemma:
– should I power up my old rusty iMac?
– should install everything on a virtual (Ubuntu) machine?
– is it even possible to use a windows based setup?

Long talk – short answer:

Above file contains (runnable out of the box) a windows 10 (tested on 3 different machines) version of the complete setup to generate a BadApple “Movie” for the vectrex.

You know – I adore software that just comes in a package (plain zip) and works out of the box, without downloading additional stuff, without setting up, without missing DLL and without it corrupting your registry and file system with unwanted links.

Above pakage is such a thing, you unpack it anywhere you like and in a shell (or from your Total Commander) execute:

convert.bat Bad_Apple.mp4

… and it will build the movie.

It takes time – depending on the speed of your computer it might take an hour or so. While running a vecx emulator will at some stage be shown, that plays the complete movie. This is to determine sync values for the audio. The vecx will close itself when finished!
(and the last stage of the building process will begin)


Some more information:

The package includes:

  • mplayer – binary installed
  • ImageMagick – binary installed
  • potrace – binary installed
  • sox – binary installed
  • asm6809 – binary installed
  • vecx (patched) – binary installed
  • php – binary installed
  • bash – binary installed

If you execute the convert.bat, all paths are setup from the current directory. The convert.bat takes one parameter, the MP4 file to convert. Most probably other files might need different “internal” settings to look good.

The version above is nearly identical to the original SpritesMod version, that is – it only supports potrace data output. I have somewhere on my Mac a modified version, that also supports autotrace output (svg), but I have not converted that yet …might be a future project.


Behind the scene – what does this do?

convert.bat
sets up the correct paths to use bash, and than executes the bash with the “convert.sh” script file

convert.sh
this very closely resembles the original sprites mod script. Modified in the ways to add local binary paths and to pass some parameters to the combine.php script.

mplayer
the convert.sh script first invokes mplayer, which generates “png” snapshot files of the movie and also saves the audio to a wav file. All png files are generated into a directory “png”. For the included BadApple version 6572 png images (each 500kB) are created.

ImageMagick
is called to convert the png files to pnm files (potrace cannot work with png). All pnm files are generated into the directory “pnm”.

potrace
each of the pnm files is converted (vectorized) with potrace to a “geojson” format. These files are stored in the directory “vec”.

sox
is called to convert the wav file (output from mplayer) to a raw 11700 hz data file (audiodump.raw)

combine.php (1)
is called to generate vectrex “vector line” data. The raw data is output to a binary vec.bin.
In stage 1, the audio data is not included in vec.bin.
This for now also generates into the directory “tst” png files for “debugging” which shows the original png image overlayed with the generated vectors – to be able to “manually” compare the vector output to the image input.

asm6809
The player of binary for the vectrex is created.
Executing this – my installed Virus scanner always throws an alarm. But this file does NOT contain any Virus (I double check with VirusTotal). Theoretically you only have to build the player once, since it is always the same. But in case you would want to change the vectrex binary in any way, this is part of the complete setup.

vecx
The special vecx version is started with the built player. The vecx loads the vec.bin and generates a timing.log. The log describes the length and position of where the player can play the audio data.

combine.php (2)
is called again to generate vectrex “vector line” data. The raw data is output to a binary vec.bin. In stage two the timing.log information is used to build an “interleaved” version of the vector data and the audio data. The final pairing:
player.bin (vectrex executable)
and
vec.bin (file to “stream” from)
Can be used to play the movie.
(VecFever, VeXtreme, PiTrex – or Vide if the cartridge setup was done correctly)


Still further information

Vecx was build using a “MSYS MinGW x64” unix environment install under windows. Additionally to the development tools it was necessary to find SDL and two SDL extensions (SDL! – NOT SDL 2).
SDL “install” is supplied within the directory “MovieGen\bin\vecx.win32\SDL” – it took me some time to find the correct SDL downloads.

Bash install was “snitched” together from a windows git install, which was also based on MINGW64. I only copied over the bash commands that were used in the script.

PHP – I just installed the current (php-8.1.3-nts-Win32-vs16-x64.zip) version, and enabled the needed extensions to the php.ini file.

All other binaries were downloaded from their original homepages (links in my original blog entry are still valid!) and unpacked “as is” – it seemed to be easier going than on my iMac 6 years ago!

Tagged on: , , ,

6 thoughts on “16th of March 2022 – Bad Apple again!

  1. Malban Post author

    A little “adendum”, if you want to use the generated move files with your VecFever cart.

    The current implementation of MovieGen uses the old “player” written by SpritesMods. This is not 100% compatible to my own new version, which is used within Vide.

    That means for now the played files sound not too good when converted. I’ll fix that soon – or at least one day… depends on how much “people” want that.

    To play these files on a VecFever:
    What you need to do…
    – Start Vide
    – go to the menu “Tool”
    – go to sub menu “Utilities”
    – activate menu item “File Utility” (last item)
    – go to TAB 3
    – in the subsection “ExtremeVectrex to V4EB” chose the generated vec.bin
    – press the button V4EB
    in the same directory a vec.bin.V4E will be created, that is playable on a vecfever… but the sound will stutter a bit.

    This is caused by the different player variants.
    The player, that the conversion tool uses is located under: Vide/template/ExtremePlayer.bin

    The sourcecode can also be found under “Vide/projects/ExtremePlayer” – but of hand I can’t remember what you have to do to undo the changes.

    You can find the ORIGINAL player for the VecFever here: http://vectrex.malban.de/ExtremePlayer.bin

    If you overwrite the one in “Vide/template/ExtremePlayer.bin” with the above file… the movie generated with above procedure will play correctly on the VecFever.

  2. Brandon

    Just tried again on a very clean install of Windows 10 Pro.
    I can’t get it to work. I’d love to figure out what I am doing wrong.

    C:\Users\brandon\Desktop\MovieGen>PATH=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\brandon\AppData\Local\Microsoft\WindowsApps;;C:\Users\brandon\Desktop\MovieGen\bash.win32\usr\bin

    C:\Users\brandon\Desktop\MovieGen>.\bin\bash.win32\usr\bin\bash.exe convert.sh
    mkdir: cannot create directory ‘png’: File exists
    MPlayer sherpya-r38328+g30322ebe3c-10-win32 (C) 2000-2021 MPlayer Team

    Playing ../.
    File not found: ‘../’
    Failed to open ../.

    BENCHMARKs: VC: 0.000s VO: 0.000s A: 0.000s Sys: 401.352s = 401.352s
    BENCHMARK%: VC: 0.0000% VO: 0.0000% A: 0.0000% Sys:100.0000% = 100.0000%

    Exiting… (End of file)
    /c/Users/brandon/Desktop/MovieGen/bin/bash.win32/usr/bin/mv: cannot stat ‘audiodump.wav’: No such file or directory
    Converting Audo data
    C:\Users\brandon\Desktop\MovieGen\bin\sox.win32\sox.exe FAIL formats: can’t open input file `audiodump.wav’: No such file or directory
    Building vectrex player
    Generating audio sync timestamps
    After playing the complete video, exit the emulator with ESC
    /c/Users/brandon/Desktop/MovieGen/bin/bash.win32/usr/bin/mv: cannot stat ‘./bin/vecx.win32/stdout.txt’: No such file or directory
    Inserting audio sync timestamps – final stage
    PHP Warning: ‘C:\Windows\SYSTEM32\VCRUNTIME140.dll’ 14.0 is not compatible with this PHP build linked with 14.29 in Unknown on line 0

    Conversion finished.

    C:\Users\brandon\Desktop\MovieGen>pause
    Press any key to continue . . .

    1. Malban Post author

      Hard to do those debugging from afar.
      From the output it looks like you unpacked the zip on your desktop.
      There is a warning about “directory png” File exists – which is a very strange message, because the script explicitly oversteps that part of the script where it creates the directory when in already exists…

      But I think the main clue is:
      "Playing ../."

      I think you just executed the convert.bat without parameter….

      Open a command shell and type (in the MovieGen directory)

      convert.bat Bad_Apple.mp4

      You must provide a name to the script to convert…’

          1. Brandon

            I downloaded and installed the Microsoft Visual C++ 2015-2022 Redistributable (x64) – 14.31.31103

            From visual studio.microsoft.com/downloads/
            Other Tools, Frameworks, and Redistributable

            MovieGen works great now! Thank you for making it.

            The audio is still very click for me when playing on a vecFever on two Vectrex. I did replace the ExtremePlayer.bin. Wondering if there is anything else I can do so the audio on the vectrex sounds ‘not clickly’ when playing on VecFever.

Leave a Reply to Malban Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.