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 |
6th September 2013, 10:21 | #1 | Link |
Registered User
Join Date: Jun 2012
Posts: 5
|
Good compromise on speed/quality for 1080i 25fps to PAL resize script?
Howdy.
I've received over eight hours worth of MXF files (1080i 25fps, mpeg-2, AES audio) that need to be encoded for PAL DVD. The normal safe/tedious workflow we use is to transcode using Episode to ProRes Quicktime, play out and downsize to PAL using a blackmagic card -> blackmagic card, then encode. However, I'm convinced I can more efficient results using avisynth to resize these, but there seems to be so many different methods out there. I wondered if anyone had a fairly fast but good quality method for parsing 1080i 25fps mxf files for PAL MPEG-2 encoding? I've used the hd2sd script before, but it's slow as hell (I don't have several days to encode) and I've ended up with some horrible aliasing artifacts/jitter, especially on vertical pans (even with a failry heavy vertical blur). I also tried using just a spline resize with a blur, which seemed to give good results and was fast but I'm concerned what it's doing with the fields. I'm now playing around with various scripts and running test, but it seems debatable whether to: a) deinterlace->resize->reinterlace b) separate fields->resize->reinterlace c) hd2sd with blur d) just resize and let the encoder (Totalcode or HCenc) deal with interlacing and cross fingers Anyone have a tried and tested methods? I seem to be going round in circles here. |
6th September 2013, 11:19 | #2 | Link |
Registered User
Join Date: Jan 2006
Location: Finland
Posts: 134
|
Since you are going down from a high resolution to a low one, in my opinion a simple bob()/yadif() + reinterlacing should do just fine. Try something like
Code:
xxxSource("...") bob() # or yadif(mode=1) bicubicresize(720,576) blur(0, 0.5) # not required, but some vertical blur may look nicer in the final image, experiment separatefields() selectevery(4, 0, 3) weave() Last edited by ajk; 6th September 2013 at 21:57. Reason: fixed |
6th September 2013, 15:12 | #3 | Link |
Registered User
Join Date: Jun 2012
Posts: 5
|
Thanks, I'll give this a go.
The original mxf is top field according to Mediainfo. There's some quite nasty line flicker on some vertical scrolling credits at the end (which is apparent in the source as well), which I'm hoping is just a computer monitor/interlacing issue. |
6th September 2013, 20:28 | #4 | Link | ||
Registered User
Join Date: Dec 2007
Location: Germany
Posts: 632
|
Quote:
The first thing you should check is if the source files actually do show interlacing (in contrast to a tool reporting interlacing). The result is either 1) yes, all the time 2) no, only certain parts 3) no, never. In case of 1) and 2) you want to keep the interlacing and need to account for it. In case of 3) you can ignore what the flags say and pretend it's all progressive. However, if you're not 100% sure about 3) then go for the interlaced route because you absolutely don't want to blend any fields during resizing. Quote:
When it comes to lowpassing the lines vertically after resizing, at first it may seem odd but except for computer animated sources it's recommendable to have Blur() followed by Sharpen(). What this actually does is it "thickens" the vertical details a bit instead of just blurring them together. This is what I would recommend: Code:
#[Pick one line] Blur(0, 0.6, false) Sharpen(0, 0.4, false) #this is very mild Blur(0, 0.7, false) Sharpen(0, 0.4, false) #good starting point Blur(0, 0.8, false) Sharpen(0, 0.5, false) #for very sharp sources Last edited by TheSkiller; 6th September 2013 at 22:39. |
||
6th September 2013, 21:41 | #6 | Link |
Registered User
Join Date: Dec 2007
Location: Germany
Posts: 632
|
You don't need either actually, instead you should specify the desired field order of the output.
Replace AssumeFrameBased() with AssumeTFF() or AssumeBFF(). Also, you don't need interleave(selectodd(), selecteven()) it doesn't do anything at all, except wasting CPU cycles. |
6th September 2013, 21:57 | #7 | Link |
Registered User
Join Date: Jan 2006
Location: Finland
Posts: 134
|
Yeah, I've just now actually ran the script on a clip, shouldn't answer threads when at work... Of course bob() leaves the clip in the frame based state already and the interleaving is performed by the selectevery(). Updated the script again.
|
9th September 2013, 13:40 | #8 | Link |
Registered User
Join Date: Jun 2012
Posts: 5
|
Thanks for the advice.
So, here's my final script: Code:
FFVideoSource("myVideo.mxf) Load_Stdcall_Plugin("C:\..\yadif.dll") AssumeTFF() Yadif(mode=1) BicubicResize(720,576) Blur(0, 0.6, false).Sharpen(0, 0.4, false) ConvertToYV12() separatefields() selectevery(4, 0, 3) weave() I also need to convert to YV12 for the encoder. I've put this before it's re-interlaced. Is this correct? |
9th September 2013, 19:51 | #9 | Link |
Registered User
Join Date: Dec 2007
Location: Germany
Posts: 632
|
Yes, the script is fine, ConvertToYV12() can be put before the re-interlacing lines.
Before you start encoding, to make sure the field order is correct (believe me, you really should test this), you may add Bob() at the end of the script, open the script in VirtualDub and play back the part with the interlaced credits. If the motion is fluid you can remove Bob() and encode with Top Field First setting. |
11th September 2013, 12:00 | #10 | Link |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
Simple BicubicResize is unnecessarily soft in the horizontal domain. You want to try to maintain as much horizontal sharpness as possible. lanczosX, splineX, etc. Or something even more clever (though that would slow things down).
Cheers, David. |
12th September 2013, 12:32 | #11 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,731
|
Didée came up with a brilliant idea for using BicubicResize when downsizing. Play with the b and c parameters, like BicubicResize(720,576,-0.6,0.3). When I resize 1080p stuff to 720p, I usually end up with having c between 0.2 and 0.35, b is 2*c and negative.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
16th September 2013, 04:47 | #13 | Link |
Registered User
Join Date: Mar 2004
Posts: 889
|
with reference to http://forum.doom9.org/showthread.ph...25#post1177125, & provided that the MXF files contain true interlaced footage:
Code:
Global NewWidth = 704 Global NewHeight = 576 xxxSource(.....) # Pick the right one manually: AssumeTFF() #AssumeBFF() SeparateFields() Shift = (GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0) E = SelectEven() . Spline36Resize(NewWidth, NewHeight/2, 0, Shift) O = SelectOdd() . Spline36Resize(NewWidth, NewHeight/2, 0, -Shift) Echr = SelectEven() . Spline36Resize(NewWidth, NewHeight/2, 0, 2*Shift) Ochr = SelectOdd() . Spline36Resize(NewWidth, NewHeight/2, 0, -2*shift) Interleave(E, O) IsYV12() ? MergeChroma(Interleave(Echr, Ochr)) : Last Weave() |
19th September 2013, 16:23 | #14 | Link |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
The separated fields resizing trick above DOUBLES the height of any resizer artefacts/effects/etc compared with the bob/resize/re-interlace approach. You may find that to be a good or bad thing, but it certainly changes the decision of which resizer and parameters to use.
I think it limits the final vertical resolution to half that for a full frame. With interlaced content, if you maintained full vertical resolution it would twitter/shimmer like mad, but going down to half is a little brutal IMO. Cheers, David. |
19th September 2013, 20:13 | #15 | Link |
Registered User
Join Date: Dec 2007
Location: Germany
Posts: 632
|
I agree with 2Bdecided. The field based approach seems impractical considering a plain ultra fast Bob() provides better results...
I'm not sure if a field based resize results in vertical resolution cut in half, but it sure gives a very soft vertical. If it does reduce the vertical resolution to half or less it would make that whole interlacing affair redundant – you might as well store the video as 288p/240p then. Yeah you can't put that on DVD but the point is one really needs to find that sweet spot of vertical resolution that looks good: detailed, but not so much that it results in pronounced line twitter and aliasing (hence my Blur-Sharpen recommendations in post #4). Last edited by TheSkiller; 19th September 2013 at 20:16. |
30th September 2013, 16:45 | #16 | Link | |
Registered User
Join Date: Jun 2012
Posts: 5
|
Thanks for the suggestions.
So, I've tried out the original suggestions by TheSkiller and the updated chroma/luma script by henryho_hk but we're always seeing some bad horizontal line shimmer/wobble on both interlaced broadcast monitors and progressive LCD TVs (despite increasing the amount of blur). To be honest, although I'm a bit paranoid about what it's doing with the fields, this script seems to give the best quality (can't see any difference in movement either) on both displays: Quote:
Any ideas? |
|
30th September 2013, 19:17 | #18 | Link |
brontosaurusrex
Join Date: Oct 2001
Posts: 2,392
|
If it is progressive then something like this should give you some speed boost, (if it is interlaced its probably not worth bothering with anyway);
SeparateFields().SelectEven().BilinearResize(720,576) (If there are short burst of interlaced stuff, this will take care of that as well, since we are only taking "one field")
__________________
certain other member Last edited by smok3; 30th September 2013 at 19:20. |
30th September 2013, 19:26 | #19 | Link |
brontosaurusrex
Join Date: Oct 2001
Posts: 2,392
|
If it is progressive then something like this should give you some speed boost, (if it is interlaced its probably not worth bothering with anyway);
SeparateFields().SelectEven().BilinearResize(720,576)
__________________
certain other member |
30th September 2013, 19:41 | #20 | Link | ||
Registered User
Join Date: Dec 2007
Location: Germany
Posts: 632
|
Quote:
Sorry, I should have explained where to put it. Quote:
henryho_hk's suggestion is almost what you want: Code:
#1080i 25fps ProRes source Bob() Spline16Resize(720,576) Blur(0, 0.6, false).Sharpen(0, 0.3, false) ConvertToYV12() AssumeTFF() #for Top Field First OR: #AssumeBFF() #for Bottom Field First output SeparateFields().SelectEvery(4,0,3).Weave() Problem is, like you've mentioned, this totally throws away one field. In case of fast scrolling interlaced credits for example, this will make them appear like a strobe and it'll be hard and annoying to read. Since we're going to make an interlace-enabled DVD anyway, this is not recommended imo. Last edited by TheSkiller; 30th September 2013 at 19:52. |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|