Log in

View Full Version : Using ffvfw to create AviSynth AVI files


Pages : [1] 2

sh0dan
31st March 2003, 18:13
Apparently milan has been doing his wizardry again, and this time he has come up with an experimental AVI wrapper for AviSynth.

It is included in his "ffvfw" codec, and enables YV12 data to be passed to any application accepting AVI files.

I found some links to binaries:

[Removed - see below]

Milan says it is at an experimental stage so far, but so far it has worked fine for me.
You create a script - open the "makeAVIS" utility that is a part of ffvfw - open the script here and save the new AVI file. Now you should be able to open this AVI anywhere.

So far I have only tested YV12 colorspace, which milan suggests you to use. You might also have to force ffvfw to use RGB32 or RGB24 for programs like AfterEffects, etc. Open the codec configuration, select this in the "Decoding" tab.
Edit: It does however seem to be hard to get other than YV12 output working.


A thread in the XviD forum (http://forum.doom9.org/showthread.php?s=&threadid=42710) discussing ffvfw (although no AviSynth specific stuff).

DDogg
31st March 2003, 21:08
Sh0dan, thanks for mentioning this. I did a few preliminary tests with Vegas and unfortunately it has problems. With force input colorspace unchecked in the decoder tab it will load but Vegas doesn't grok YV12 so video is whacked. WIth RGB24 forced, it refuses to load at all, which surprised me.

Of all things, Windows Movie Maker 2 will load these fake files just fine. I don't have AfterEffects installed at the moment so I could not check there. Anybody got Premier installed and can check?

sh0dan
31st March 2003, 21:23
I can't make After Effects work - it still got closer than anytime before - I'll see if I can fix it.

DDogg
31st March 2003, 21:39
VFAPI will serve to AfterEffects so maybe a comparison of the outputs might provide some useful info? I put some current links in the NLE forum that might save you some time if you want to try and don't already have it set up.

sh0dan
31st March 2003, 21:48
Seems like AfterEffects will only properly decode RGB data, even though it claims to be able to open it. ffvfw still outputs YUV data - so I guess it doesn't force the output colorspace.

Probably quickly fixed by milan. :)

DDogg
31st March 2003, 21:56
Sh0dan, well that is why I am a bit confused. I used avisource ("fake.avi").info to open the fake.avi. Showed rgb24 when I checked force input color as RGB24 and showed YV12 when I unchecked it. So, the force input color space IS doing something, don't you think?
--------------------------------
@Milan, again thanks for this work!
When I loaded the fake.avi into CCE 2.5 it complained it could not find a handler for AVIS. Just goofing around I added vidc.avis=ffvfw.dll in registry. CCE then encoded although output was half duck doody green and sort of looked like the video in Vegas when it tried to open the fake.avi in YV12. Perhaps this is useless info, but we see this a lot with CCE and new codecs/handlers. For instance with avisynth 2.5, CCE complained about not being able to find a handler for YV12. Although it turned out to be better to use a ConvertToYUV2 statement in the script, setting vidc.YV12=Divx.dll allowed CCE to encode a Avisynth 2.50 script outputting YV12. Anyway, just some CCE background for you as I do not know if you use it or not.

milan
1st April 2003, 12:46
Thank you for testing makeAVIS.

I'm just downloading Adobe After Effects tryout and hopefully I'll able to make ffvfw compatible with it soon. I'll look for some Vegas demo version too.

@DDogg
I might modify ffvfw installer to add vidc.avis=ffvfw.dll to registry. AVIS would be fine, because AFAIK no other software uses this FOURCC (please correct me if I'm wrong, it's still time to change it).

I'll check the forcing of output colorspace too.

BTW there are still crashes when closing some players if ffvfw was used for decoding. I'm investigating this.

DDogg
1st April 2003, 18:12
milan, some folks (like me) would only use the filter for frameserving. Would it be possible for MAKEAVIS to allow the choice of initial colorspace? In effect, could it automatically do the reg change equivalent of config>decoding tab>force input color space>colorspace choice, and if possible, reflect the registry setting active when it is opened and in use? This would allow the frameserving tool to be more transparent to people not needing the full power of the filter. I hope you might consider this.

milan
2nd April 2003, 06:46
I think it's a good idea. It would require a change in fake AVIs header structure, but this shouldn't be a problem. I'll do this today. Perhaps I should try to work with link2 more to see which of its features would be useful in ffvfw too (except for sound support).

sh0dan
2nd April 2003, 09:44
Actually it should be "easy" to copy audio uncompressed into the AVI file.

milan
2nd April 2003, 09:49
It may look strange, but I've never developed any application which would work with ACM in Windows, only the video. Maybe it's not difficult, but I'd have to start to learn it from the beginning.

Wilbert
9th April 2003, 11:24
Sh0dan, thanks for mentioning this. I did a few preliminary tests with Vegas and unfortunately it has problems. With force input colorspace unchecked in the decoder tab it will load but Vegas doesn't grok YV12 so video is whacked. WIth RGB24 forced, it refuses to load at all, which surprised me.

Of all things, Windows Movie Maker 2 will load these fake files just fine. I don't have AfterEffects installed at the moment so I could not check there. Anybody got Premier installed and can check?
I tried with Premiere 6.0. I used both YV12 and RGB32, but the image was screwed up in both cases. The upper part was black, and the lower part contained the clip (for YV12 the clip was also doubled, for RGB32 is saw it +/- eight folded) in purple/green.

Now I don't know whether Premiere requires RGB24 or RGB32, but I haven't tried RGB24 yet. I also noted there are two options in makeavis (forgot the names), what's the difference?

DDogg
9th April 2003, 15:25
As an update, I did some testing for Milan on a private build he did. That build worked in most of the colorspaces but was having trouble with YUV2. He said he is very busy at work doing a project for his company, but replied:
I had problems with YUY2 output too. I don't know yet what's causing this. For debug purposes I'll implement some way how to get info about _real_ output colorspace. When I'll have more spare time, I'll look at it. In addition to this, I'd like to use AviSynth colorspace instead on current XviD ones for more conversions in ffvfw and then finally release ffvfw on SourceForge (I know I promised this week ago :( ).

Wilbert
10th April 2003, 14:35
Thx, I will test it this weekend. Btw, your private mailbox is full.

DDogg
10th April 2003, 14:43
Thanks, cleaned up now.

sh0dan
10th April 2003, 17:26
After battling ffvfw for almost an hour before getting it to compile, I can say the results are very promising. I got AviSynth video directly into After Effects, so I guess most other apps will also work now.

I'll ask in the XviD forum for a compile for you all to test.

DDogg
10th April 2003, 19:25
Did you use the source from his test build (or newer) or the one from above? I ask because the newer has the force colorspace built in to MakeAvi.

sh0dan
10th April 2003, 19:38
A newer version from CVS - it allows to force output colorspace. Seems like A.E. will only read RGB24.

DDogg
10th April 2003, 20:18
Try it with no forcing checked. This loads fine into Vegas. That surprised me. Only other that worked was RGB24.

milan
23rd April 2003, 08:17
During last weekend I was experimenting with sound support in ffvfw. Now makeAVIS can store the audio stream in the "fake" AVI. This stream contains only sample numbers and ffvfw acts as ACM decoder and provides the actual audio data to the application. I've tested two clips with simple Avisynth scripts and they worked. Even when I extracted the audio stream to a separate wav file I was able to load it into the Cool Edit Pro 2.1.

Few questions to anyone who knows the ACM:
1. For format tag I've chosen the 0x3313 value. It's not used in MMReg.h file I've got. Is there some more up-to-date database of format tags?
2. ACMDRIVERDETAILS structure contains fields wMid and wPid. Now both are set to zero. Do I really have to obtain IDs from Microsoft before distributing the codec?

Thanks for help.

And as usual this is just experimental. This time _very_ experimental: not all ACM messages are handled nor all message flags.

satishkumr
23rd April 2003, 15:43
1) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/mpr_ids_37n7.asp

2) MS says so, but i have started distributing my Frameserver and havent obtained an ID. I've seen a couple of other acm codecs do the same.

- Satish

unixfs
26th April 2003, 11:58
Hi,
I tried to make an avi of this avs:

#film.avs
avisource("film.avi")

the original avi could play both video and sound (mp3 at 128/48 KHZ) both in zoomplayer and virtualdub,

but the fake avi created didn't have any sound (with any program).

Lame ACM should be enough for playback, right?


Another question: if ffvfw can encode MPEG1 and 2 and store them in AVI files, can I hope to have it decode these mpeg-in-avi files?

Thanks very much.

sh0dan
26th April 2003, 12:06
Sound support is only available in new versions - I don't know if there has been made any binaries with this. I had problems compiling a newer version, but hopefully someone can direct you to a new version.

LigH
26th April 2003, 17:06
Nitrogen's mirror seems to be dead, but the greek Pathfinder is still alive:

http://homepages.pathfinder.gr/ffvfw

milan
28th April 2003, 13:47
@unixfs
As sh0dan wrote, it's quite new feature and was added just a week ago.

@sh0dan
Which problems are you experiencing when compiling ffvfw? For ACM support I had to install Windows 2000 DDK, but I thought everything needed is in ffvfw CVS now.

@all
you can try http://ffdshow.sourceforge.net/ffvfw-20030425.exe

sh0dan
28th April 2003, 14:04
@milan: It was some precompiler header stuff in some ogm module - anyway, it's fixed now in the new cvs checkout I did. I directed the link at my page to your new version.

If it was possible for me to enable Raw (YV12 included) decoding, while installing ffwfw, I would be very interested in including it with AviSynth 2.5 - both as default decoder and because of the AVIS functions. How does that sound to you?

milan
28th April 2003, 14:18
That was my fault: I set new C files to not use precompiled headers and forgot to save the project. Then during debugging Visual Studio crashed and the changes were lost. I noticed this later after first commit to CVS.

Of course I can add this switch to ffvfw installer, but what about new installer without encoding libraries, just lightweight ffvfw for AVIS serving and colorspace conversions?


BTW about that ogm stuff: now ffvfw can store video to a separate OGM stream. I implemented this for few reasons:

1. every VFW application can now store OGM video streams which can be processed later in VirtualDubMod

2. you can disable the storing of encoded frames in AVI and create >4GB videos in VFW applications (AFAIK OGM can handle >4GB files)

3. I thought that it will be possible to open the OGM stream during encoding and watch the progress, but as it seems DirectShow file source filter can't open the file while it is opened for writing by other process.

sh0dan
28th April 2003, 14:34
A "light" version would simply be fantastic - guess it could do fine without much of the encoding. It would be nice if a decoder could be added without having to add ~700k to the installer.

What I'd like to have:

* A filter that decodes AVIS, YV12 and YUY2 when installed.

Wow - that's it. I wouldn't mind encoding options, as long as they don't take up too much space in the installer.

Point 2) of the OGM functionality makes it simply brilliant - you seem to get all the right ideas! :)

DDogg
28th April 2003, 16:16
Thanks to both of you for the new builds.

Re the "light" version. The MakeAvis utility for frameserving is the only thing I use. I don't do mpeg4 so I am not sure I even understand what the other stuff does, but thought it was mandatory in order to use MakeAvis. It would be great if a frameserver only version could be done. I think this is what you are speaking of?

DDogg
28th April 2003, 20:51
Sorry for the back to back post.

Any chance of allowing an external audio file (wav only?) to be selected and served with the video?

Also, Milan, unless you are superman, yeah I know you are :), I think sooner or later you may run into a situation where users might need the ability to wrap uncompressed audio to the signpost. On Satish's NLE outbound frameserver, he ran into some apps that just had ugly manners and wrapping the audio was the only way out. I know it offended his sense of purity given all the work on the acm section, but it ended up adding a lot of compatibility to those poorly mannered apps. Just a few thought for your consideration.

As always, your work is highly appreciated and please do let me know if I can help in any way. Testing, gofer, and grunt research is all I am good for. :)

sh0dan
28th April 2003, 20:53
@DDogg: Can't you use WavSource/AudioDub?

DDogg
28th April 2003, 21:00
Absolutely can do, but then the wrapping issue came up in my head. I thought it would make more logical sense to put the first last as one thought then would/could flow to the other. Hehe, well hopefully that makes sense. You of all people know when I start thinking I get dangerous :)

sh0dan
28th April 2003, 21:32
:)

The new version should wrap up audio nicely, though I haven't tested personally.

On the ffvfw issue, I think the best would be to keep it as close to ffvfw as possible, without excessive features. That way we would be able to upgrade ffvfw when milan has done some improvements, without having to change the code. If we were just able to grab ffvfw.dll and set the proper reg-keys, I'm more than happy.

DDogg
28th April 2003, 22:24
Correction, I had just assumed this would work:
V=mpeg2source("D:\Chamber2\chamber.d2v",idct=2)
A=wavsource("untitled.wav")
audiodub(V,A)
# plays fine in WMP with synced audio
MakeAvis takes it the first time and says it is created with no errors. However, WMP, MPC, etc. will not play the signpost. Then, when MakeAvis is run again, an error is thrown:

Avisynth error
AVIFileSource: couldn't open file (ffvfw_avisynth_script, line 2)

Seems it does not like the wavsource line

-------------------

Oh, and by wrapping, I meant an optional alternate mode that actually writes uncompressed PCM to the signpost file and does not use the ACM.

RE: "On the ffvfw issue.." Whatever you guys think best, I was just throwing out a hairball about the "MakeAvis only" version because I don't use the other functions of ffVFW and was worried they might potentially effect my DV stuff. I am sure that is just me being paranoid and all is ok.

Si
28th April 2003, 22:30
[DELETED]

sh0dan
29th April 2003, 08:08
In my experience you have to use absolute paths, when using makeavis.

milan
29th April 2003, 12:28
The biggest file in ffvfw package is libavcodec_enc.dll - 1.3 MB. For AVIS to work you need only ffvfw.dll (nearly 300KB) and libswscale.dll (200KB). I'll prepare a NSIS script which would create installation package containing only these two files and maybe some docs.

makeAVIS and ffvfw are capable of processing different avisynth scripts for video and audio, however GUI doesn't support it and personally I didn't tested this scenario. If it would be useful I can try to implement this.

AFAIK link2 has the possibility to store raw audio to wrapper AVI too. The reason why it isn't in ffvfw yet is simple: I wanted to learn how to use ACM (both for coding and decoding) and the best way for me was to implement ACM codec functionality to ffvfw.
BTW the same was for VFW: I've created my first simple application to use VFW codecs just few weeks ago, long after the work on ffvfw began. And, unbelievably, I still haven't developed any, even the simplest, player application which would use DirectShow.

I'll check the relative/absolute paths issue. If avisynth handles it than ffvfw should handle it too.

sh0dan
29th April 2003, 14:59
All I really need is to know which files to include (seems to be ffvfw.dll and libswscale.dll), and which regentries/ini settings to change/set, but an NSIS script would also help.

I'll make ffvfw optional, with default being disabled. I'll see if I can make a separate uninstaller.

DDogg
29th April 2003, 15:04
Yes, it was the lack of the absolute path causing the error. Doh on me. But that raises a couple of other issues to report:

1> Audio will not play from signpost.avi in WMP using the above example with the path corrected in wavsource. No errors, video plays ok - just no sound. Video and audio and Force rgb24 checked. Force interlacing unchecked. (AMD TBird 1.4/XP SP1) AVS plays fine in WMP and MakeAvis seems to be showing the correct information under the audio check-box regarding the audio source. (48000/2/16)

2> When "store script in avi" is checked. WMP throws an "unknown error". BTW, what ARE these two check-boxes for? ("Store script filename in avi" and "Store script in AVI"). I don't understand how these are used or the purpose.

BTW, I had a thought, Milan I know you have Vegas installed and Sh0dan I think you have Premiere. Just in case it might be good for you guys to install Satish's frameserver to make sure their is no potential conflict between the two ACM services. The uninstall does a clean job so no worries there. Here is the link: http://www.debugmode.com/pluginpac/frameserver.php

milan
30th April 2003, 13:35
@sh0dan
I've modified ffvfw.nsis2 script to create ffvfwAVIS.exe installer containing ffvfw.dll and libswscale.dll only and creating necessary registry items and shortcuts. However if you'd like to include stripped-down ffvfw in AviSynth distribution the better solution would be a separate script.

@DDogg
I think the solution for your first report is simple: the instalation of ffvfw-20030425 is not registering ffvfw.dll as an ACM codec. I forgot to add this to the installer script. On W2K/XP you can to registry to the "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers32" key new string value msacm.avis=ffvfw.dll

"Store script in AVI" puts the whole script to AVI file instead of just script file name. I don't know if this is any useful, it was just a idea. It's quite possible that it is currently broken, I'm not testing it as much as the "Store script file name".

Edit: there were bugs both in video and audio when AviSynth script was stored in AVI (or WAV). Should be fixed now.

DDogg
30th April 2003, 14:03
Milan, thanks. The registry addition cured the problem. I still don't see what storing the script in the avi accomplishes. NOt saying it is not good, just don't see how it would be used.

sh0dan
30th April 2003, 16:15
@milan: Thanks a bunch!

There is now a new CVS binary up, which includes the light installer (along with a bunch of other changes).

DDogg
30th April 2003, 17:00
Very nice install, thanks!
But,
Problem report:
1> Used MakeAvis once and checked playback in WMP. All ok including audio.
2> ran configuration for ffvfw. Looked around but did not change anything. Closed it.
3> Opened MakeAvis and attempted to "remake" signpost using same source and destination. MakeAvis Poof and vanish. No error message. Repeated attempts yield same. Logged off and logged on. Same behavior. Changed name of destination. Same. Copied and renamed "MakeAvis_test.avs" to "MakeAvis_Test2.avs". Attempted to open it as source in MakeAvis. Not successful. Vanish on ok in file requester.
4> ANy attempt to open any AVS in makeavis now fails.
5> Worse than I thought. A full reboot does not cure it.
6> Un-installed ffVFW and reinstalled using the new build of avisynth. First open of an avs script was successful. Subsequent tries yield: "The instruction at "0x1000aef5" referenced memory at "0x000f0005". The memory could not be "read". Clicking ok then causes MakeAvis to vanish. Reopen and load avs ok. Then reopen again gives same error above.

sh0dan
30th April 2003, 18:05
So both the latest ffvfw and avisynth fails??

DDogg
30th April 2003, 19:25
Avisynth is fine. No problems seen yet. Problems only with ffvfw.

Ah, let's make this more simple with a replicatable:

1> Run MakeAvis
2> load an avs file and do nothing
3> reload the same avs file
4> Result should be crash if this is not machine specific.

Ah, seems to have something to do with the output file directory. Doing above with output left as c:\1.avi allows multiple open of different source, but if it is changed to dir same as source any subsequent attempt to open different source fails with crash above.

DDogg
1st May 2003, 14:25
Sh0dan, were you able to replicate? If not I need to figure why machine specific.

sh0dan
1st May 2003, 14:42
No - neither of my two machines available have shown this.

DDogg
2nd May 2003, 06:34
It seems I had a bad DX filter and/or I was also having problems with a HD that my paging file was on. Just one of those VooDoo things, but it was severally compounded by the absolute path problem with both audio AND, much later I found, video also. So user beware. You must include a drive letter and path on all statements that reference audio or video. The avs will play but the MakeAvis signpost.avi will exhibit all kinds of strange things that will make you curse in the night.

Suggestion: add flip vertical to makeAvis gui as many times one would like to use the same script in several different color formats. The vid is normally flipped when a force is not used. Editing the script is an option but I think makeavis should offer it so one script can be used without modifications.

PS: Running the new hypercube transcoder will show up any bad DX filters by crashing on launch and leaving a txt file behind in its install directory that points to the bad filter. Use DXMan to remove problem filter. http://www.analogx.com/contents/download/audio/dxman.htm

Guest
25th September 2003, 18:44
I can't get the latest ffvfw lite from sh0dan's download page to work. The fake AVI plays in MediaPlayer but crashes on exit. When I open it with VirtualDub it errors and refuses to play:

VideoSourceAVI error: An unknown error occurred (may be corrupt data).(error code -100)

Does anybody know what is wrong? Thank you.

sh0dan
27th September 2003, 10:22
It might be path related. When using ffvfw you must use absolute paths. milan talked about fixing it, but I cannot remember if he ever got around to doing so.