ZMV to AVI conversion r1.1

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

Moderator: ZSNES Mods

grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

ZMV to AVI conversion r1.1

Post by grinvader »

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 old (locked) thread describes 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 of the old thread a bit to get an idea how it works.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Valerie Valens
New Member
Posts: 3
Joined: Tue Nov 18, 2008 2:28 am

Post by Valerie Valens »

Hello, I have a couple of questions regarding the record feature. First off, I would like to say that it is an awesome feature that will save me a lot of hassle. It worked perfectly. However, I want to do more than just record videos in 256:224 resolution.

I would like to know what edits I should make to the zvideo.cfg file if I were to say...desire a 596:448 video output letterboxed in a 640:480 area. This is my current zvideo.cfg file.

Code: Select all

md_raw_file="rawvideo.bin" ; Only for Raw Videos
md_pcm_audio="audio.wav" ; AVI dumping always dumps audio seperatly
md_compressed_audio="audio.mp3" ; For when selecting compressed
md_logo="" ;If you want a logo, specify a logo file. It should be a series of frames 256x224x24.

md_ntsc="59649/995"
md_pal="50/1"

md_file="video.avi"
md_prog="mencoder"
md_raw="-demuxer rawvideo -rawvideo format=0x42475218:w=256:h=224:size=172032:fps=$md_video_rate"
md_other="-aspect 4:3 -mc 0 -vf scale=640:480"
md_no_sound="-nosound"
md_sound="-oac mp3lame -lameopts aq=0:preset=64:mode=1 -audiofile $md_pcm_audio"
md_compressed_sound="-oac copy -audiofile $md_compressed_audio"
md_x264="-ovc x264 -x264encopts qp=0:frameref=15"
md_ffv1="-ovc lavc -lavcopts vcodec=ffv1:vstrict=-2:aspect=4/3"
md_xvid="-ovc xvid -xvidencopts fixed_quant=6"

;Valid variables to use in the next four lines are:
;$md_file, $md_prog, $md_raw, $md_other, $md_no_sound, $md_sound, $md_pcm_audio, $md_compressed_audio
;and $md_video_rate, $md_vcodec, $md_smode
;These variables are defined above.
;$md_video_rate is $md_ntsc or $md_pal depending on the game as needed
;$md_vcodec is $md_x264, $md_ffv1, or $md_xvid depending on the codec selected
;$md_smode is $md_no_sound, $md_sound, or $md_compressed_sound depending on the audio options selected

md_command="$md_prog $md_other $md_no_sound $md_raw -ofps 30 $md_vcodec -o $md_file -"
md_audio_compress="lame -m j --preset 64 -q 0 - $md_compressed_audio"
md_merge="$md_prog $md_other $md_smode -ovc copy -o merged.avi $md_file"
This creates a plain 640:480 video at 30 fps on Xvid at around 10 MB/minute when dumping a Seiken Densetsu 3 ZMV file. Is there a way to tweak this config file so that the file size is reduced further still while still maintaining most of the quality?
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

To get smaller file sizes, use x264, also try multipass encoding, and play around with the bitrate to get a good size/quality trade off.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Valerie Valens
New Member
Posts: 3
Joined: Tue Nov 18, 2008 2:28 am

Post by Valerie Valens »

I tried using x264, but the video ended up being garbled in a mess of colours and the file size is 40MB/minute. So I must be doing something wrong with that.

What do I need to edit in the CFG file in order to get multipass and custom bit rates working?
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

Valerie Valens wrote:I want to do more than just record videos in 256:224 resolution.

I would like to know what edits I should make to the zvideo.cfg file if I were to say...desire a 596:448 video output letterboxed in a 640:480 area.
I recommend VirtualDubMod, optionally with AviSynth and a good codec pack (e.g. k-Lite).
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Valerie Valens
New Member
Posts: 3
Joined: Tue Nov 18, 2008 2:28 am

Post by Valerie Valens »

That would be nice, but that would simply change the question of how to go about editing zmovie.cfg to how to use the aforementioned programs in this context. :lol:
Beibin
New Member
Posts: 4
Joined: Thu Nov 27, 2008 10:13 pm

Post by Beibin »

I am having problems with this feature.

When I try to dump the movie, it encodes the video just fine, but there is no audio. I tried dumping the audio separately, tried dumping uncompressed audio, but nothing worked.

I have the fixed version of LAME, MEncoder, and I am using ZSNES version 1.51.

Does anyone know what the problem is?
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

I'm not sure what to tell you, but you should make sure that sound is enabled (and playing back normally in ZSNES), and make sure all sound apps (such as Winamp) are closed so it doesn't interfere in the sound dumping.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Beibin
New Member
Posts: 4
Joined: Thu Nov 27, 2008 10:13 pm

Post by Beibin »

If I go back to ZSNES while it is encoding, there is no sound, even though it is enabled in the options. If I stop dumping the movie, the audio is restored.

I only have Winamp Agent running in the background right now. I will try closing it, then dumping the movie.

Edit:

Closing Winamp Agent had no effect at all.

I would also like to add that I have no problems playing back the ZMV movie itself.

Should I use a different encoder?
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

There's supposed to be no audio playing back in the audio dumping process. It is being redirected to LAME.

You most likely need to restarting ZSNES after closing Winamp.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Beibin
New Member
Posts: 4
Joined: Thu Nov 27, 2008 10:13 pm

Post by Beibin »

The video file still has no sound.

I dumped the first 50 seconds of the movie, then went back into ZSNES, and dumped 10 more seconds.

The merged AVI file I got had no sound for those 50 seconds, and the last 10 seconds had sound.

I tried going back into ZSNES as soon as I started dumping, but that gave me another soundless video file.

I wonder what is going on...
Dark Rubes
New Member
Posts: 6
Joined: Sun Dec 07, 2008 2:29 am
Location: Columbia, S.C.
Contact:

Post by Dark Rubes »

Beibin wrote:The video file still has no sound.

I dumped the first 50 seconds of the movie, then went back into ZSNES, and dumped 10 more seconds.

The merged AVI file I got had no sound for those 50 seconds, and the last 10 seconds had sound.

I tried going back into ZSNES as soon as I started dumping, but that gave me another soundless video file.

I wonder what is going on...
Have you tried turning off the "Pause when emulation in background"? I had the same problem you're having until I went back a few pages in the old thread and read that. Once I turned it off and dumped it again, I had sound in the finished product.

The developers: Great feature. It took a little bit to find some clear cut directions on what I needed to do exactly, but it was nothing a little reading didn't solve.

What I've noticed: When I encoded my first video in x264, it came out extremely bad and no sound. The graphics were unreadable and it looked like there was too high a contrast in it. I then got the proper codecs for Xvid and the movie turned out gorgeous. Then I had the above problem with no sound. That's fixed now.

The last problem that I had, I've found a workaround. I am using Sony Vegas Movie Studio to fix up my movies once I'm done. You know, like putting in a title card, trimming, etc. With the original video that was encoded with Xvid, I cannot bring it into Vegas. At. All. I solved this problem by going to Media Convert and using no video preset with convert to .avi (again). I now can bring it in and fix it up.

Just a tip: Sony products do not officially support the DivX or Xvid codecs. Just something I found out in my research. Other than that, the videos are gorgeous and synched up with no problems. I now can make quality vids for my site very easily.

Dark Rubes
Visit Gaming Insurrection for retro musings!
www.gaminginsurrection.com
Beibin
New Member
Posts: 4
Joined: Thu Nov 27, 2008 10:13 pm

Post by Beibin »

Dark Rubes wrote:Have you tried turning off the "Pause when emulation in background"? I had the same problem you're having until I went back a few pages in the old thread and read that. Once I turned it off and dumped it again, I had sound in the finished product.
I just tried that, and it works flawlessly now!

Thank you very much!
Dark Rubes
New Member
Posts: 6
Joined: Sun Dec 07, 2008 2:29 am
Location: Columbia, S.C.
Contact:

Post by Dark Rubes »

I just tried that, and it works flawlessly now!

Thank you very much!
You are quite welcome. :)

My video is up on YouTube now, if anyone cares.

http://www.youtube.com/watch?v=QHJwq3qQdOE

It's the first battle with Smithy in "Super Mario RPG."
Visit Gaming Insurrection for retro musings!
www.gaminginsurrection.com
brian073
New Member
Posts: 4
Joined: Wed Feb 04, 2009 7:41 pm
Contact:

Post by brian073 »

Thank you for this post! I've been wondering for a while if I could do this.
[b][url=http://www.media-match.com/jobsboard.php]Production Assistant Jobs[/url][/b] | "Video Games are bad for you? That's what they said about Rock 'N' Roll." Shigeru Miyamoto, Mario creator
g7therobot

Re: ZMV to AVI conversion r1.1

Post by g7therobot »

grinvader wrote: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 old (locked) thread describes 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 of the old thread a bit to get an idea how it works.

I am really having a hard time figuring ZMV files out and being able to record using mplayer for an AVI file conversion I have the ZSNESw but I don't know which way to start a ZMV file to make a small video
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Re: ZMV to AVI conversion r1.1

Post by Deathlike2 »

g7therobot wrote: I am really having a hard time figuring ZMV files out and being able to record using mplayer for an AVI file conversion I have the ZSNESw but I don't know which way to start a ZMV file to make a small video
First, record a ZMV (you need to load a game first to record of course). It doesn't have to be anything special initially. Then, make sure mencoder.exe and lame.exe (from the provided links) are in the same folder ZSNES is in. You should be able to dump the video via the dump tab in the movie tabs by hitting on the "Start" button (this also assumes you have the game loaded). These steps are simplified, but that's the jist of the whole thing.

BTW, please shrink your avatar a little bit.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Re: ZMV to AVI conversion r1.1

Post by grinvader »

Additional info...
Deathlike2 wrote:First, record a ZMV (you need to load a game first to record of course). It doesn't have to be anything special initially.
Make the ZMV of exactly what you want to have as a movie, obviously.
Then, make sure mencoder.exe and lame.exe (from the provided links) are in the same folder ZSNES is in.
Or in your PATH...
BTW, please shrink your avatar a little bit.
Width-wise, at least.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Berret
Rookie
Posts: 11
Joined: Sun May 03, 2009 7:27 pm

Movie Dump Butterfly Effect

Post by Berret »

Hey guys,

I'm fairly new to this process, but I am starting to get the hang of it. I am getting great audio and video quality with the xvid lossless and the settings I have. I'm pumping out a solid presentation resolution of 1280x800 which is perfect for a widescreen HD display.

Here is my very serious drawback:

I am trying to dump a very LONG video. It's a 1 hour and 48 minute 100% Speed Run of Super Metroid. The video, in total length, actually ends up being a little longer than that I believe, but within about 20 minutes I run into a probability-based issue. Occasionally, the emulator incorrectly moves the character and sets off a chain of events that has me either die or jump around aimlessly in the same area for over an hour (after having left the computer during its decoding process). I have tried to dump the long video three times, each time failing at a different spot. This is how I know it is an error in the instructions given by the emulator during the dumping process.

I know that, in hindsight, I probably should have just taken several segments of the video (such as twenty minutes each) and dumped each one, but unfortunately I can't go back now. The video is already recorded.

Is there a setting or string I can include in zmovie.cfg that will either increase the accuracy of the instructions given during the dumping (such as activating an aggressive mode, which I understand is bound to slow the process down) OR fix this problem altogether? Is it a known bug?

I understand that this and only other scenarios of videos involving entire games from start to finish TRULY apply to error, as the chance for an error during dumping that causes such a butterfly effect are small when considering a short 10 minute video, but it is a nuisance nonetheless. Does anyone have an answer to this?

Thank you for reading.

I'm using menc latest version, lame fix, and zsnes 1.51 on Vista SP1 with a Core 2 Duo.


-Berret
Berret
Rookie
Posts: 11
Joined: Sun May 03, 2009 7:27 pm

Post by Berret »

Sorry for the double post.

After further review of more bug reports on the forums, I've seen that it is a known bug here: http://board.zsnes.com/phpBB2/viewtopic.php?t=12205

Is this still the case or is there a present workaround? It is nearing half a year since the thread began...

Edit: I should have just edited my first post.... -.- It's been years since my forum days, I feel like such a noob. -.-
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

There is no perfect solution with current releases. A few guidelines can help somewhat, but the root cause still remains and only luck can make a long run not desync:
Don't skip any frames. Don't allow any frameskip, basically. Autoframeskip + max frameskip 0 (or manual frameskip 0) + use neither fast forward nor turbo.
Don't use rewind states. Kinda counterproductive, but I spotted a small decrease in desync frequency without them. "Don't use" as in, don't even make them. Set number to 0.
Don't use frame advance. Complete counterproductivity. Sorry. Currently the way it is handled keeps a fraction of the core running, which may affects random stuff from a couple seconds to minutes later.

I have made several 20-minute long stable movies without these, but some desyncs happen for 'desync-prone games'.

This is a major point on the list. We'll fix it eventually.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Some games are much less prone to desync as well.

I can't recall the last time I had a desync in Super Mario All Stars for example. But for other games, I find it frequent.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Berret
Rookie
Posts: 11
Joined: Sun May 03, 2009 7:27 pm

Post by Berret »

Thanks very much for the information, grinvader. (and Nach)

Is there some way to make the video in segments? Starting from one state or frame number to another, to avoid the errors in instruction?

I see the dumping options includes number of frames - is this a ranged value or just a 0 to x value? If it's ranged I could just do 0-2500; 2501-5000, etc, and patch it together in premier or something.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Making a video in segments means the input recording, not the conversion to AVI.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

There's also SNES9x.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Post Reply