VOGONS


First post, by Kisai

User metadata
Rank Member
Rank
Member

Call me lazy or silly, but whenever I reinstall dosbox, I inevitably forget about the zmbv codec until I try to play a video. Hopefully this is the right place to post a solution.

I compiled a 64-bit codec a few years ago when I was goofing around in trying to see what Google (Youtube) could take. I mostly used the codec for trimming ZMBV encodes in VirtualDub x64. Sometimes I resized things and that resulted in a re-encode.

There really isn't much point to the 64-bit codec other than to make it work in Adobe Premiere Pro CS4+ , VirtualDub 64bit, or other 64-bit native software with a VFW interface. There is no speed or performance change, and the codec will not use more than one cpu core by design.

Attached is the binary version of the ZMBV 32bit and 64-bit codec and a registry file that will "install" it on 64-bit windows. You will need administrative access.

Instructions, just copy zmbv64.dll to \Windows\System32 and then run the registry file. You may want to copy zmbv.dll to \Windows\SysWOW64 if you want the same version of the file for 32-bit software. This is exactly how I install it each time.

To differentiate the 64-bit codec from the 32-bit codec that comes stock with Dosbox, this version will say "Zipped Motion Block Video x64 0.1b" But it's otherwise reads and encodes files that work with the original version and ffmpeg produced ZMBV compressed AVI files.

PS, if you don't know what you're doing or why you need this, don't download this.
PPS, this is AS-IS, No warranty, No support. I can't find the source code from which I built it from, but the changes were trivial and by default operates exactly as the 32-bit codec that comes with dosbox 0.74.

Reply 1 of 9, by Kisai

User metadata
Rank Member
Rank
Member

If you've been using this on Windows 10, at some point (probably in the last year) it started crashing, due to what I can only suspect being fixes to spectre.

Only one code line has actually been changed from vanilla r4259, it's been compiled with Visual Studio 2019 with the spectre flag turned on. Also compiled against zlib 1.2.11
Line 71 blocks compilation

extern "C" LRESULT __declspec(dllexport) PASCAL  DriverProc(DWORD dwDriverID, HDRVR hDriver, UINT uiMessage, LPARAM lParam1, LPARAM lParam2) {

In which the __declspec(dllexport) was moved to in front of PASCAL so Visual Studio would compile it.

In the version I posted in 2013 before would have been against a version of zlib 1.2.5, and Visual Studio 2008.

The previous version had additions to it to tweak the zlib compression level and key-framing for encoding video in a GUI panel/INI file, but the end result wasn't often justified unless you were trying to keep it under youtube's file size limits (in 2013 which used to be 2GB), so none of that has been added back. Note that uploading straight footage out of dosbox never has good results with youtube, hence I would re-scale the output and run it back through ZMBV in 32bpp then upload it to youtube that way. Unfortunately youtube also changed how it deals with keyframing, so uploading videos with the tweaked keyframing would result in youtube videos with no picture until a keyframe was hit. that also tells us exactly how youtube is creating video streams, it's encoding the original file uploads on the fly.

Anyway, here's a replacement to the 64bit dll. If I fix anything else in it, I'll update this. There is no 32-bit dll in this one.

Reply 2 of 9, by Reaper man

User metadata
Rank Newbie
Rank
Newbie
Kisai wrote:

Anyway, here's a replacement to the 64bit dll. If I fix anything else in it, I'll update this. There is no 32-bit dll in this one.

Hey, so just as a heads up, when using your latest dll, it refuses to show up in the VFW selection list. Not sure why though. Previous version works just fine.

Reply 3 of 9, by Kisai

User metadata
Rank Member
Rank
Member
Reaper man wrote:
Kisai wrote:

Anyway, here's a replacement to the 64bit dll. If I fix anything else in it, I'll update this. There is no 32-bit dll in this one.

Hey, so just as a heads up, when using your latest dll, it refuses to show up in the VFW selection list. Not sure why though. Previous version works just fine.

Oh, hmm, sorry about that, nobody else ever tested it, so it probably just persisted on my system.

Here's a recompile and an INF installer added.

Confirmation it appears in Vegas Pro 14, Virtualdub x64 1.10.4.0 , both 64-bit

Reply 4 of 9, by Reaper man

User metadata
Rank Newbie
Rank
Newbie
Kisai wrote:

Oh, hmm, sorry about that, nobody else ever tested it, so it probably just persisted on my system.

Here's a recompile and an INF installer added.

Confirmation it appears in Vegas Pro 14, Virtualdub x64 1.10.4.0 , both 64-bit

Okay so this one works great. Just one little thing though that I hope you can clear up...

The configuration dialog now just shows a label-less slider that can apparently be set to any position. Does this do anything? Is it for zlib compression level? If it is, it doesn't seem to retain the setting no matter what I do. If not, what is the zlib compression level that it's set to, as I will only accept a level of 9. You you have your modifications to the source hosted somewhere?

EDIT: I'm no programming expert, far from it, but after mulling over the code from the original repository it looks like what I believe is a hard coded compression level of 4? I kinda want to compile my own version of it, but I'm not entirely sure how to set up the environment to compile given it requires compiling with zlib. Any help would be great.

EDIT2: well fuck, managed to get a successful compile on x64 release target, replaced the DLL, and nothing, it doesn't show up again. No idea why it didn't work.

If you feel like compiling it on your end I only really want to change one line at line 239 in zmbv.cpp from

if (deflateInit (&zstream, 4) != Z_OK)
to:
if (deflateInit (&zstream, 9) != Z_OK)

Reply 5 of 9, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

The slider does nothing, it's not hooked up to any code.

Dec 16 11:14:48 <jmarsh> umm https://imgur.com/a/TAWXinJ
Dec 16 11:14:55 <jmarsh> what is this mystical slider
Dec 16 11:24:25 <Harekiet> It gives people the illusion of control, that's what they need

Reply 6 of 9, by Reaper man

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote:

The slider does nothing, it's not hooked up to any code.

Yeah, I managed to figure that out after looking through the code.

Now, if only I was able to get the build I made to work, I would be set, but even though it successfully builds, it refuses to show up in the VFW codec selection window...

Reply 7 of 9, by Kisai

User metadata
Rank Member
Rank
Member
Reaper man wrote:
jmarsh wrote:

The slider does nothing, it's not hooked up to any code.

Yeah, I managed to figure that out after looking through the code.

Now, if only I was able to get the build I made to work, I would be set, but even though it successfully builds, it refuses to show up in the VFW codec selection window...

A long time ago in a codec far away, I had the bright idea to "Fix" this, and then also allow every other zlib tweak to it. However the tradeoff in most cases was not worth it. The recompression from an 8-bit to a 32bit video file would inevitably become bigger regardless.

If you really desire this feature I can probably just fix it. The only purpose I found with it was allowing smaller files to upload to youtube. But even then, what would have been necessary to get a truely usable file would be to change the keyframing, as I've been able to upload ZMBV videos to youtube that was all delta frames, and it works, but youtube is entirely unable to deal with it unless people are constantly watching the video. So this would have to go back into how ZMBV, and DOSBOX itself actually decide when something should be a keyframe.

I used the same code to experiment with lzo, lzw and lzma, and basically the only lossless compression scheme that offers any benefit over zlib is ppmd ( https://en.wikipedia.org/wiki/Prediction_by_partial_matching )

Reply 8 of 9, by Reaper man

User metadata
Rank Newbie
Rank
Newbie

Yeah, I basically want the highest compression hard coded in. I figured out how to vcpkg a static library version of zlib in, but VS2019 refuses to see it now. I think I have to fiddle with a setting in the project's properties somewhere, but I have yet to find said option.

EDIT: Got it to compile, even with the Spectre mitigation but it still refuses to show up. I'm at a bit of a loss at this point...

Reply 9 of 9, by Reaper man

User metadata
Rank Newbie
Rank
Newbie

Update: I'm an idiot

SO I just now realized that I wasn't renaming the dll from zmbv to zmbv64, oops.
In any case, I was able to get it to work, and the resulting file sizes are smaller, which is exactly what I wanted. With that said, since I spent so much time pulling my hair out on this, I'm offering my modified DLL for those that wish maximum compression, Enjoy!