Log in

View Full Version : Avisynth and x264


Mr_Odwin
7th April 2006, 15:44
I seem to have lost the ability to open avi files encoded with the x264 vfw codec using avisource and avisynth v2.5.6. Files open perfectly well with virtualdub (just using file>open file) but if I try to run a script it spits out a "Could not decompress frame 0" error. Directshowsource also works but I want avisource to work. I've enabled H.264 support in FFdshow, but to no avail.

Any ideas?

shon3i
7th April 2006, 16:44
Maybe avisource(simple.avi, fourcc="H264")

t1dUs
7th April 2006, 16:45
DirectShowSource("pathtoclip"), there is no other way to open files encoded with h.264 video.
Maybe in avisynth's version 3 it will be possible.

Mr_Odwin
8th April 2006, 07:15
DirectShowSource("pathtoclip"), there is no other way to open files encoded with h.264 video.
Maybe in avisynth's version 3 it will be possible.

Hmmm. How come?

Lil' Jer
8th April 2006, 11:21
Hmmm. How come?

I'm guessing it's due to its reliance on vfw to open the files.

DigitalDeviant
8th April 2006, 14:14
Here is a blind stab. Ffdshow has seperate vfw decoder settings located on the decoder tab in the encoder settings (vfw codec configuration.) You might need to enable those to use avisource.

squid_80
9th April 2006, 12:04
If you can open the .avi file with virtualdub, you should be able to open it via avisynth; they use very similar code.
Is it just one particular file that is giving trouble or all h264 avi files?

GodofaGap
9th April 2006, 12:17
If I had to make a guess (and I will :p ), it would be that the drop frames inserted at the beginning of the AVI file by VirtualDub are causing havoc. Obviously, you can't decode 0 byte frames and I don't know if Avisynth knows what to do when it encounters such a frame at the beginning of a file. (Perhaps it should return a black frame, skip the frame or...)

Lil' Jer
9th April 2006, 16:10
If I had to make a guess (and I will :p ), it would be that the drop frames inserted at the beginning of the AVI file by VirtualDub are causing havoc. Obviously, you can't decode 0 byte frames and I don't know if Avisynth knows what to do when it encounters such a frame at the beginning of a file. (Perhaps it should return a black frame, skip the frame or...)

That's not it. To open with Avisource you need a vfw decoder for that file. Outside of ffdshow there is no vfw decoder for h.264. What they need to do is enable the h.264 decoding in ffdshow's vfw configuration.

GodofaGap
9th April 2006, 16:30
He can open the file in VirtualDub, so the VFW decoder is working. Besides, AVS would throw a different error then --> "couldn't locate decompressor for fourcc h264".

My guess was right, it are indeed the drop frames that cause the behaviour.

@Mr_Odwin: Open the AVI file in VirtualDub, and remove the drop frames (just press DEL). They are at beginning of the file and are labeled with [D] in the time indicator box. Then resave the AVI with direct stream copy. Drop frames are caused by using b-frames (the amount of drop frames is equal to maximum consecutive b-frame setting).

Mr_Odwin
9th April 2006, 19:18
Ace! That did the trick. I only have two files encoded with x264 and it was doing it with both of them, but now all is well.
Is this somehow my fault that there are b-frames at the start of the file, or is that okay? In both cases there were two and they were just blank/black.

GodofaGap
9th April 2006, 20:13
It is not your fault and it aren't b-frames at the beginning of the file but empty chunks. Encoding with b-frames requires a delay, but this is a bit messy with VFW because it can only do '1 frame in/1 frame out'. So at the beginning of the encoding, while x264 is still buffering frames, VirtualDub will write a few empty chunks because it cannot know when a 0 byte frame by an encoder is intended behavior or not. The only way to avoid this is just not using b-frames with x264vfw.

danpos
15th May 2006, 03:07
@GodofaGap

It's really surprisingly what a 'search' does! I was searching for a answer to my question and the search brings me out here to your post. It clarified my doubts perfectly! :goodpost:

This board really rocks! :thanks:

Cheers,

IanB
15th May 2006, 08:37
I take it the problem here is accessing frame 0 of these files trips the "error state" and you then cannot access any other frames from that point. This is not the intended behaviour, but may be unavoidable.

Does doing this work around the problem:-AviSource("....avi")
Trim(2, 0) # never access frame 0 or 1
...Can you put up a very small sample file with the bad frame 0 (low res, low quality, 10 frames)

danpos
15th May 2006, 14:37
Can you put up a very small sample file with the bad frame 0 (low res, low quality, 10 frames)

Of course! Here (http://rapidshare.de/files/20514119/sample.avi.html) you get it.

Cheers,

IanB
16th May 2006, 08:44
I have fixed this in 2.57 CVS. If the first frame is a Drop Frame it will search for the first key frame and use it to fill the void.

foxyshadis
16th May 2006, 10:01
That include any non-key frames, as well?

IanB
17th May 2006, 08:43
The code was already skipping leading delta frames. It does a "Find Nearest Key Frame (0)" at the left hand edge of the file. It works fine with the (one) test file I have. If anybody has files that fail please make a small test version available (low res, low quality, low frame count) that demonstates the problem. I can only fix what you report and what I can see.

SpAwN_gUy
26th September 2006, 14:16
well,.. i'm having a problem..
i have MKV's (x264+AAC) ... and i need to edit ExtSubz..(subzEditors are Just Crushing,..) and i've decided to open MKV's through AVS..
both AviSource and DirectShowSource - does not work.
VDM says something about Cannot find decompressor.
but in MPC files are working and showing with NoProb's..
i've checked VfW ffdshow.. and it's all good.
any suggestions?

foxyshadis
26th September 2006, 16:45
Hmm, can't open an mkv in a function made for opening avis? That's a shocker. Anyway, the likely problem with DirectShowSource is that you're missing a splitter, something that MPC has internally. You need to find and install either Haali's or Gabest's (aka MPC's).

Until you can open it in graphEdit and not in Avisynth, the problem's not related to avisynth.

Esc
30th December 2006, 17:36
Thanks, IanB!
I had the same problem with x264. And AviSynth 2.57 RC2 has solved it.

bond
30th December 2006, 18:59
i should add this thread to my "reasons why not to use outdated vfw" list...

IanB
31st December 2006, 05:03
And how is using Direct Show any less troublesome? Lets play randomize the filter graph. And how many users are capable of running Graphedit to force a recalcitant X.264 component into the right frame of mind.

The only VFW problem from this thread is related to a bit of slack coding, which I have fixed, and some bigoted programmers removing a valid and useful feature from a code base.

KISS approach, it works every time.

chipzoller
31st December 2006, 17:52
i should add this thread to my "reasons why not to use outdated vfw" list...
:) Bond, I KNEW this was inevitable at some point in this thread!

faam
22nd September 2007, 21:51
It works now avi souce openned avi files with h264 or x264 in avisynth and in paranoia and all scripts works ok.
The method is :
Find the frames marked D in virtualdub and delete them and save your file by using direct stream copy and thats it.

Thanks to all of you for your kind help