View Full Version : AviSynth: can it convert normal 60i HDV to 24P?
Abe Ford
2007 November 2nd, 17:36
Can Avisynth be used to convert normal 60i HDV footage to 24P?
Thank you!
AF
lordtangent
2007 November 2nd, 19:24
Can Avisynth be used to convert normal 60i HDV footage to 24P?
Thank you!
AF
The answer is yes. But I would advise against it.
If you insist on making "24p" from 60i what you would do is smart delace the 60i to 60p and frame decimate that to 24fps. Since the time scales aren't really compatible there will be judder. The motion blur will also not look like it was shot at the right shutter speed (because it wasn't).
There is a motion compensation plug-in for AVISynth that I've experimented with that could help fix the judder in this situation. It works but it is pretty technical to set up and the results are not stellar. It's also slow. I would not want to have to run it on wholesale quantities of video. (We are talking about seconds a frame rather than frames per second render speeds)
Unless you absolutely must have 24p (for a film-out or something like that) why don't you just use 30p? It's close enough to give the look a similar "feeling" and you wont have the judder. The procedure is similar.. smart de-lace the stuff from 60i to 30p. Depending on the smart delacer you use, the results can be quite nice. Some let you delace straight to 30fps, so you don;t need to do any further processing after that filter.
Another option for getting "30p" is to shoot at 1/30th of a second shutter, forcing the camera to hold each field a full frame. Some cameras (like the HV20) can do it. The motion blur gets a little longer but it's actually a pretty pleasing effect that looks somewhere between film and video in terms of the "feeling" of the motion.
If you want proper 24p the best way to get it is to shoot at 24p.
Abe Ford
2007 November 3rd, 12:19
asdfg
Abe Ford
2007 November 3rd, 12:21
Thanks for your reply and suggestions, LT. I have an upcoming shoot in 2 weeks which will indeed be done with two HV20's in 24p mode, but I am getting prepared for additional footage from a Sony HDV camera shooting in 60i.
The answer is yes. But I would advise against it.
The editing software I use is Avid Xpro, in particular, what they call a 23.976 Project- I won't be able to mix frame rates to include 60i stuff. That's why I asked about the conversion. (thanks VERY much btw for all your scripts and graphic tutorials- it's made all the difference and I now am finally comfortable with the idea of trying to learn AviSynth & the shooting in HV20's 24p mode).
I'm not sure what "judder" is or what it looks like & how objectionable it will be. Given that the 60i camera will not be doing quick pans and is just part of a mix of cameras, maybe it's not so bad?
Yes, I do intend to convert all 70-80 minutes of the 60i HDV footage to 24p, and I am prepared to have long overnight processing times with large storage requirements. I'll take my time editing this- it's my first 23.976 music Project.
I'm not sure what to do. I may follow your guarded AviSynth suggestions, or look for another pathway to 24p. Have you had a chance to look at the output from the DVFilmaker product? I trust your eyes. It seems this software is dedicated to converting 60i to 24p and is not that expensive if it is the best looking option.
Best Regards,
AF
lordtangent
2007 November 3rd, 14:58
Abe,
"Judder" is the visual effect of temporal inaccuracy between frames due to simple temporal rate conversion. It shows up like a mild (or not so mile depending on the case!) "stutter" in video. Here is a very comprehensive description of motion judder and what causes it on the MIcrosoft site:
http://www.microsoft.com/whdc/archive/TempRate.mspx
I don't have any experience with DVFilmaker. Looking at the website, I see no mention of motion compensation which would be required to fix the potential judder. They are probably just using smart de-lacing and frame dropping to make the "24p" from 60i. That works fine but you have to be aware that there probably will be judder.
I'm going to give the demo a try and see how it does. It might be worth the $145 for people who aren't inclined to use the free method (AVISynth and vDub). The way I look at it though, $145 is a long way towards getting an Intensity and that's the sort of thing I'd rather spend my money on...
Oh, I found a free way to do motion compensated 60i to 24p using AVISynth. (I've used the motion compensation plug-in mentioned in the post. It does work pretty well)
http://www.pana3ccduser.com/showthread.php?t=17206&page=1&pp=10
You could use HV20Pulldown.exe to automate the aplication of this script to many clips. (that's how I do slow mo myself)
Abe Ford
2007 November 4th, 12:28
Here is a very comprehensive description of motion judder and what causes it on the MIcrosoft site:
Thanks, LT that's a great link and from Microsoft no less.
I'm going to give the demo a try and see how it does. It might be worth the $145 for people who aren't inclined to use the free method (AVISynth and vDub). The way I look at it though, $145 is a long way towards getting an Intensity and that's the sort of thing I'd rather spend my money on...
Considering all the $$ and TIME you're saving us, I'd be quite happy to help fund your Black Magic testing. We're all gaining ground thanks to your labor-intensive tutorials. Tell us how to contribute, and I'm in.
Oh, I found a free way to do motion compensated 60i to 24p using AVISynth. (I've used the motion compensation plug-in mentioned in the post. It does work pretty well)
http://www.pana3ccduser.com/showthread.php?t=17206&page=1&pp=10
You could use HV20Pulldown.exe to automate the aplication of this script to many clips. (that's how I do slow mo myself)
I thought the skate boarder looked pretty good, good enough to try using the posted script and sticking with AviSynth. Thanks again, LT.
lordtangent
2007 November 5th, 03:04
Abe,
Thanks for the offer. But I don't feel right about taking money in this context. I write the tutorials for my brother and a couple of friends (they are lurkers here... not very vocal). I write them for myself also... just keeping notes but sharing them with anyone who is interested. If other people find the information useful, all the better.
IMHO, the best way you could contribute is by doing a tutorial yourself, or just sharing tips. I am by no means an expert. (In fact, someone just corrected me on Premiere being RGB only. It turns out since Premiere PRO, it's had native YUV processing also)
It sounds like you have a pretty be project coming up. I'd be interested to hear about how things go and what lessons you learn.
2Bdecided
2007 November 5th, 07:29
I did 50i>24p with motion blur here...
http://www.hv20.com/showthread.php?t=2876
...using an AVIsynth script. With that technique, it doesn't matter if you start with 50i or 60i.
The conversions are tortuously slow and imperfect. I don't like motion blur, but the imperfections will be more visible without it.
I vastly prefer 50i/60i, but if the target must be high quality 24p, you'd be mad not to shoot in 24p format to start with.
A simple (and very often used) bodge in PAL land is to shoot at 50i with a sensible shutter speed, deinterlace properly to 25p (fairly easy to get good results in reasonable time with AVIsynth) and slow down 4% if needed. We don't have your 60i>24p motion judder problem.
Cheers,
David.
Abe Ford
2007 November 5th, 08:21
Abe,
I write the tutorials for my brother and a couple of friends... If other people find the information useful, all the better.
It sounds like you have a pretty be project coming up. I'd be interested to hear about how things go and what lessons you learn.
Nothing better than that, I hear ya.
I am looking at the Avisynth script that was posted by the person in your Panasonic link, and having trouble with the idea of using m2t sources from HDV rather than an AVI file, which seems to be called for in his script.
Also, I'd like to "merge" that script's 60i-to-24p feature with the scaling, noise reduction and your colorspace script lines in your "Uber"script. I don't know how to do it-- my trick is to study the different scripts and try to extrapolate- but it doesn't always make sense to me. I'd rather just work with a "options-available" script like the kinds you have posted in order to
have one script that does it all, albeit with some minor tweaking. That's why I am so appreciative of your posts.
Here is what was posted on the Panasonic site:
AviSource("myclip.avi")
Bob(0) # (0=BFF, 1=TFF)
smoothfps(120)
changefps(23.976)
function smoothfps(clip source, float fps) {
fp=fps*100
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1)
cropped = source.crop(4,4,-4,-4) # by half of block size 8
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2)
return source.MVFlowFps2(backward_vec,forward_vec,backwar d_vec2,forward_vec2,num=int(fp),den=100, idx=1,idx2=2)
}
Sadly, this is all still very cryptic code to me-- I just don't have the brain for this anymore.
AF
Abe Ford
2007 November 5th, 08:40
I did 50i>24p with motion blur here...
http://www.hv20.com/showthread.php?t=2876
...using an AVIsynth script. With that technique, it doesn't matter if you start with 50i or 60i.
The conversions are tortuously slow and imperfect. I don't like motion blur, but the imperfections will be more visible without it.
I vastly prefer 50i/60i, but if the target must be high quality 24p, you'd be mad not to shoot in 24p format to start with.
A simple (and very often used) bodge in PAL land is to shoot at 50i with a sensible shutter speed, deinterlace properly to 25p (fairly easy to get good results in reasonable time with AVIsynth) and slow down 4% if needed. We don't have your 60i>24p motion judder problem.
Cheers,
David.
Hey David, thanks for adding your links and contributing to this thread. I would certainly be thrilled if you posted your Avisynth script- especially useful to me if it handles source footage from HDV. Looks like you did lot's of careful comparisons- thanks for including all of them plus source footage. I hope to download them, etc. later this week.
I agree that it's mad not to shoot in 24P if that's the editing format, but in my case, I need to accomodate a talented cameraman that does not use the HV20, so I feel I need to decide in advance if my shoot is ALL 60i or the HV20 version of 24P. I'm going with 24P because I'll be trying to take this
concert footage to a DVD when (if?) I get done editing. I will just process
one song at a time, even if it takes a month of overnights to get the full concert ready for 24p editing.
Best Regards and good luck on your videos,
AF
lordtangent
2007 November 5th, 17:50
I'd like to "merge" that script's 60i-to-24p feature with the scaling, noise reduction and your colorspace script lines in your "Uber"script.
That code would go after the loading, but before the noise reduction, color space conversion and scaling. I'll see if I have some time to integrate it, but since it's not a feature I imagine using myself my motivation level will be really low. ( Already toyed with that sort of re-timing and I wasn't happy enough with the results to make it a staple of my work-flow)
2Bdecided
2007 November 6th, 05:48
Abe Ford,
The trick you're missing is that you need to process your m2t files with a program called "DG Index" to create a ".d2v" index file which you can point AVIsynth to as a substitute for the actual m2t file. Don't panic - it's easy and quick...
http://neuron2.net/dgmpgdec/dgmpgdec.html
An alternative is to use the command “DirectShowSource” instead of “AVIsource” in the .avs file to pull in the m2t file directly via a directshow codec (e.g. download ffdshow and install it if you find this doesn't work by default). However, the DGindex method is supposedly better.
My code isn't that different from what you have. I'm using the agonisingly slow mcbob to bob the content - but you should stick with plain old bob() until you get it working, then you can track down all the stuff needed to make the (vastly superior) mcbob work.
Because it's so slow, I mcbob first, save that to a file, and then load that into a separate script to do the frame rate conversion. If you were to do it all in one script, it would look like this:
(This is what I do for no motion blur)
# If you put mvtools in the Avisynth plugins folder, it will auto load.
# If you put it somewhere else, you need something like this:
loadplugin("C:\Program Files\AviSynth 2.5\selected plugins\mvtools_1.8.4.0\mvtools.dll")
mpeg2source("HVD.2007-10-05 09-25-13 50i pan.d2v")
assumetff()
# This is the bob part:
mcbob()
# Get motion vectors (slow version)...
source=last
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1, divide=2,overlap=4,search=3)
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1, divide=2,overlap=4,search=3)
cropped = source.crop(4,4,-4,-4)
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2, divide=2,overlap=4,search=3)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2, divide=2,overlap=4,search=3)
# change frame rate (slow verssion)
source.MVFlowFps2(backward_vec,forward_vec,backwar d_vec2,forward_vec2,num=24,den=1,idx=1,idx2=2)
If you want motion blur, there's no way you can use the slow MVFlowFps2 on HD content to calculate all the intermediate frames to blur together - it'll take years. So instead, for motion blur, I use the slightly faster MVFlowFps to change the frame rate like this...
# Get motion vectors...
source=last
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1, divide=2)
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1, divide=2)
# Change frame rate and blur
# First, jump up to 600fps(!)
source.MVFlowFps(backward_vec,forward_vec,num=600, den=1,idx=1)
# Now blur +/-10 frames together
temporalsoften(10,255,255,mode=1)
# Change the number 10 above for more or less blur. 12 is equivalent to 1/48th shutter
# Now keep one in 25 frames, giving 24fps (since 600/25=24)
selectevery(25,0)
That gives the result I posted in the other thread.
Hope this helps. AVIsynth has a steep learning curve, and hv20.com is not the place to learn it - the real experts are over at the doom9 forums.
To start with, just DGindex an m2t file, use mpeg2source to load that file, save the script with just that line in it, and do whatever you are hoping to do with the script (e.g. drop it into VirtualDubMod to watch or transcode or save the result). When you have that working, progress onto more complex scripts. Get AVSedit to edit avs scripts: it colour codes everything!
Cheers,
David.
Abe Ford
2007 November 6th, 06:05
my motivation level will be really low. )
No problem, LT. I am still trying to tweak the input source to accomodate an hdv m2t source! According to "racer-x" from http://www.pana3ccduser.com/showthread.php?t=17206&page=1&pp=10
"I could do it with some HV20 footage shot at 60i if I change the imput line to DirectShowSource."
For now, I will be content just to get his basic script running with my hdvsplit m2t files.
Abe Ford
2007 November 6th, 06:18
Abe Ford,
The trick you're missing is that you need to process your m2t files with a program called "DG Index" to create a ".d2v" index file which you can point AVIsynth to as a substitute for the actual m2t file. Don't panic - it's easy and quick...
http://neuron2.net/dgmpgdec/dgmpgdec.html
Cheers,
David.
Thanks very much, David. I just read all your notes and now I feel confident I can eventually get ahead of this learning curve- panicfree. Have a great week.
AF
Abe Ford
2007 November 22nd, 00:27
As suggested, I have signed up at www.doom9.net, but they require 5 days before allowing Forum questions, so in the meantime I'd like to ask one here:
Turns out my 3cam shoot did not include a 60i HDV camera, so I had to use a locked-down 60i SD miniDV instead. I was trying to use the same script (above) to accomplish the 24p conversion, but I'm stumped with an error.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - -
AviSource("myclip.avi")
Bob(0) # (0=BFF, 1=TFF)
smoothfps(120)
changefps(23.976)
function smoothfps(clip source, float fps) {
fp=fps*100
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1)
cropped = source.crop(4,4,-4,-4) # by half of block size 8
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2)
return source.MVFlowFps2(backward_vec,forward_vec,backwar d_vec2,forward_vec2,num=int(fp),den=100, idx=1,idx2=2)
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --
The error message I get is "Avisynth Open Failure:"
MVAnalyse: clip must be YV12 or YUY2
The learning curve is really steep for me, but I'm still hoping I can make video magic happen. I can't find an error explanation online. Any ideas?
Thanks,
AF
2Bdecided
2007 November 22nd, 05:54
That's easy. Just put
converttoyv12(interlaced=true)
or
converttoyuy2()
after the AVIsource line. The second one is better.
(There are underlying issues here. It means your VideoForWindows DV codec isn't outputting in yuy2, but probably RGB. You're going to have to look at Reinterpolate411() and/or convertbacktoyuy2() for best quality, but just get it working first! You can google AVIsynth followed by either of these two without brackets.)
Cheers,
David.
Abe Ford
2008 April 12th, 09:33
Hello again folks- Well, I've used this script three times now and I am happy with the results on my 60i SD original footage. I just don't know what to write (or where in the script it goes) in order to get sync sound from an original uncompressed AVI. Is it even possible? Thanks for any suggestions!
-------------------------60i to 24P -----------------------------------
AviSource("myclip.avi")
converttoyuy2()
Bob(0) # (0=BFF, 1=TFF)
smoothfps(120)
changefps(23.976)
function smoothfps(clip source, float fps) {fp=fps*100
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1)
cropped = source.crop(4,4,-4,-4) # by half of block size 8
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2)
return source.MVFlowFps2(backward_vec,forward_vec,backwar d_vec2,forward_vec2,num=int(fp),den=100, idx=1,idx2=2)}
racer-x
2008 April 12th, 10:10
That's my script you're using there..................
It should work fine. As long as your original avi has audio in sync, it will remain that way when you process using that script.........
If you have audio sync problems, then it is off on the original avi.
Abe Ford
2008 April 12th, 12:03
Hi racer-x , they don't call you that for nuthin'. A big thank-you for getting this little gem out there. I will try making another AVI using a different capture device (your reply jogged my memory- my initial capture was done with Sorenson Squeeze and come to think of it, I actually DID get sound using your script when I used a differently captured AVI).
I'm having a codec moment, I guess.
btw, I got one of those Squeeze upgrade announcements for version5 and it looks like they are offering some kind of Reverse Pulldown filter:
------------------------------------------------------------------
Squeeze 5 Enhancements:
Increased Speed
Simultaneous multi-file encoding (1.5 files on each core)
Improved Video Quality
New Microsoft VC-1 codec for Blu-ray encoding
Improved MPEG1-2 and H.264 codecs
New video filters include watermark, hue and saturation, sharpen,
-----Improved filters include inverse telecine, deinterlacing----
??? sure, but will it work on HV20/30 files and what kind of output for editing????
For $199.00, I'm sticking with AviSynth and the global brain trust of developers, users and image processing crazies- besides, what fun is it just dragging and dropping a file on an icon?
2Bdecided
2008 April 14th, 06:26
If you're capturing from (mini)DV, then the codec should be DV AVI - i.e. a 1:1 digital transfer of what's on the tape via Firewire. Use WinDV if you can't find this option in your software.
Having thought about what you're doing, I agree with the comments in post 2(!) - you should consider filming the whole lot at 30p (or 60i deinterlaced to 30p) - far less painful then 60i>24p. But if you're happy with what you have now... (converting SD is much quicker than converting HD, so at least you've had that problem "solved" for you!). However, 30p won't convert well to "PAL" for an international release; here 24p is vital (though you probably don't want to 4% speed up to 25p for a music video - problems problems!).
Cheers,
David.
Abe Ford
2008 April 14th, 07:56
Thanks very much, 2BD. I couldn't have done it without you. On the codec/Squeeze issue- that's what I needed to hear and I'll look for an option within Squeeze to not use their Avi codec, or just move over to a different app for DV capture.
I am happy, even with the insanne render times (makes me wonder what I'm paying in AC per hour for my overnight renders)
but I have another question:
Since I'm ultimately mixing my DV footage with 1920x1080 HV20 footage (in AE), I not only need to turn the miniDV into 24P, but also increase its size, then crop to match. Right now I'm using AE to blow up the DV 24P avi and reposition interactively to do the cropping. I like having the wiggle room available, but is there a big quality hit that I wouldn't get if I did the zoom/crop in Avisynth while I'm making the initial 24P conversion? I hope that's clear...
I take your point about 30P, but I'm trying to learn HD & 24P with the HV20 and this music project is primarily for the web, maybe a DVD.
2Bdecided
2008 April 14th, 09:59
I not only need to turn the miniDV into 24P, but also increase its size, then crop to match.You mean it's 4x3?! (where's the little smiley being sick?). And you're in an NTSC country (SD=480 rather than 576). And you're deinterlacing it. And you're doing motion compensated stuff. And you're blowing up to 1920x1080?!
To crop to 16x9 keeps 360 lines. You deinterlace, so you have 180 "real" lines and 180 "made up" lines. You motion compensate, so much of the time you only have "made up" lines! Then you blow up the result to 1080.
The result could be horrible, and can't be great. You might be wasting your time editing it in HD, as these sections must stick out a mile. Unless you use it as some kind of special effect?
this music project is primarily for the web, maybe a DVD.OK, you might get away with it for the web. 4x3 cropped and resized to anamorphic 16x9 isn't really good enough for a DVD (though you do see releases with content encoded this way - it depends how professional you want to look).
However, I understand that learning how to do the job, playing around, experimenting and having fun, can be far more important than the final result. I do projects like that all the time!
Cheers,
David.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.