(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:

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

Post by Nach »

Welcome to page 1.

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.

________
Note, the top of every page in this thread has this same message, it's what's needed to convert a ZMV to an AVI. We do not plan on changing these basic rules for ZMV to AVI conversion.
The rest of the posts here describe the evolution of the feature. This method wasn't developed till page 5 or so, so posts prior to that deal with the old method, which still works if you set it up properly.

If you have a question, please post about it in this thread, and in the end. But please make sure you've read this message, and skimmed pages 4 to 7 a bit to get an idea how it works.
________

Check it out: http://nsrt.edgeemu.com/mariovid.zip
Requires XviD.

Image

Of course props to ipher, DeHackEd, zsKnight, and pagefault for helping me.

I dumped the raw vid then converted to XviD as follows:

Code: Select all

mencoder -nosound -rawvideo on:format=0x42475220:w=256:h=223:size=228352:fps=60 -ovc xvid -xvidencopts fixed_quant=9:aspect=4/3 -o mario.avi /home/nach/.zsnes/test.bin
Last edited by Nach on Sat Mar 29, 2008 7:47 pm, edited 4 times in total.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
AntoineWG
Trooper
Posts: 530
Joined: Thu Jul 29, 2004 6:59 pm
Location: 127.0.0.1
Contact:

Post by AntoineWG »

Raw video? That's gonna take up a lot of disk space.

Do you have to have a fast machine to do it in realtime so it doesn't drop frames or will it write a constant 50/60 fps and slow down the game?
[i]"It is better to have tried and failed than to have failed to try, but the result's the same." - Mike Dennison[/i]
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

The game slows down while outputting, but it writes every frame.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
AspiringSquire
Born to Rule... Impatiently
Posts: 265
Joined: Wed Nov 17, 2004 8:21 pm
Location: Everywhere I want to be.
Contact:

Post by AspiringSquire »

Just when you think ZSNES couldn't be any cooler... something like this is thrown at us. This rocks so much, I can't even begin to ramble on about how great it is. :D


I'm sure it will not be easy to get used to making the videos, but I hope to catch on eventually. ;)
[url=http://board.zsnes.com/phpBB2/viewtopic.php?t=3298][color=brown]My [u]NES palette[/u][/color][/url] - better colors with any emulator.

"the more you know, and the more you can do... the more you are."
- [url=http://www.danielbohman.com][color=brown][u]daniel bohman[/u][/color][/url]
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

Cool. Any plans to make it spit out raw data in a nice AVI/OGM/MKV container to ease transcoding?

Does the dump raw option just record whatever you're doing, or is it tied to ZMV? I mean, does it just record whatever's on the screen, or does it start playing the specified movie, then start recording?
[u][url=http://bash.org/?577451]#577451[/url][/u]
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Noxious Ninja wrote:Any plans to make it spit out raw data in a nice AVI/OGM/MKV container to ease transcoding?
No. VirtualDub and mencoder exist for a reason, we're not writing a media encoder here.

Using mkfifo, you can have ZSNES output the video stream directly into mencoder thus encoding without having a massive raw file in between.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

Oh, I didn't know VirtualDub could open raw data.
[u][url=http://bash.org/?577451]#577451[/url][/u]
Cecil
Paladin
Posts: 75
Joined: Fri Jul 30, 2004 2:25 am

Re: ZMV to AVI conversion!!! (finally, sort of)

Post by Cecil »

Nach wrote:Of course props to ipher, DeHackEd, zsKnight, and pagefault for helping me.
zsKnight???!!! :shock: I thought he left.
System Specs:

2.2GHz Athlon64 X2 4400+, 2GB DDR 400 SDRAM
EVGA Geforce 7600GT 256MB
Realtek AC '97
Microsoft Windows Vista Home Premium
Kagerato
Lurker
Posts: 153
Joined: Mon Aug 09, 2004 1:40 am
Contact:

Re: ZMV to AVI conversion!!! (finally, sort of)

Post by Kagerato »

Cecil wrote:zsKnight???!!! :shock: I thought he left.
He's long gone, but much of his code remains.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Re: ZMV to AVI conversion!!! (finally, sort of)

Post by Nach »

Cecil wrote:
Nach wrote:Of course props to ipher, DeHackEd, zsKnight, and pagefault for helping me.
zsKnight???!!! :shock: I thought he left.
I used his color space conversion techniques for getting an image that can be converted to MPEG4.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

How exactly does this work? I checked out CVS (from right before your latest change, since that seems to have broken things for now), but the Dump Raw Movie button doesn't seem to do anything. Is it currently a dummy in public code, or do I just not understand it?
[u][url=http://bash.org/?577451]#577451[/url][/u]
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

The button is currently a dummy. If you want to dump a video right now, you'll have to tie the raw_video*() functions in zmovie.c into something.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
snkcube
Hero of Time
Posts: 2646
Joined: Fri Jul 30, 2004 2:49 am
Location: In front of the monitor
Contact:

Post by snkcube »

Wow, this is awesome news. Imagine the possibilities...
Try out CCleaner and other free software at Piriform
Image
daft
Rookie
Posts: 27
Joined: Mon Nov 22, 2004 12:56 am

Post by daft »

Sweet! Thanks for the update Nach.
Phil
Rookie
Posts: 21
Joined: Thu Aug 26, 2004 3:24 am

Post by Phil »

Personally, I prefer this idea than using MNG. Though, adding both this and MNG can be a good idea for those that only want animation without sounds.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

On an unrelated note. For people wanting to rip sprites I will be adding a command-line option to choose the default background colour (other than black) when you disable layers so you can easily set up transparencies. I know some of you have been wanting this for some time.
AspiringSquire
Born to Rule... Impatiently
Posts: 265
Joined: Wed Nov 17, 2004 8:21 pm
Location: Everywhere I want to be.
Contact:

Post by AspiringSquire »

Phil wrote:Personally, I prefer this idea than using MNG. Though, adding both this and MNG can be a good idea for those that only want animation without sounds.
Yeah, I can't wait for the onset of widespread popularity of the MNG format. From what I've read about it, MNG is superior to GIF in every way, so why don't people start using it? :?
[url=http://board.zsnes.com/phpBB2/viewtopic.php?t=3298][color=brown]My [u]NES palette[/u][/color][/url] - better colors with any emulator.

"the more you know, and the more you can do... the more you are."
- [url=http://www.danielbohman.com][color=brown][u]daniel bohman[/u][/color][/url]
Phil
Rookie
Posts: 21
Joined: Thu Aug 26, 2004 3:24 am

Post by Phil »

Good question.

Logically, I think it should.
Aerdan
Winter Knight
Posts: 467
Joined: Mon Aug 16, 2004 10:16 pm
Contact:

Post by Aerdan »

Very little software supports it.

Mozilla implemented MNG at one point, but later took it out for no logical reason that I can think of.
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

Aerdan wrote:Very little software supports it.

Mozilla implemented MNG at one point, but later took it out for no logical reason that I can think of.
They took it out because there was no maintainer. Now there is a maintainer, and I _THINK_ it was going to be back in 1.8 (and Firefox 1.1?) but I'm not sure.

Firefox will be getting SVG in either 1.1 or 1.2, which will be good.
[u][url=http://bash.org/?577451]#577451[/url][/u]
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Added command line stuff and finally tied in that button, it's super cool now :)

First I did

Code: Select all

mkfifo /home/nach/.zsnes/rawvideo.bin
And presto:

Code: Select all

./zsnesd -md -mc -zm 3 /mnt/D/roms/nintendo/snes/btoad_bm.smc & mencoder -nosound -rawvideo on:format=0x42475220:w=256:h=223:size=228352:fps=60 -ovc xvid -xvidencopts fixed_quant=10:aspect=4/3 -o btoad.avi /home/nach/.zsnes/rawvideo.bin
Encoded straight to a nice little XviD without some monstrosity of a raw video file in between :)

http://nsrt.edgeemu.com/btoad.zip
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

How does that work? Assuming mencoder isn't able to encode the video in real-time, does ZSNES slow down, or does it write to memory and eventually fill up your entire page file?

And does Windows have an equivalent to mkfifo?

EDIT: The GnuWin32 CoreUtils package has mkfifo. I'll give it a shot.
[u][url=http://bash.org/?577451]#577451[/url][/u]
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

ZSNES and mencoder are running at the same time.

mkfifo makes the file become shared memory, so as ZSNES outputs the raw, mencoder immediatly encodes it and outputs the AVI.
And the RAM isn't depleted, because as mencoder reads the memory, it disappears from memory.
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 »

BTW, what shell would you use to run both together? I know cygwin has what you need, but I wouldn't want to make anyone use that.

http://unxutils.sf.net I believe has ZSH which probably supports the & technique to run two programs together. If their coreutils also comes with mkfifo, I'd recommend using that instead.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Player1
Hazed
Posts: 74
Joined: Sun Oct 03, 2004 10:03 pm
Contact:

Post by Player1 »

what requirements does this feature needs that is usable?
Locked