(old) ZMV to AVI video conversion [[archive me]]

General area for talk about ZSNES. The best place to ask for related questions as well as troubleshooting.

Moderator: ZSNES Mods

Locked
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Welcome to page 6.

To record a video you need one of the latest work in progress builds of ZSNES. Get them here: http://zsnes.ipherswipsite.com/

You will need a copy of mencoder. For Windows users, I recommend getting mencoder here: http://oss.netfarm.it/mplayer-win32.php
Place mencoder.exe in the same location as zsnesw.exe, you do not need any codecs or other movie programs installed.
Linux users, having mencoder in your path is fine.

If you want to compress the outputted audio, or compress it before it goes into the video as opposed to during, you will need a copy of LAME.
If you use Windows, you must get LAME from here: http://geocities.com/joecool22us/lame.zip
Any other copy of LAME for Windows will not work due to a bug in LAME.

Before you are able to dump an AVI, you must have recorded a movie first, it converts movies, it does not just dump video on the fly.

To play back movies, you'll either need the proper codecs or a video player with built in decoding of the video mode you selected.
I recommend getting mplayer which decodes anything created with mencoder. For Windows, you can get mplayer here: http://oss.netfarm.it/mplayer-win32.php You can download the GUI version.

Advanced users can edit zmovie.cfg and tweak the settings if they want, and even use something other than mencoder and LAME as long as it supports encoding via stdin and you set it up properly.

________
I'll look over Windows later.
Linux works fine though.
Last edited by Nach on Sat Mar 29, 2008 7:49 pm, edited 2 times in total.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

And the insanity continues! :D

http://nsrt.edgeemu.com/twoinone.avi

Yes the one on the right stops before the one on the left.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
kieran_
Mugwump
Posts: 824
Joined: Fri Jul 30, 2004 9:05 pm

Post by kieran_ »

God damn. I have to try this out whenI get home, although something tells me that I won't be able to get this working.
This is, for me, the most exciting developement in quite a while.

How many hours were involved in the creation of this code, Nach?

Keep up the good work.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

herzog wrote: How many hours were involved in the creation of this code, Nach?
Depends which part you're refering to.

However it took me over several months till I got the idea to call mencoder from ZSNES. I wasted a lot of time toying with other solutions.
herzog wrote: Keep up the good work.
Thanks :)
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

Nach wrote:And the insanity continues! :D
I can think of but one use for this... that bisquit video where they play MMX1+2(?) at the exact same time with the exact same input.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

I looked into the recent CVS stuff on Windows. Seems pagefault's error screen was always popping up, due to a wacky logic thing MinGW seems to be doing.

I fixed that, and now you can test:
http://nsrt.edgeemu.com/zsnesw-mov.zip

Anyone want to test that with LAME and the compress option too and let me know how it works?


I now also see Windows' popen() has the same issue as on *nix where it returns a FILE * even when it couldn't launch the app. I spent 2 days reimplementing popen() on *nix and I'd prefer not to do it again. Anyone want to give it a shot? Worse comes to worse I'll do it myself, but in the mean time we'll have to suffer with no error message when mencoder isn't found.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
KingHanco
Hazed
Posts: 79
Joined: Sun Feb 26, 2006 8:08 am

Post by KingHanco »

Nach wrote:I looked into the recent CVS stuff on Windows. Seems pagefault's error screen was always popping up, due to a wacky logic thing MinGW seems to be doing.

I fixed that, and now you can test:
http://nsrt.edgeemu.com/zsnesw-mov.zip
So did you use the ZSNES 02/27 (Windows) source to update the video?

I will test it out. :wink:
KingHanco
Hazed
Posts: 79
Joined: Sun Feb 26, 2006 8:08 am

Ok.

Post by KingHanco »

NSRT v3.3 RC3 - Nach's SNES ROM Tools

---------------------Internal ROM Info----------------------
File: Secret of Mana (U).SFC
Name: Secret of MANA Company: Square
Header: None Bank: HiROM
Interleaved: No SRAM: 64 Kb
Type: Normal + Batt ROM: 16 Mb
Country: USA Video: NTSC
ROM Speed: 200ns (SlowROM) Revision: 1.0
Checksum: Good 0x51FC CRC32: D0176B24
MD5: 10A894199A9ADC50FF88815FD9853E19
--------------------------Database--------------------------
Name: Secret of Mana
Country: USA Revision: 1.0
Port 1: Gamepad Port 2: The Multitap
Genre 1: RPG Genre 2: Action

Look at my last post.
Last edited by KingHanco on Tue Mar 07, 2006 8:19 pm, edited 1 time in total.
byuu

Post by byuu »

Nach, popen returns non-zero, even if you set it to zero before calling the function? Hm. Why not try using fopen first to make sure it exists. Sure, it's possible it can be there for the fopen but not the popen, but this will work for 99.999% of cases.

But that seems to obvious, so I'm probably misunderstanding the problem.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

byuu wrote:Nach, popen returns non-zero, even if you set it to zero before calling the function? Hm. Why not try using fopen first to make sure it exists. Sure, it's possible it can be there for the fopen but not the popen, but this will work for 99.999% of cases.
What in the world are you talking about?
fopen() what exactly? If you mean the executable, tell me of an fopen() which works with PATH.

I need a popen() which returns 0 if it couldn't launch, I wrote one for *nix, now I need one for Windows.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Aekeron
Rookie
Posts: 14
Joined: Tue Mar 07, 2006 12:12 pm

Post by Aekeron »

Hey there.

First off, thank you muchly for zSNES and all that. It's been my SNES emu of choice since version .4 or so.

Just wanted to say that the windows version of this seems to still be having the "mencoder is missing" issue. I dl'd and recorded a short movie last night without problems but this morning it doesn't seem to want to work (and always gives me that error).

I've tried re-downloading the 'fixed' version, deleting all the .cfg files and running mencoder seperately to see if it registers something somehow *shrug*. No luck. Just trying to re download memcoder now...
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

download a special version of zsnes here...
http://nsrt.edgeemu.com/zsnesw-mov.zip

it contains a fix so that mencoder works again... thank nach for this build.
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
Aekeron
Rookie
Posts: 14
Joined: Tue Mar 07, 2006 12:12 pm

Post by Aekeron »

Thanks. I could've sworn I downloaded the latest fix version. I must've just been half-asleep this morning. Seems to work now :)

*slaps self*

EDIT:

Maybe I'm going crazy here but whenever I download this modified version, it will record a movie ONCE and then start coming up with that error again. Am I doing something odd here or has anyone else had this problem?

EDIT again:

And now not at all. *goes through the re-extraction of all the encoders again*


3rd time's the charm:

Maybe it's something to do with my version of x264 - when I choose xvid output it'll at least start to output a proper video file. This file tends to be one second long and then stop, but heyho... Going to double check everything one more time.

And last one:

I've tried it with audio, without, redownloaded and reinstalled all the relevant codecs (xvid, x264, mencoder, lame). Can't seem to get anything working :/
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Is mencoder and lame in your path?
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Aekeron
Rookie
Posts: 14
Joined: Tue Mar 07, 2006 12:12 pm

Post by Aekeron »

They're both in the same path/folder as the zsnes .exe file (as is the rom).

Here's what my my snes recording folder looks like:

Image

It's a bit messy as I chucked in a load of extra files whilst trying to get it to work.

No doubt it's something simple I'm not doing...
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Being with ZSNES isn't good enough, the directory that contains it must be part of your PATH.

See this: http://www.computerhope.com/issues/ch000549.htm
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Aekeron
Rookie
Posts: 14
Joined: Tue Mar 07, 2006 12:12 pm

Post by Aekeron »

Ahhhhhhhhhhh....

That makes sense. I was kind of worried about that - it seemed somewhat odd that people were using a slightly odd turn of phrase to mean what I thought it meant. Makes much more sense now. Thank you :)

I'll give it a try now and let you know when it no doubt works flawlessly :oops:

EDIT:

Well, I've used that method to set "F:\snesREC" as an additional PATH directory. And I've also copied LAME and mencoder to my system32 dirs, yet I'm still having the same problems. Immediately after setting the additional PATH director, I managed to record one video with utterly broken sound (you could vaguely hear what it was supposed to sound like in the background but mostly you heard very loud static/white noise whenever a sound played).

Not sure what's happening/what I'm doing wrong but think I'll give it a rest for a little while and see if I can start again with it all.

EDIT AGAIN:

I'm an idiot... Mostly not realising that oyu need to record the zmv and then run the dump....

Sorry for wasting time..
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

So it works good now?
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Aekeron
Rookie
Posts: 14
Joined: Tue Mar 07, 2006 12:12 pm

Post by Aekeron »

There's a few minor problems but I suspect those are to do with my settings.

I've managed to output an avi that plays well, looks alright (given the res I've used) and the sound works on. Only problems are:

If I select "compress audio", it'll turn most of the sounds into the static that I mentioned earlier. Not selecting this sorts it (and doesn't effect final file size if I remember what you said earlier correctly?).

The other problem is simply zsnes 'going out of sync' with what I asked it to do. I've not got any sort of frameskipping activated (or fastforward/slowdown) but the recorded demo seems to get my controls mixed up. You can see in the video attached below if you like. Once again, I suspect this problem is simply some setting I've overlooked.

http://web.ukonline.co.uk/elandras/davp ... merged.rar

EDIT:

On the other hand, the movie I just recorded in mariokart works flawlessly without any settings change. Odd. Perhaps just a tetris4 problem.

All in all, it seems to work very well now. Thank you for your help and I hope my random posts haven't been too much of a waste of time :)
kieran_
Mugwump
Posts: 824
Joined: Fri Jul 30, 2004 9:05 pm

Post by kieran_ »

I tried it out,and it wokedperfectly.I just threw a mencoder binary into my ZSNES-MOV directory and all was well. Initially, The frame rateof the video was horrible, but onceI turnedoff frame skipping,all was well.
Thanks again Nach. This is a fantastic feature. I never really used ZMV's before, but I will from now on.
Anyway, here are the two tests that I did.
I waslooking in my Chrono Trigger solid state archive and noticedt hat there was a "Terra is your Mom" hack.
http://s57.yousendit.com/d.aspx?id=3MNX ... I41OO4XYLF

The second is just a simple boring battle..

http://s55.yousendit.com/d.aspx?id=2822 ... RC2EZQ63VJ

By the way, these movies compress much better with Winrar than with 7Zip. I've never seen that happen before. Can anyone giveme a simple explanation? Or is this a common occurence?
KingHanco
Hazed
Posts: 79
Joined: Sun Feb 26, 2006 8:08 am

...

Post by KingHanco »

http://d.turboupload.com/d/411959/Secre ... I.zip.html

Ok. I tested this video on WinAmp and it works.

Note: "Audio in video" can't have the sounds without the "Audio" enabled. You have to enabled the "Audio" with the "Audio in video" to get the sounds.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

herzog wrote: By the way, these movies compress much better with Winrar than with 7Zip. I've never seen that happen before. Can anyone giveme a simple explanation? Or is this a common occurence?
RAR has special multimedia filters for compression, generally RAR will compress an AVI or WAV better than anything else.


Anyways, I looked into the LAME problem in Windows. Turns out LAME does something which doesn't work properly in Windows and we just happen to use that feature.

It's amazing how every little thing I've been working on to adding movie dumping to ZSNES turns up bugs and bugs in everything else. I already found ~5 bugs in mencoder, and now I find one in LAME :evil:

After a good hour of debugging, I found the problem.
In LAME's get_audio.c fskip() function, fseek() has to be wrapped like so:

Code: Select all

    if ((fileno(fp) != STDIN_FILENO) && (fileno(fp) != STDOUT_FILENO))
    {
        if (0 == fseek(fp, offset, whence))
            return 0;
    }
For those of you who can't compile yourself, download a binary here:
http://nsrt.edgeemu.com/lame.zip

Also, I was checking out the path situation. You can instead of putting the directory that contains mencoder and lame into the PATH, you can place mencoder and lame into ZSNES' working directory.
Last edited by Nach on Fri Mar 24, 2006 10:43 am, edited 1 time in total.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

What in the world are you talking about?
fopen() what exactly? If you mean the executable, tell me of an fopen() which works with PATH.

I need a popen() which returns 0 if it couldn't launch, I wrote one for *nix, now I need one for Windows.
You seriously didn't follow what I was saying at all? Geez, I'm not that vague.

fopen() the executable. Read in the path variable and split it by semicolons, fopen() each possibility and return true on a match. You can wrap that right inside your custom popen(). I know you don't want to write another, but this shouldn't be that hard. Let me try a good untested start:

Code: Select all

FILE *popen(const char *fn) {
char *path = getenv("PATH");
  if(!path)return 0;
string part, full_fn;
FILE *fp;
  split(part, ";", path); //replace this with your tokenize STL stuff or whatever
  for(int i = 0; i < count(part); i++) {
    sprintf(full_fn, "%s\\%s", strptr(part[i]), fn);
    fp = fopen(strptr(full_fn), "rb");
    if(fp) { fclose(fp); return _popen(fn); }
  }
  path = _getcwd();
  sprintf(full_fn, "%s\\%s", strptr(part[i]), fn);
  fp = fopen(strptr(full_fn), "rb");
  if(fp) { fclose(fp); return _popen(fn); }
  return 0;
}
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Your code only makes sense with strings. ZSNES only uses C in the main code.

And if I was going to be writing so much custom stuff, why not write a new popen()? Since that wouldn't have the time of check time of use race condition.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

I suppose. Wasn't aware c++ was out of the question in ZSNES. You could get around strings with a quick for loop that replaced semicolons with \0 while keeping a count. Seek to the next pointer as path=strlen(path)+1. Replace str* functions with strn* functions. But your decision.

That'd be pretty neat to find another way to hook stdin/stdout other than popen on Windows. Too bad the API is half-assed and doesn't support error handling properly, lest popen would be a really useful function. I'd probably use it myself for wav->mp3 encoding via LAME. Hell, video encoding wouldn't even be that hard, really. Definitely a good idea you have there to use external apps. I was actually going to do that for ZIP support, but you came up with a much better solution for me first.
Locked