Search code examples
videoffmpegavisynthvirtualdub

Stacking 3 gmp4-files using Avisynth and VirtualDub, results in wrong colors and distorted files


I need to conduct the seemingly simple task of stacking 3 files next to each other. They are all the same: .avi Container, 320x240, 4:3, 25 fps, GeoVision Advanced MPEG-4 GEO codec. I installed the GeoVision codec (http://www.geovision.com.tw/english/5_8.asp# - select "other utilities"), so my system (windows media player, media player classic) can play back the files. Also, I can open and work with them in Virtual Dub. I installed AviSynth and wrote the simple script for stacking them next to each other

h1 = AVISource("Event20150423075842001.avi")

h2 = AVISource("Event20150423075842002.avi")

h3 = AVISource("Event20150423075848003.avi")

StackHorizontal(h1, h2, h3)

now, when I save it as .avs and then open it using VirtualDub, I see three videos nicely put next to each other, but the colors are weird and parts of the video are upside down and everything is just ..wrong - see Screenshot http://www.linkfile.de/download-46f71057ed130f9be29510f68ce4ee71.php. First I thought it has something to do with avisynth taking the wrong codec, so i forced it on gmp4 (as you can also see in the screenshot), but the result is the same. I have now also Avisynth+ installed, as well as VirtualDubMod. When I open the .avs in VDMod, I get "couldn't locate decompressor for format YV24", but it still opens the video which looks a little better though (but when I make a direct stream copy and save it, then play it back in MPC it looks exactly the same as it looked on the first screenshot). So this error points me toward something related to the colorspace. Now my questions:

  • How can I find out in which format my files are? YUV24, YUV12, ..?
  • And then, how can I tell Avisynth to use a format that VirtualDubMod can deal with?
  • Or how can I make VirtualDub deal with YUV24? Am I just missing a codec? Is my train of thought even slightly on the right track, or is my problem something totally different?

I also found this related thread: Editing/Decoding AVI files using system-installed proprietary codecs, but using avisynth and ffmpeg, I get similar results as with VirtualDub.

I can't use the solution of converting all my files first and then do the stacking in a second step - because the actual files I have to work with are about 180 videos, each like 8hours long and the time it would consume would stand in no relation to my possibilities..

I really have looked for solutions during the past week, and I think I'm close, but I sadly just don't know enough about programming to be able to solve it on my own.. so I also want to excuse for any apparent stupidities in my explanation ;) I'm very thankfull for any help

Have a good time everybody

EDIT: So I have some more Info, and an example file, which I can't link in this post -.- because I -again- have not enough reputation, very nice. I will try to comment and post the links :)

Here is what the info() command brought me: Colorspace: YV24, FieldBased (Separated) Video: NO, Parity: Bottom Field First, Video Pitch: 320 bytes, Audio: NO, CPU detected: x87 MMX ISSE SSE4.1 SSSE3


Solution

  • I was able to reproduce your problem. Apparently the AviSource chooses a wrong pixel format by default, it should be "RGB24" instead of "YV24".

    To solve this you need to add the parameter pixel_type="RGB24" to every AviSource call, like this:

    AVISource("Event20150423075842001.avi", pixel_type="RGB24")
    

    Alternatively you can try to use DirectShowSource instead of AviSource, it worked properly for me right away.