Log in

View Full Version : Avisynth Handling of strange fps (120fps) and Avi Dropped Frames


Pages : [1] 2

bill_baroud
25th March 2003, 22:37
Hi

The problem i encounter is quite unusual and complex to explain so i'll do my best,
although i have already reported something like that some times ago.


Material :
- avi file, 120fps (119.880) Xvid captured from japanese satellite (i suppose)
- vbr mp3 (-_-)

if you open file in vdub, images sequence is :

K DDD P DDD P DDD P DDD P ..... K

where
- K stand for K-Frame
- D for Dropped Frame (as Cyrius explained it to me)
- P for P-frame

image change only on P & K

i'm using Avisynth 2.07 and Vdub 1.5.1


Problem :
Avisynth seems to have hard time to deal with Dropped Frames
or with the unusual frame rate, it's output garbage.

I was suspected something from xvid but Vdub and DirectShowSource with ffdshow are fine
(that's why i posted here, feel free to move the post where it's belong).

avisynth :
http://breizhbill.baroud.free.fr/image posts/GITS_garbage.JPG

virtual dub :
http://breizhbill.baroud.free.fr/image posts/GITS_normal.JPG

what's i'm actually doing, it's open the 120fps file in VirtualDub,
then frameserve it, open the .vdr in Avisynth, Decimate(4) it -to have 30fps output-,
and encode it in huffyuv in another vdub.

DShowSource with decimate gave me 30fps output,
but only 2 "real" images per second.

(just tested 2.51 and it's the same)




Here are my questions :

- First, is it a bug from Xvid decoding (i'm using Koepi Stable one)
or from Avisynth dropped frames handling ?
Or am i really dumb and i'm doing it completly wrong ?

- And second, can someone very advanced with capturing and
interlacing explain me, why there is some japanese guys (no offense to them !)
who encode with such a strange fps (it's not the first time i got files like that).

I somehow suspect Hybrid material (Ghost in the shell TV has a lot of CG scenes -like opening- )
and perhaps broken capture devices ?
But 120 fps is really cpu intensive to decode in real time with vobsub subtitle
(on my XP1600+)


Thanks you for reading me till here and perhaps enlight me on this case

cheers.

mf
25th March 2003, 22:48
Looking at the artifacts, it seems as if AVIsynth is feeding XviD the dropped frames as P-frames, where the P-frame is repeated 3 times causing it to repeat the difference on the previous frame 3 times.

In math, it would be like this:
K = 1
P = + 1
D = + 0

So vdub decodes this:
1
2
2
2
2
1

But AviSynth treats it as this:
K = 1
P = + 1
D = P

Causing it to decode this:
1
2
3
4
5
1

I hope this makes sense ^_^'

bill_baroud
25th March 2003, 23:04
thanks mf, so it's look like there is a problem in Avisynth :/



now i have to understand why they double fps 2 times.



Aristobule send me the culprit ^^; :

http://breizhbill.baroud.free.fr/avi60_07.zip



hope you like the japanese ;)

Aiorus
25th March 2003, 23:33
I had the same problem, a Raw file for an Anime, I fixed it with AviUtil, doing 2/5 and 1/2 frames conversions. I hope that helps.

Guest
25th March 2003, 23:45
A point on Decimate(): If you are using Decimate() from the Decomb package, then to go from 120fps pattern to 30fps, you need:

Decimate(4).Decimate(3).Decimate(2)

Using just Decimate(4) will give you 90fps.

Decimate(2).Decimate(2) might also work.

bill_baroud
26th March 2003, 00:05
thx Neuron, i was doing Decimate(2).Decimate(2)

but if i remember well, Decimate(4) give me the same output ???


how could i know if i use your Decimate or the Internal one (with the plugins autoloading)

seems like the internal has priority

Guest
26th March 2003, 00:40
There isn't an internal one to my knowledge.

To see if mine is running, put show=true as a parameter to Decimate(). If you then see my copyright message on the output, then it is mine.

Decimate(4) will delete one frame out of every 4.

ErMaC
26th March 2003, 02:29
You do not need to use Decimate in this circumstance, in fact I think it might be a bad thing since you're decoding all the dropped frames. I dealt with this back in the first raws that exibited this drop frame thingy. Use SelectEvery(x,y,z) where X is the # of frames in a sequence, and y and z are the frames to take. For your example you would use:
SelectEvery(4,0)

Guest
26th March 2003, 06:14
Of course that is preferable. If the phase of the pattern changes it becomes a bit more complex.

sh0dan
26th March 2003, 10:18
Could you put up a few seconds of the material. Preferable with two or three keyframes present for us to test on?

bill_baroud
26th March 2003, 11:51
@shodan : no problem, i'll do that as soon as i can


i'll try to find a change in frame order (if there is one)



@ErMaC : thanks for the tips, it would be a little faster no ?

lamer_de
26th March 2003, 12:12
If the pattern stays,

ChangeFPS(29.97) [or whatever fps you need]

should work aswell. At least it did work for me when importing quicktime clips, which get added 100 frames between the actual frames everyime. But the SelectEvery command works fine aswell.

CU,
lamer_de

APF_Gandalf
26th March 2003, 18:57
here is a link (japanese but babelfish seems to work enough so you can understand it) that explains why they are doing this (stupid) 120fps conversion

http://www.kjps.net/user/r2-m2/clare/dtv/120fps.html

bill_baroud
26th March 2003, 21:51
here the sample :

http://breizhbill.baroud.free.fr/Gits2_sample.avi

it's about 7.8mb and cover the end of opening (full CG) and the begining of the ep (more classical animation)

the frame sequence seems to be the same for the whole file, and i just tested Motion Perfect for 29.97 > 23.976 and it worked amazingly !

i'm very impressed


after a better look in Motion Perfect, the frame order change from
K DDD P (30fps) to K DDDD P (24fps) at 1:40 (i cutted from 1:20 to 1:40 T_T )

i'm reuploading a new sample : 3.98mb



@APF_Gandalf : thanks a lot !! now it make sense

5*23.976 = 4*29.97 = 119.88 ... it's somehow a solution for Hybrid/Mixed material



but in my case, it looks like the whole file was at 30 -_-

ErMaC
27th March 2003, 05:12
If you need me to translate the page I can explain what it says. Yay, Japanese Major actually coming in handy.

EDIT: Also the whole 120fps thing is stupid - you can do the same thing with 60fps by inserting alternating 1 and 2 drop frames so your sequence goes FDFDD for 24fps stuff and just insert every other frame as in FDFD for 30fps stuff. That's what the original raws which used the dropframe technique used (X episode 18 was the first one to appear if I recall) and it caused far less frame overhead than the 120fps crap.

mf
27th March 2003, 09:16
I don't really get the whole thing. It does make sense to take a common denominator (is that the word?), but it doesn't make sense when your original is 30fps anyway. If you're only inserting dropped frames I honestly can't imagine how this would be any different than not inserting them. It does work if you have two different fps clips and you want to merge them, but it doesn't look like that, and it'd involve some manual work. Anyone care to enlighten me ? I'm better at normal japanese than babelfish engrish and I don't understand much of both :p.

ErMaC
27th March 2003, 09:25
The usefulness of this tool is when you want to encode a show which has both 30fps and 24fps segments into a single file without encoding redundant frames in the 24fps segment (which would introduce jitter) or blending frames in the 30fps segment.

This can be achieved by taking the 24fps footage, adding dropped frames to make it 60 or 120, doing the same to the 30fps footage and then merging the files using VirtualDub's append segment function.

That's the shortest way to explain it.

mf
27th March 2003, 09:40
Originally posted by ErMaC
This can be achieved by taking the 24fps footage, adding dropped frames to make it 60 or 120, doing the same to the 30fps footage and then merging the files using VirtualDub's append segment function.
Right. So that comes down to this:
Originally posted by me ;p
It does work if you have two different fps clips and you want to merge them

Thanks for verifying.

bill_baroud
27th March 2003, 10:58
@ErMac : thanks for the offer, but i won't disturb you as it's seems to be clear that this 120fps is just crap ....

It does work if you have two different fps clips and you want to merge them


but it can be usefull when say, you have the opening at 30fps progressive and the rest of the ep at 30fps telecined (hum, i'm not quite sure of the terms ^^; )

in this case you have to ivtc the telecined part and desentrelace the other and then join it to have something smooth.

sure it can be achieved at 60fps like ErMac says, but it make some sense to me
(or there is a better way ?)


hm after a re-reading, i'm just saying the contrary of my first sentence ... oh well ^^;

sh0dan
27th March 2003, 11:05
Think I found the bug (or rather a workaround for a bug in the codec). You clip now produces correct results. There is a new CVS binary up. Everyone using captures - please test!!

Thanks for providing such a good sample! Without the sample it would have been impossible to track down!

mf
27th March 2003, 11:20
Even if you can do it like this, I don't see anything wrong with the motion of anime that has only been telecided and not decimated. There might be some inaccuracies but with anime (which is even half fps most of the time) you won't be able to notice them.

bill_baroud
27th March 2003, 17:47
@mf : if i decimate the 30fps to 24, it's lagging like hell

and if i keep it at 30, the compressability is at 52% for 175mb final size ... so i would like to have it at 24 since the ep is at 24 ...

btw Motion Perfect give me a really smooth opening, so it's ok, i have both part at 24fps
(hmm Motion Perfect is very very buggy though :/ )


@shodan : i'm really glad to have helped you to solve this issue since it's not that rare for fansubbers. thanks a lot !!

ErMaC
27th March 2003, 18:18
If you don't decimate the stream you're wasting space because you're encoding a duplicate frame every 5th frame, and during camera pans or other smooth motion you will introduce jerkiness. It's more noticable than one might think, but it's more the wasted space that's the issue. Drop frames take just a bit of overhead for their avi frame header information and then are totally empty.

sh0dan
27th March 2003, 21:21
Originally posted by bill_baroud
@shodan : i'm really glad to have helped you to solve this issue since it's not that rare for fansubbers. thanks a lot !!

Anything to help the great work of the fansubbers! :)

ErMaC
28th March 2003, 00:00
I wouldn't get too eager to help them as in my opinion the current state of the online "fansub scene" has become nothing more than a mirror of the pirated software "scene". I don't think mudslinging is appropriate to the board so I'll leave it at that. I do however feel that this 120fps thing is something AVS should be able to deal with in general.
Perhaps there should be a way for AVISynth to automatically detect files with drop frames and automatically remove them as an option in AVISource().

sh0dan
28th March 2003, 09:32
Originally posted by ErMaC
Perhaps there should be a way for AVISynth to automatically detect files with drop frames and automatically remove them as an option in AVISource().

This would require a pass through the file to detect the number of frames - furthermore it could easily introduce jerkiness, and uneven framerates.

csr2000
28th March 2003, 10:19
Japanese use 120fps to join 30fps & 24fps clip together.
23.976*5=119.88
29.97*4=119.88

Some DVD like stand_alone_complex, it's OP & ED is 29.97fps NTSC, but all frame is progressive. MAIN is 29.97fps NTSC Telecided.

So if you do this DVDrip contain OP+MAIN+ED, you can't join them together, because VD will tell you they are different fps.
then Japanese use AVI60 to change 24fps & 30fps into 120fps,then join them.
this is the simple use.

120fps also used to deal with 24fps & 30fps hydrid clip.
it will use three tools, FPSCHK, Dec60.dll & AVI60.
use dvd2avi get d2v from vob or m2p(capture), then open it with FPSCHK, FPSCHK will check the clip and analyse which segment is 30fps, which is 24fps, finaly produce a idx contain this info.

creat a avs like the fellow

LoadPlugin("D:\tool\dec60.dll")
LoadPlugin("D:\tool\mpeg2dec.dll")
LoadPlugin("D:\tool\decomb.dll")
Mpeg2Source("g:\120fps.d2v")
Telecide(chroma=true,dthreshold=13)
Dec60(idxfile="g:\120fps.idx",deint=false)

after you finish the encode, you will get a very ugly clip.
so open the AVI60, import the idx and make it to 120fps,
all will done.

Wilbert
28th March 2003, 12:01
Where do you get those tools: FPSCHK, Dec60.dll & AVI60 ?

AS
28th March 2003, 12:41
http://www.geocities.co.jp/SiliconValley-Sunnyvale/3109, scroll down for avi 60

http://www.geocities.co.jp/SiliconValley-Sunnyvale/3109/oldtools.html for FPSCHK, Dec60.dll

mf
28th March 2003, 13:13
Originally posted by bill_baroud
@mf : if i decimate the 30fps to 24, it's lagging like hell
I said don't decimate.

Originally posted by ErMaC
If you don't decimate the stream you're wasting space because you're encoding a duplicate frame every 5th frame, and during camera pans or other smooth motion you will introduce jerkiness.
That all depends on the anime. There are a lot of animes where the pans are 30fps, which is the case I'm interested in. Indeed, there's also anime where the pans are 24fps, like naruto. But just look at ChiZeTo's sub of Ajimu Kaigan Monogatari, the pans are just horrible (decimated to 23.970fps).

ErMaC
28th March 2003, 18:43
MF - I thought it would be quite obvious I wasn't talking about the situation where the whole show is 30fps, because if that's the case then there's no need for this stupid 120 or 60 fps stuff because the whole show is in that framerate. Thsi tool is only useful when different segments are in different framerates, and if a show has pans in 30fps then the whole show is 30fps, not just the opening and ending sequences.

mf
28th March 2003, 20:24
Originally posted by ErMaC
MF - I thought it would be quite obvious I wasn't talking about the situation where the whole show is 30fps, because if that's the case then there's no need for this stupid 120 or 60 fps stuff because the whole show is in that framerate. Thsi tool is only useful when different segments are in different framerates, and if a show has pans in 30fps then the whole show is 30fps, not just the opening and ending sequences.
That's the problem - often the drawn animation is 24fps, but the pans are 30, and often mixed (24 animation and a 30 pan at the same time).

ErMaC
28th March 2003, 20:27
Yes but no raw encoder is insane enough to encode each of those segments seperately. If the show itself contains 30fps, the raw encoder would make the whole thing 24 or 30 - they're not masochistic enough to do it segment by segment. It's either Op/episode/Ed/Preview at different rates, or the whole file as one thing. You aren't going to run into changing drop frame patterns in the middle of the show.

mf
29th March 2003, 13:16
Originally posted by ErMaC
Yes but no raw encoder is insane enough to encode each of those segments seperately. If the show itself contains 30fps, the raw encoder would make the whole thing 24 or 30 - they're not masochistic enough to do it segment by segment. It's either Op/episode/Ed/Preview at different rates, or the whole file as one thing. You aren't going to run into changing drop frame patterns in the middle of the show.
Better leave it all at 30fps and let the encoders decide what to do with it themselves.

OUTPinged_
9th April 2003, 22:48
120fps does pretty much the same.

30fps raws will need interlaced video. That is a no-no for playback at PC screen.

mf
10th April 2003, 09:55
Originally posted by OUTPinged_
30fps raws will need interlaced video.
Or they could just use Decomb() without Telecide() and again, let the encoder decide what to do with it.

OUTPinged_
10th April 2003, 13:48
what i wonder... are there any plugins for virtualdub that do the following:

1. compare current frame with last I/P frame.
2. if frames are same, mark current as dropped and zero the frame contents.

That thing would make 120fps creating easy and independent from mpeg2 flags

timecop
10th April 2003, 13:56
Oh, THAT's why I've been seeing a lot of **** in 119.80fps lately.
Even thought I should become leet and start encoding my stuff in 120fps.

Then common sense strikes me, and I ask myself the question, why?

So I go to doom9 forums and search for 119.80 fps.

And I find this thread.

Lemme ask you this

Are you saying someone with a lot of time on their hands captures and splits the show into tiny segments depending on their fps, encodes them separately, then joins the **** together?

Every fansub place that I know of doesn't screw around with 120fps - they just decimate by 5 in virtualdub/nandub/whatever, and drop it back to 23.976fps, unless its pure CG at which point it decimates by 4 for 29.97 fps.

Does someone here (capturing jap tv, for example) actually use any of these tools? Splitting + joining captures seems to be an awful waste of time for something you dont get paid for doing eh?

OUTPinged_
10th April 2003, 14:24
@timecop:


well it may be done pretty much automated. It also doesnt consume any additional CPU time (comparing to simply producing alot of duplicate frames). The only drawback is that frame overhead is 5x times bigger, but it's up to you to decide if 5-10MB of filesize is worth smooth CG.


Also all 'videocoding mastarz' dudes seem to not like the idea of frame dropping, not sure why.

Wilbert
10th April 2003, 14:31
This could perhaps be a reason to support vbr framerate in AviSynth v3.0x: http://forum.doom9.org/showthread.php?s=&threadid=47203&highlight=variable. And then use the Matroska container in VirtualdubMod to store those files.

OUTPinged_
10th April 2003, 14:52
There isnt any ETA for both. Until then, 120fps does the trick.

It isnt hard to do, it is compatible, it doesnt take much of additional space, what else do you need?

ErMaC
10th April 2003, 19:26
What else do we need? Something that isn't a nasty HACK.

As we've stated before, it is totally unpractical to do this contunially throughout a show. I mean heck, why stop at just 24fps and 30fps? Why not find the points where they're only animating every 3rd frame in 24fps and decimate to 8 there, then use this "wonderful" little tool to hop it all the way up to 120 by adding some huge # of drop frames? I mean, wouldn't that be more efficient filespace-wise?

Of course it would, but that doesn't mean it's a good idea. These methods are abusing the AVI container and are a PAIN in the BUTT to work with, plus they will not playback correctly except in DirectShow capable players - playing them back in AVIfile playback programs results in nasty skipping crap. And forget about cross-platform.

If you really need the kind of VFR functionality, encode it in MPEG2 with pulldown flags for pete's sake.

OUTPinged_
10th April 2003, 20:07
Sorry dude, jap. release groups forgot to ask your opinion on this.

There are plans for r1 anime dvdrip groups to begin releasing 120fps encodes as soon as there will be software that will do all the crap automatically and with less effort. AC3 and VBR mp3 hacks are now pretty common. It is possible the same will apply to 120fps after some time.

There is reason for this. More and more anime dvds begin to contain alot of long 60i _and_ 24p pans. Also release groups dont care if some smart guy will decide to reencode their stuff. The goal is to make playback smooth and DS players handle it pretty much flawless. Also if you'd took your time to check, you would notice that vfw playback is good too.

ErMaC
10th April 2003, 20:22
Whoopie, so a bunch of pirates will start using a broken format. This forum isn't supposed to be catering to their needs.

The proper way to do this is to use a format which has native VFR support, which is why I've been pushing for this functionality in AVISynth 3.0 in other threads. It's far more constructive, I think, to get this implemented properly than promoting an awful hack.

OUTPinged_
10th April 2003, 22:01
Yea, and you need VFR support *not* for dvd ripping/(h)dtv capturing.

ph33r teh pirates!


VFR support is good. But until there is no such, 120fps is ok.

Atamido
11th April 2003, 02:02
Originally posted by OUTPinged_
There isnt any ETA for both. Until then, 120fps does the trick.

The ETA for Matroska is May 1st. There is a tool being worked on to transmux MPEG data streams from the MPEG container to MKV. Once that happens, then it will be a simple matter to use tools that only work in MKV to fully support vfr.

If AVISynth 3.0 supports vfr, then it would be extremely simple to just encode directly to MKV and avoid all of the steps inbetween.

MKV is also perfect for doing encodes of DVB brodcasts...

solvalou
12th October 2003, 02:02
I was searching for info about IVTCing hybrid sources and came upon this thread... quite old btw ;)

Anyways most people want to have avi as final but I want to reencode it to mpeg2 so I didn't understand how it can be done.

I'm trying to put subtitles on my Initial D dvds and reencode them to fit more eps per dvd. The problem is that every 10 sec the framerate changes from 24 to 30 and vice-versa. Can anyone shed some light on how I can reencode it to mpeg2 using those tools mentioned b4 ?

thanks

bill_baroud
12th October 2003, 16:04
Initial D is a mix of CG scene/Animation scene, should be a nightmare to encode :eek: .

But since you want to convert it to dvd, why do you want to change anything to interlacing ? you should reencode it without any IVTCing, using something like Requant (http://forum.doom9.org/showthread.php?s=&threadid=62849), and using optional subtitle.

would be a lot simpler imho ;)

solvalou
12th October 2003, 20:46
Thanks for the advice but I would really prefer to IVTC the 24fps parts and reencode it using CCESP as the final quality is much better.

Guest
13th October 2003, 01:30
Originally posted by solvalou I was searching for info about IVTCing hybrid sources and came upon this thread... quite old btw ;)

Anyways most people want to have avi as final but I want to reencode it to mpeg2 so I didn't understand how it can be done.

I'm trying to put subtitles on my Initial D dvds and reencode them to fit more eps per dvd. The problem is that every 10 sec the framerate changes from 24 to 30 and vice-versa. Can anyone shed some light on how I can reencode it to mpeg2 using those tools mentioned b4? The problem for you is the 30fps content. You need to reliably detect it and decimate it down to 24fps. One solution for automatically IVTC'ing the 24fps parts while decimating the 30fps sections is the Decomb filter package. You can serve its outputs to the mpeg encoder of your choice. You would use Decimate(mode=1/3). For best quality, use Decomb's capability for manual overrides to correct and guide the automatic process.