Monday, August 27, 2012, 12:57
Introduction
13 months ago I uploaded a video of N.O.P.'s Unknown Reality megademo. There was one major problem during the recording session. The demo switches between 50 Hz and 60 Hz interrupt which causes the video to fail to synchronize audio and video all of a sudden. To prevent this I wrote a script for openMSX (the MSX emulator I used to record the megademo and the first emulator to actually run the demo correctly) which automatically starts a new recording when the VDP switches between 50 Hz and 60 Hz interrupt. I called it vblank.tcl and an extended version of it is available here.
The openMSX TCL script
vblank.tcl:
namespace eval vblank {To use the script copy and paste the contents of the window into a text editor and save it as vblank.tcl in your personal openMSX/share/scripts folder. In Windows this openMSX folder can be found in My Documents.
variable cur_wp ""
variable old_r9 0
proc check {} {
variable old_r9
if {[expr [vdpreg 9] & 2] != $old_r9} {
set old_r9 [expr [vdpreg 9] & 2]
if {[record status] == "status recording"} {
record stop
record start -doublesize
}
}
}
proc toggle_vblank {} {
variable cur_wp
if {$cur_wp == ""} {
set cur_wp [debug set_watchpoint write_io 0x99 1 { vblank::check }]
} else {
debug remove_watchpoint $cur_wp
set cur_wp ""
}
return ""
}
namespace export toggle_vblank
}; #namespace
namespace import vblank::*
Recording the demo
Before you start recording the demo go to the openMSX console (F10 in Windows) and execute toggle_vblank. This will start the script that will automatically restart a new video file when necessary. Then start recording with the record start -doublesize command.
After recording the entire demo with all required hardware, I ended up with 16 separate AVI files. First step is to convert the frame rate of one of the interrupt frequencies to the other. I decided to convert the 50 Hz interrupt videos to 60 Hz. To do all this I used VirtualDub. It's possible to do multiple conversions in one go. I'll list the conversions you'll need to do.
All of these settings need to be exactly the same for all video fragments to allow to put all of them together in one video file!
Frame rate conversion
To convert the frame rate follow Video, Frame Rate..., Frame rate conversion, Convert to fps. In here you need to enter two values indicating the frame rate. In openMSX 50 Hz is calculated with the following values: 50158973 and 1000000. 60 Hz is calculated with 59922743 and 1000000. In VirtualDub you can read those values in hexadecimal notation (left is the hexadecimal value, right the decimal one):
000f4240 = 1000000 (divider)
02fd5d7d = 50158973
03925937 = 59922743
These values are important because you need to input those in the Convert to fps box to calculate the exact frame rate for the new video.
Video Compression
As the video codec used in openMSX doesn't have the decoder in the Windows codec you'll need to select a different codec to use. This can be done in Video, Compression... to select the codec and settings to use.
Audio Compression
For the best audio quality I recommend using Direct stream copy in the Audio menu.
Conversion time
In the File menu, start Queue batch operation, Batch wizard...
Select the files to convert and where you want to store them. Click Add To Queue and Re-save as AVI.
Next, select Job Control, Start in the File menu. The files will be converted. This may take quite some time. If all went well, the new files will be in the destination.
Put them together
In the File menu, select the converted base AVI from Open video file...
Then select Append AVI Segment with all additional converted AVI files.
In both Video and Audio menus select Direct stream copy.
Now, in the File menu, Save as AVI...
Select the location and filename for the final result file.
You may need to abort sooner (around the total size of the seperate files) and resize the result video to the correct size by opening it and saving a selection.
Final words
YouTube will reduce the frame rate to around 30 fps which did break effects in the resulting video. So compensation for that may be required. As of 14 November 2014, a re-upload is available showing the demo in all its glory on 60 fps!
The result can be viewed here:
add comment
(7889 views)
| permalink
| related link