Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
19th October 2003, 02:51 | #1 | Link |
Registered User
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
|
@VFW/DShow experts: VFR in Avisynth could be good news for Matroska
Hi,
I've been trying to push the variable framerate subject in Avisynth and we're still trying to figure out if it's doable. How about an Avisynth fork or extender for Variable Framerate? http://forum.doom9.org/showthread.php?s=&threadid=63290 Containers like MP4, Matroska and Real Video all support variable framerate, but nobody seems to be trying to work out the subject, except Real Video on a anime filter. Advantages for VFR: - Perfect hybrid (30 fps Video + 24 fps Film) movies, without blending 24 fps->30 fps or decimating 30 fps->24fps; - Much less frames on anime, speeds encoding and gains bitrate; Disadvantages for VFR: - AVI and OGM unsupported; - Questionable video editing capacity? This post is to request help pushing Avisynth in this useful direction by providing some of your VFW/DShow knowledge. As a non-programmer it is my duty to beg Only then will this be more than experimental in containers. Best regards, Bilu Last edited by bilu; 19th October 2003 at 02:58. |
19th October 2003, 08:27 | #2 | Link |
Moderator
Join Date: Oct 2001
Location: Germany
Posts: 4,454
|
Well, it's not necessary to have VFR in my oppinion.
In xvid we have a feature called "frame drop" - try it. Encode your video at i.e. 60 fps, set frame drop ratio somewhere to 50%... you should prefilter the sources a bit so that the frames are really a little close. So there you have something very similar to vfr without breaking compatibility, editibility and all tools we are used to. Regards Koepi
__________________
Koepi's new media development site |
19th October 2003, 11:49 | #3 | Link |
Registered User
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
|
@Koepi
But how do you know which frames to drop? There are two main goals for VFR, and if framedrop works it's only for one of them. 1) Anime. You drop a duplicate but double the play time of the original frame, keeping the framerate. 2) Hybrid movies. You don't drop frames in the video parts (pure 30 fps) but drop duplicates in the film part (telecined 24fps -> 30 fps) to achieve pure 24 fps, and on this segment you DON'T want to keep the original framerate. Conclusion: XVID's framedropping can probably work for anime. To be something more it would have to include some sort of IVTC filtering to know Telecine parts and decide to drop without keeping framerate. I'm trying your method over the Star Trek Hybrid clip just to prove it. That's why VFR in Avisynth would benefit all VFR supporting encoders. XVID is MPEG-4 and would benefit under Matroska and MP4 containers (AFAIK OGM doesn't support VFR). EDIT: The result sucked :/ Framedrop was dropping much more than just duplicates. I used frame drop ratio 50 as you said. Bilu Last edited by bilu; 19th October 2003 at 12:09. |
19th October 2003, 12:13 | #4 | Link | |
Registered User
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
|
Quote:
You don't have to break compatibility Inserting a special mode into decombers and an internal flag into Avisynth doesn't break compatibility. You're not forced to use this new modes and flags. But you give users a free choice that can work as good as MotionPerfect on hybrid encodes Bilu |
|
19th October 2003, 13:38 | #5 | Link |
Moderator
Join Date: Oct 2001
Location: Germany
Posts: 4,454
|
Wow. you tested a single suggested value and tell us it sucks?
I expected a little more from you, try some lower values, that was just an example. It should work quite well. Try 10% or something alike. regards Koepi
__________________
Koepi's new media development site |
19th October 2003, 13:50 | #6 | Link |
Registered User
Join Date: Mar 2002
Location: Kansas City, Missouri
Posts: 1,812
|
Well the lower the values the less noticable it is. I'll give you that. I have used this feature on more than one occasion though myself. And I wonder if there is not something that could be done to improve the placement of drop frames. Best I can tell even on a 2-pass encode Xvid decides on the fly what to drop. And if it is trying to match a percentage it could drop important frames. :P Perhaps would it be possible to tie it into a 2-pass encode for better placement after the stream has been anylised. Or am I mistaken and this already done?
__________________
Opensource will not take over the world. But it will sure improve the lives of most of it! _______________________________________________ Inkscape - Scallable Vector Graphics for everyone. The GIMP - Free raster graphics and photo editing software. Planeshift - Free 3D MMORPG. Cause everyone needs some fun. |
19th October 2003, 14:58 | #7 | Link |
Moderator
Join Date: Oct 2001
Location: Germany
Posts: 4,454
|
Nah, framedrop is very (pre)alpha, it's just a proof-of-concept. The error you encounter on 2pass should be corrected with dev-api-4 as there the full control over the 2nd pass is given unlike in current dev-api-3 with bframes != -1.
Best regards Koepi
__________________
Koepi's new media development site |
19th October 2003, 15:21 | #8 | Link |
Seņor Member
Join Date: May 2002
Location: Austin, Texas
Posts: 915
|
I've always been a big fan of modularity myself. I think that you could get the frame dropping in XviD to be pretty good. But, as a standalone filter, it would be much more useful. You could use it with any codec, and it could be updated seperately.
I think that adding a VFR ability to something like AVISynth would be VERY useful, especially when dealing with hybrid clips. |
20th October 2003, 00:05 | #9 | Link | |
Registered User
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
|
Quote:
BTW, do you know is this feature is being revised for dev-api-4? I would think developers could look to it as less important... EDIT: Another question: how would you know the percentage of dups to drop on a hybrid film? Would it be worth knowing? Sorry about that again. :P Bilu Last edited by bilu; 20th October 2003 at 01:06. |
|
20th October 2003, 03:24 | #10 | Link |
Registered User
Join Date: Mar 2002
Location: Kansas City, Missouri
Posts: 1,812
|
Well it would almost not be worth it trying to calculate the dupe percentage. So many things could effect it and even mess it up. Bad sceen transitions from telecined to interlaced. Or tiny interlaced overlays on large telecined backdrops. What would be ideal is instead of setting a percentage of frames to be dropped which is as I understand how the current frame drop works is to set a threshold at which it should drop frames. And it will drop all frames that are either below that threshold or match other search criteria. This is somewhat how I believe it already works. But I think it would be better to let the algo simply search for positives than force false positives with a frame percentage. But as Keopi says it is a proof of concept. And dev4-api performs quite nicely BTW. Though I must say that recent ffvfw builds are giving everyone a run for the money.
__________________
Opensource will not take over the world. But it will sure improve the lives of most of it! _______________________________________________ Inkscape - Scallable Vector Graphics for everyone. The GIMP - Free raster graphics and photo editing software. Planeshift - Free 3D MMORPG. Cause everyone needs some fun. |
20th October 2003, 03:40 | #11 | Link |
Registered User
Join Date: Mar 2002
Location: Kansas City, Missouri
Posts: 1,812
|
Oh BTW. IIRC doesn't the dupe filter for AVS (By Marc FD IIRC) do more or less what you are describing bilu? Replacing nearly duplicate frames with an exact duplicate according to it's threshold? It is more up to the codec and container involved how VFR would be handled. So tying it to AVS while it sounds nice does not make perfect sense since avisynth is not geared to a single codec or output format. Which I think is more or less what koepi is trying to get at.
__________________
Opensource will not take over the world. But it will sure improve the lives of most of it! _______________________________________________ Inkscape - Scallable Vector Graphics for everyone. The GIMP - Free raster graphics and photo editing software. Planeshift - Free 3D MMORPG. Cause everyone needs some fun. |
20th October 2003, 10:29 | #13 | Link | |
Registered User
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
|
a practical case of a VFR filter
This is a practical case of a VFR filter:
RV9 Animation DropDupe Pre-filter http://forum.doom9.org/showthread.php?s=&threadid=56564 It's not Avisynth, but you get the general idea @Neo Neko Quoting myself: Quote:
Moreover, if you check that RV9 Dropdupe filter thread I linked to, you'll see they recommend Donald Graft's Dup to help their own filter, complementary and not replacement. Advantages still exist for their filter: faster encode, smaller bitrate. Bilu |
|
20th October 2003, 20:44 | #14 | Link | |
Registered User
Join Date: Mar 2002
Location: Kansas City, Missouri
Posts: 1,812
|
Quote:
__________________
Opensource will not take over the world. But it will sure improve the lives of most of it! _______________________________________________ Inkscape - Scallable Vector Graphics for everyone. The GIMP - Free raster graphics and photo editing software. Planeshift - Free 3D MMORPG. Cause everyone needs some fun. |
|
20th October 2003, 20:59 | #15 | Link | |||
Registered User
Join Date: Mar 2002
Location: Kansas City, Missouri
Posts: 1,812
|
Quote:
Quote:
Quote:
__________________
Opensource will not take over the world. But it will sure improve the lives of most of it! _______________________________________________ Inkscape - Scallable Vector Graphics for everyone. The GIMP - Free raster graphics and photo editing software. Planeshift - Free 3D MMORPG. Cause everyone needs some fun. |
|||
20th October 2003, 22:24 | #16 | Link | ||||
Registered User
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
|
Quote:
Quote:
has to do with VFW?? Has it broken compatibilities? What I'm trying to say, and have already discussed the issue with Bidoche before ( see my 1st post ) is that Avisynth exports data through the VFW interface ( not allways, as I've shown you, not to mention text logs) and I'm trying to find out if frame duration could be sent in another stream (just like you send audio through Avisynth) and then a DShow Splitter would act on the Video stream based on the information of this frame duration stream. Could be done easier by using text logs, do a XVID null encode with an AVS script with VFR-prepared filters that would export such info, and then load the source script and log into a VFR prepared encoder. But that is a bit primitive, don't you think? And the DShow splitter option would bring VFR power to every app that supports DShow sources and is VFR capable. Quote:
( as in better than MotionPerfect ) hybrid movie encodes. I'm trying to find ways that don't break compatibilities. As Bidoche said, frame duration flags are easy. And IMHO create an IVTC filter that modifies duration flags instead of blending frames is easier to develop than traditional IVTC filters and faster. Quote:
EDIT: Older discussions I found on this subject Variable frame rate support http://forum.doom9.org/showthread.php?s=&threadid=47203 VFR in Avisynth 3.0? http://forum.doom9.org/showthread.php?s=&threadid=53028 3.0 Wip http://forum.doom9.org/showthread.php?s=&threadid=48940 Bilu Last edited by bilu; 20th October 2003 at 22:46. |
||||
21st October 2003, 07:16 | #17 | Link | |
Registered User
Join Date: Mar 2002
Location: Kansas City, Missouri
Posts: 1,812
|
In short yes. But that is just my oppinion.
The biggest thing AVS does for me is bring support to VFW based programs for codecs and formats that only Directshow supports or reading in the odd DVD. So having to use a directshow based program to make use of it already limits the features usability and if I understand correctly would indeed break compatability. If I understand your sped up encoding claim you are claiming that changing a frames duration means the frame would only have to be filtered once and not twice if only 3:2 pulldown and no decimation etc was done. All I can say is you would have to be doing some heavy duty filtering for it to make a large difference. And it would not speed up encoding that much especially in comparrison with Xvid's frame drop. Actualy in conjunction with Xvids frame drop if there were not some communication between AVS and the codec itself about which frames were already calculated to drop the calculations would have to be done again slowing down the encoding even more. And how in VFW and directshow are you going to acomplish that?! If someone were going to do this. And I mean do this right. Then an end to end AVS solution would be best. Then external program issues would be relatively trivial. But before that can happen a few things would need to be done first. 1. Have directshow source and other source plugins handle audio uniformly much like AVISOURCE. Which I hear is in the works anyway. 2. Have codecs reworked as plugins for AVS itself. You would not be able to divx with it unless by some twist of fate they supported it or there were some wrapper shenanegins. But Xvid, ffmpeg, and even VP3 since the source code is avalible could be created as loadable modules 3. Finally include muxing filters whether via directshow or loadable filters and a file writer. Then you could do scripts like this. Quote:
__________________
Opensource will not take over the world. But it will sure improve the lives of most of it! _______________________________________________ Inkscape - Scallable Vector Graphics for everyone. The GIMP - Free raster graphics and photo editing software. Planeshift - Free 3D MMORPG. Cause everyone needs some fun. |
|
21st October 2003, 18:39 | #18 | Link |
Seņor Member
Join Date: May 2002
Location: Austin, Texas
Posts: 915
|
I am a little split on how to accomplish this.
VFR support in some sort of complex encoding system like AVISynth is needed because there are VFR sources in the wild right now. Obviously, VFW applications could not support that feature, which limits you to DirectShow applications. Also, while I do believe that the codec should be able to alter the framerate, drop or add frames, I also believe that handling this outside of the codec would be better as it would make it possible for any codec to make use of it. If so much of AVISynth would have to be edited, then it would probably be much more feasible to write an AVISynth compatible system from scratch that was designed to handle those extra features. An AVISynth plugin wrapper for DS shouldn't be that hard to produce, but you would loose all of the advanced scripting features of AVISynth. |
21st October 2003, 21:15 | #19 | Link |
Registered User
Join Date: Mar 2002
Location: Kansas City, Missouri
Posts: 1,812
|
Frame dropping and altering frame durration outside the codec is utterly useless if the codec itself does not support it. If the codec does not support it the best you will ever get is telecining and then running the dupe filter. Most codecs require constant framerate. So even if AVS could flag a frame to have a durration 10 times longer than that of an average frame pretty much every VFW and directshow codec in existance is gonna encode 10 identical frames in place of the 1 longer one. Useless. The speed up on filtering would also be negligable. And in order to get any speed increase on filtering you are gonna have to make the filters both internal and external VFR aware at least in some small way.
It sounds like a good idea. But I am having troubles seeing the real benefit at the moment and a justification that could convince the AVS developers to re-write large portions of their code.
__________________
Opensource will not take over the world. But it will sure improve the lives of most of it! _______________________________________________ Inkscape - Scallable Vector Graphics for everyone. The GIMP - Free raster graphics and photo editing software. Planeshift - Free 3D MMORPG. Cause everyone needs some fun. |
22nd October 2003, 01:02 | #20 | Link | |
Seņor Member
Join Date: May 2002
Location: Austin, Texas
Posts: 915
|
Quote:
In VFW, a frame is passed to the codec and data for that frame is passed out the other end. The only thing the codec can know in this case is how many frames it has been passed. It doesn't even know if there is a dropped frame in the stream because that data isn't passed to it. To quote the developer of VirtualDubMod:** [13:43] <Cyrius> well at least VirtualDub doesn't send the dropped frame to the codec ...and... [13:51] <Cyrius> no frame number is sent with VfW [13:51] <Cyrius> so the codec doesn't know anything [13:51] <Cyrius> except that you are giving a frame DirectShow is a little different in that frame(s) are passed to the codec and data's are passesd out. Also, there is a timecode attached to each frames. And while it is theoretically possible for a codec to change a timecode, or not output one of the data, none do. All current codecs simply pass the timecode information through with each frame. So, assuming you did the same thing in AVISynth, filters could either be aware of the timecode or not. If they are then they can drop out a frame or change the timecode. If they aren't then they just ignore it and pass on the extra frame data. Like the codecs in DS, most filters would never need to know what the timecode is. *(The only exceptions that I can think of would be MPEG-2 but that is a different story, and FLASH as it is technically a CODEC that renders VFR where VFR=however fast it can render on a particular CPU.) **(The entire IRC conversation on this very topic is available upon request.) |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|