View Full Version : How to convert frame rate with Avisynth?
AlexeyS
20th May 2005, 01:47
How to convert frame rate with Avisynth? Searched docs - found nothing. :(
neuron2
20th May 2005, 02:20
You looked at the Avisynth documentation and did not see ChangeFPS, AssumeFPS, and ConvertFPS? I am gobsmacked.
AlexeyS
20th May 2005, 09:55
Originally posted by neuron2
You looked at the Avisynth documentation and did not see ChangeFPS, AssumeFPS, and ConvertFPS? I am gobsmacked.
Thanks.
AlexeyS
20th May 2005, 16:41
As I understand, ChangeFPS will help me.
But how can I say to Avisynth to delete right frames?
For exmpale, I have anime 47.952 fps video with repeating:
10101010010100101001010010100101001010010100
(1 is good frame; 0 is only duplicate frame, which should be deleted).
stickboy
20th May 2005, 17:21
Maybe you want to use Decimate (http://www.neuron2.net/decomb/decombnew.html) instead, then?
neuron2
20th May 2005, 17:22
Decimate will do 1-in-N decimation. You may want N-in-M decimation or removing *all* duplicates. You have to tell us what you want!
If the duplicate pattern is perfectly consistent, then you can remove them all without affecting audio sync. If not, you will mess up audio sync. See the help files of MultiDecimate and FDecimate for information about arbitrary decimation. The mentioned internal Avisynth filters cannot perform removal of all duplicates.
I think TDecimate may now be able to perform arbitrary decimation, too, IIRC.
Kurosu
20th May 2005, 17:44
Originally posted by AlexeyS
As I understand, ChangeFPS will help me.
But how can I say to Avisynth to delete right frames?
For exmpale, I have anime 47.952 fps video with repeating:
10101010010100101001010010100101001010010100
(1 is good frame; 0 is only duplicate frame, which should be deleted).
With a repeating pattern, SelectEvery() (http://www.avisynth.org/SelectEvery) should help. But don't be fooled by a pattern constant over even 10000 frames. Editing may break it.
For these cases, various neuron2's tools should help, so I let him handle the following talks.
AlexeyS
20th May 2005, 18:20
Originally posted by neuron2
[B]Decimate will do 1-in-N decimation. You may want N-in-M decimation or removing *all* duplicates. You have to tell us what you want!
If the duplicate pattern is perfectly consistent, then you can remove them all without affecting audio sync. If not, you will mess up audio sync.
What if I just convert fps for audio with besweet (it has such feature) and use Decimate?
neuron2
20th May 2005, 18:36
Originally posted by AlexeyS
What if I just convert fps for audio with besweet (it has such feature) and use Decimate? Without knowing your source frame rate and your desired new frame rate, which you haven't told us (!), I cannot tell you how to decimate.
If you use Decimate() or FDecimate(), you do *not* need to adjust the audio.
Please state your input frame rate and desired output frame rate.
AlexeyS
20th May 2005, 18:43
Originally posted by neuron2
Without knowing your source frame rate and your desired new frame rate, which you haven't told us (!), I cannot tell you how to decimate.
If you use Decimate() or FDecimate(), you do *not* need to adjust the audio.
Please state your input frame rate and desired output frame rate.
Ok. I want to delete duplicated frames and convert fps to 25.000.
Source frame rate is 47.952 fps.
AlexeyS
20th May 2005, 18:45
Will this help me:
Decimate (mode=2)
ConvertFPS (25.000)
neuron2
20th May 2005, 18:58
Originally posted by AlexeyS
Ok. I want to delete duplicated frames and convert fps to 25.000.
Source frame rate is 47.952 fps. Use this:
FDecimate(25.0)
Read the help file. You may have to tweak the threshold for duplicate detection.
Just out of curiosity, where did you get a clip with such a strange frame rate?
AlexeyS
20th May 2005, 19:26
Originally posted by neuron2
Use this:
FDecimate(25.0)
I've tried and I got 25 fps video, but with some 1 and 0 frames order. It's just part of video:
1010111111101011111111111111111111110
I think frames was deleted incorretctly - some 0 frames were copied to new video instead of being deleted.
Just out of curiosity, where did you get a clip with such a strange frame rate?
It's satellite video (anime).
I've just run video again and DGIndex showed me 59.940 fps. :confused:
neuron2
20th May 2005, 20:51
You're either ignoring or misunderstanding what I'm telling you. If you remove all the duplicates, you will get a final frame rate determined by the ratio of duplicates to nonduplicates in your source. You lose control over it.
Just removing all duplicates is not as smart as you might think anyway. It will probably cause audio desync, it will result in a strange final frame rate, and it will remove the static scenes of your clips because they will look like strings of duplicates.
These things are discussed in the help files I mentioned, as well as on several threads here. You are proceeding as if you haven't read and understood that material.
Now apparently you are not even sure what your input frame rate is! Knowing these things is crucial for choosing the correct processing.
AlexeyS
20th May 2005, 21:03
Originally posted by neuron2
You're either ignoring or misunderstanding what I'm telling you.
My English is bad, maybe I just don't understand some things correct.
If you remove all the duplicates, you will get a final frame rate determined by the ratio of duplicates to nonduplicates in your source. You lose control over it.
Just removing all duplicates is not as smart as you might think anyway. It will probably cause audio desync, it will result in a strange final frame rate, and it will remove the static scenes of your clips because they will look like strings of duplicates.
I think in my case it will be better to delete all duplicates first and then convert to 25 fps, because all duplicates have a lot of artifacts (a LOT of MPEG2 artifacts, and sometimes shakes).
These things are discussed in the help files I mentioned, as well as on several threads here. You are proceeding as if you haven't read and understood that material.
Help files without examples are not always helpful. :(
Now apparently you are not even sure what your input frame rate is! Knowing these things is crucial for choosing the correct processing.
I've tried DGIndex and it showed me 47.952 fps few times. Now it shows 59.940 on the same samples. :eek:
Wilbert
20th May 2005, 21:10
I think in my case it will be better to delete all duplicates first and then convert to 25 fps, because all duplicates have a lot of artifacts (a LOT of MPEG2 artifacts, and sometimes shakes).
That's possible, but if you do that (like neuron2 says) you will get audio desync. The reason is that you are speeding up your video (24.xx to 25 fps). If you still want to do that you need to shrink the audio duration (by resampling it).
Btw, could you upload 50 frames of that vob somewhere?
AlexeyS
20th May 2005, 21:12
Originally posted by Wilbert
That's possible, but if you do that (like neuron2 says) you will get audio desync. The reason is that you are speeding up your video (24.xx to 25 fps). If you still want to do that you need to shrink the audio duration (by resampling it).
Don't think it's problem. BeSweet can do this.
Btw, could you upload 50 frames of that vob somewhere? [/B]
Ok, I'll try tomorrow.
neuron2
20th May 2005, 21:22
Originally posted by AlexeyS
I've tried DGIndex and it showed me 47.952 fps few times. Now it shows 59.940 on the same samples. :eek: That's because you had Force Film enabled at first. [59.94 * 0.8 = 47.952]
I think in my case it will be better to delete all duplicates first Then say bye-bye to any static scenes, and bye-bye to audio sync! The kind of desync I'm talking about cannot be fixed by changing the overall playing time of the audio using BeSweet.
I guess you want to learn the hard way. That's OK; healthy skepticism is...well, healthy. You can use MultiDecimate to remove all duplicates.
Since you have 59.94 source, you *may* be able to SelectEven and then IVTC. It's worth investigating.
AlexeyS
20th May 2005, 21:44
Originally posted by neuron2
That's because you had Force Film enabled at first. [59.94 * 0.8 = 47.952]
Ok.
Then say bye-bye to any static scenes, and bye-bye to audio sync!
Now I understand. No I don't want to loose static scenes.
Since you have 59.94 source, you *may* be able to SelectEven and then IVTC. It's worth investigating.
Yes, I think it will be best way. But where I can get more info about how to use SelectEven?
I can't found info in Avisynth docs, and I only found this on Avisynth website:
SelectEven makes an output video stream using only the even-numbered frames from the input.
neuron2
20th May 2005, 22:17
You just put this in your script:
# put your source filter here
SelectEven()
# apply IVTC here now
This will work only if the clip is 3:2 pulled down film doubled up to 59.94. We need to see your clip to properly advise you.
AlexeyS
20th May 2005, 22:33
This will work only if the clip is 3:2 pulled down film doubled up to 59.94. We need to see your clip to properly advise you. [/B]
Ok, I've just uploaded sample:
http://www.callofdutyserver.net/!tempmov/lion.m2v
neuron2
20th May 2005, 23:57
Try this:
mpeg2source("lion.d2v")
SelectEven()
Decimate(5)
This will also work:
mpeg2source("lion.d2v")
Decimate(2)
Decimate(5)
AlexeyS
21st May 2005, 12:16
Originally posted by neuron2
Try this:
mpeg2source("lion.d2v")
SelectEven()
Decimate(5)
This will also work:
mpeg2source("lion.d2v")
Decimate(2)
Decimate(5)
Just tried both scripts. Some duplicate frames are still in end video and that bad for this movie, cause duplicate some frames makes video shaking (vertically). :(
scharfis_brain
21st May 2005, 13:40
you also might want to try this:
loadplugin("D:\x\dgdecode.dll")
loadplugin("D:\x\avisynth_c.dll")
loadCplugin("D:\x\smartdecimate.dll")
i=mpeg2source("lion.d2v")
i.assumetff().separatefields().selectevery(4,0,3).weave()
smartdecimate(24,60,bob=i,weave=i)
the vertical shaking is a fault of that source!
in low-motion scenes this shaking is more "motion" than the real motion, which lets the decimator assume that there is a real moving frame.
you cannot do anything against: shaked frames detected as non-duplicate.
AlexeyS
21st May 2005, 13:50
the vertical shaking is a fault of that source!
Is this some way to remove this kind of shake?
mimage
21st May 2005, 13:53
Originally posted by AlexeyS
Is this some way to remove this kind of shake? Yeah, I'd like to know if there's a good method for that too!
scharfis_brain
21st May 2005, 14:25
move each jumped frame manually by using:
applyrange(blah).crop(blah).addborders(blah)
there is NO automated way to do so.
AlexeyS
21st May 2005, 21:09
Originally posted by scharfis_brain
move each jumped frame manually by using:
applyrange(blah).crop(blah).addborders(blah)
there is NO automated way to do so.
Don't think I can move manually each frame, because the movie has about 350000 frames. ;)
By the way, why this video shaking? I have few movies which have same shake and this movies are not old.
zilog jones
21st May 2005, 23:35
It's a fault on behalf of either the photographer or someone else somewhere along the line of it being photographed and it ending up on a video format. It happens a lot with filmed cel animation (i.e. not done digitally), no matter how new it is.
AlexeyS
21st May 2005, 23:45
Originally posted by zilog jones
It's a fault on behalf of either the photographer or someone else somewhere along the line of it being photographed and it ending up on a video format. It happens a lot with filmed cel animation (i.e. not done digitally), no matter how new it is.
But the logo is shaking too! :confused:
scharfis_brain
21st May 2005, 23:52
zilogjones: did you looked on the sample?
lets allume this pattern:
aabbbccdddeefffgghhhiijjjkklllmmnnn
it is a usual 3:2 pulldown (hard telecine w/o interlace, cause it is 720p)
but instead of a clean hard telecine there are some single frames vertically shifted.
(marked with a bold upper case letter)
aaBbbccdddeefffgghhhiiJjjkklllmmnnn
I doubt that this movio was transferred analogue to 720p.
I think there has been done a digital telecine, with some weird errors.
but maybe there is an automated way to solve this, but it'll be hard to implement.
- check for 3:2 pattern
- lock this pattern
- if pattern lock fails, go to the failing frame, shift it down by some amount, and compare it to its both(!) successors.
if it matches now, you've found the shifted frame.
AlexeyS
22nd May 2005, 00:16
- check for 3:2 pattern
- lock this pattern
- if pattern lock fails, go to the failing frame, shift it down by some amount, and compare it to its both(!) successors.
if it matches now, you've found the shifted frame. [/B]
Sorry, but I didn't know how to do all this. :( What exactly you mean under "Lock pattern"? If I'll find "shifted frame", will I able to correct automatically 350000 frames?
zilog jones
22nd May 2005, 00:57
Originally posted by scharfis_brain
zilogjones: did you looked on the sample?
I guess I didn't look at it properly!
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.