View Full Version : resize PAL 1080i to PAL DVD 576i or 576p ?
halsboss
15th September 2007, 02:48
Hi, a local article http://www.ebroadcast.com.au/enews/ten-hd-140907.html says
... will provide more variety to free-to-air viewers than ever before. xxx is the only Australian network transmitting the globally-recognised pinnacle HD broadcast standard: 1920 pixels by 1080 lines interlaced (1080i)
So to xfer .TS captures to DVD for later watching on a HDTV, I guess it needs resizing to PAL 576i or 576p. Is there a smart CPU-quick way to achieve this ? I think I have to deinterlace it to resize so ending up with PAL 576p and poke that into HC :-
# input = HDTV 1080i = 1900x1080 interlaced
mpeg2source("D:\HDTV\capture.d2v")
AssumeFPS(25)
AssumeTFF()
#TDEINT(mode=0,order=1) # mode=0=same rate output mode=1=double rate output (bobbing) order=0=BFF order=1=TFF
Yadif(mode=0,order=1) # mode=0=deinterlace mode=1=doubleframerate, order=0=BFF order=1=TFF
lanczos4resize(720,576)
Converttoyv12()
SetPlanarLegacyAlignment(True)
Is there a nicer/faster way for 1080i to 576p ?
Also, I guess to go to from 1080i to 567i for "more motion fluidity",
# input = HDTV 1080i = 1900x1080 interlaced
mpeg2source("D:\HDTV\capture.d2v")
AssumeFPS(25)
AssumeTFF()
#TDEINT(mode=1,order=1) # mode=0=same rate output mode=1=double rate output (bobbing) order=0=BFF order=1=TFF
Yadif(mode=1,order=1) # mode=0=deinterlace mode=1=doubleframerate, order=0=BFF order=1=TFF
Lanczos4Resize(720,576)
AssumeTFF()
SeparateFields()
SelectEvery(4,0,3) # top field first
Weave()
Converttoyv12(interlaced=true)
SetPlanarLegacyAlignment(True)
Similar question, is there a nicer/faster way for 1080i to 576i ?
The reason for the queries was a hope that there might be some nice "tricky" sort of quick way.
DrP
16th September 2007, 22:16
You may well find that quite a lot of the programming is effectively progressive if you ignore the flags in the video, so a simple resize will be all that's needed to make it into 576p25. That might leave you with a bit of nastiness when the station popups appear if they really are interlaced, but apart from that it should work well enough.
For content that really is interlaced, leave it interlaced. Separate the 1080i fields, resize them to 288 and weave them back together. Nothing more complicated than that is really needed to convert i to i.
2Bdecided
17th September 2007, 10:30
For 1080p, just resize.
For 1080i, what you have is fine, but bob() is more than good enough when the destination is 576i.
For some content, lanczos4resize is a bit too sharp vertically if you're going to watch on an interlaced display. Add a slight vertical soften, but only if you see this issue. No point making the content soft otherwise.
Cheers,
David.
halsboss
17th September 2007, 11:40
For content that really is interlaced, leave it interlaced. Separate the 1080i fields, resize them to 288 and weave them back together. Nothing more complicated than that is really needed to convert i to i.
Good-oh, a "quick trick" to avoid deinterlacing for downsizing PAL HD 1080i to DVD-compatible SD 576i ! You mean like this ?
# input = HDTV 1080i = 1900x1080 interlaced
mpeg2source("D:\HDTV\capture.d2v")
AssumeFPS(25)
AssumeTFF()
SeparateFields()
Lanczos4Resize(720,288)
Weave()
Converttoyv12(interlaced=true)
SetPlanarLegacyAlignment(True)
lanczos4resize is a bit too sharp vertically
Thanks, David. Ah, so for my purpose of downsizing, would the quickest resizer be the most appropriate (does downsizing perceptually sharpen, so resizer softening shouldn't be a problem ?) ... hmm... maybe PointResize instead of Lanczos4Resize ?
Now, to worry about the aspect ratio ... I guess HD 1080i is 16:9 and 576i-widescreen is 16:9 to so a straight PointResize(720,576) should be OK ?
Cheerio
PS David, "in 2001 a space odyssey" what was HAL's on-ship human master's name ? :D
EDIT: Well blow me down ! This old 2005 thread http://forum.doom9.org/showthread.php?p=598892#post598892 discusses PAL HDi -> SDi although the above technique "works, but with a little vertical bobbing" it asks for a quick fix... The things I don't "get" are
1. it says 1080i is 1920x1088 ... 1088 vertically ? ... and hence includes a Crop(0, 0, 0, -8) #Because the source stream is 1920x1088 px
2. and a colourspace conversion of some kind ?
BT709ToBT601()
halsboss
17th September 2007, 12:30
In http://forum.doom9.org/showthread.php?p=988009#post988009 and http://forum.doom9.org/showthread.php?p=1024770#post1024770 the masterly scharfis_brain explains with a sample script (NTSC admittedly) re speeding up deinterlacing for resizing !
Based on this I think it's - horizontally resize, then deinterlace over less area, then vertically resize, and lastly reinterlace ... if multi-pass encoding (I usually don't with HC) then save to a lossless .AVI 1st and then poke that into your favourite encoder which saves re-doing the script in each pass, I guess ?
# input = HDTV 1080i = 1900x1080 interlaced
mpeg2source("D:\HDTV\capture.d2v")
AssumeFPS(25)
AssumeTFF()
converttoyuy2()
# Not sure why 704 and addborders(8,0,8,0) so I naively changed it to 720.
bicubicresize(720,height)
#TDEINT(mode=1,order=1) # mode=0=same rate output mode=1=double rate output (bobbing) order=0=BFF order=1=TFF
Yadif(mode=1,order=1) # mode=0=deinterlace mode=1=doubleframerate, order=0=BFF order=1=TFF
bicubicresize(width,576)
AssumeTFF()
SeparateFields()
SelectEvery(4,0,3) # top field first
Weave()
Converttoyv12(interlaced=true)
SetPlanarLegacyAlignment(True)
Ah, the reason for not preferring straight separatefields and resizing is mentioned in here http://forum.doom9.org/showthread.php?p=989128#post989128 (stairstepping and scharfis_brain's blood pressure).
DrP
17th September 2007, 20:42
Ah, the reason for not preferring straight separatefields and resizing is mentioned in here http://forum.doom9.org/showthread.php?p=989128#post989128 (stairstepping and scharfis_brain's blood pressure).
Personally I've never noticed a lot of stair stepping comparing a simple field resized HD broadcast compared a SD version of the same program.
DrP
17th September 2007, 20:46
1. it says 1080i is 1920x1088 ... 1088 vertically ? ... and hence includes a Crop(0, 0, 0, -8) #Because the source stream is 1920x1088 px
2. and a colourspace conversion of some kind ?
BT709ToBT601()
Do you need the BT709toBT601 conversion? That depends entirely on what you use to encode to MPEG2 and any intervening processing. If you use tools that expect BT709 all the way through then its not needed. As a warning, not all networks in Australia transmit BT709. WIN's SD for example is BT.470.
halsboss
18th September 2007, 12:50
Nice pickup, DrP. Will leave the colourspace conversion out and hope for the best.
Still not sure about the 1088 - many later posts seem not to have that in, so I''ll ignore that too and assume 1080.
Think I'll give both techniques (interlaced/separatefields resizing vs deinterlaced resizing) a go to compare speed and visual results for Adelaide Australia TV shows... It might be worth a speed tradeoff for some if I'm not after perfection every time.
2Bdecided
18th September 2007, 14:46
The 1088 is decoder (and encoder?) dependent. MPEG macroblocks are 16x16, so there must be 1088 pixels in the stream. However, the headers will (usually) define the picture area as 1080 pixels high, to match the input. Some decoders ignore this, and output all pixels - the encoded ones, and the junk.
Just use info() after the input to check.
Cheers,
David.
halsboss
20th September 2007, 13:39
Well, here's the results from an AMD64 3500+, 1Gb ram, 200Gb disk, DigitalNow TinyTwin HDTV capture, VideoReDoPlus edited.
Test clip - Adelaide channel 10 1080i HD 1500 frames 90,618kb, with AVS scripts plugged into HC 021 with .INI file
*INFILE D:\HDTV\1080i-to-576i.avs
*OUTFILE D:\HDTV\1080i-to-576i-output.mpv
*LOGFILE D:\HDTV\1080i-to-576i-output.log
*INTERLACED
*TFF
*PROFILE BEST
*ASPECT 16:9
*BIAS 30
*BITRATE 9200
*MAXBITRATE 9400
*LASTIFRAME
*AUTOGOP
*CLOSEDGOPS
*DC_PREC 10
*LUMGAIN 3
*CQ_MAXBITRATE 2
*MATRIX MPEG
1. Deinterlacing using Yadif then re-interlacing
LoadPlugin("C:\SOFTWARE\DGindex\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins-dcw\TDeint.dll")
Load_Stdcall_plugin("C:\Program Files\AviSynth 2.5\plugins-dcw\Yadif.dll")
# input = HDTV 1080i = 1900x1080 interlaced
mpeg2source("D:\HDTV\1080i-to-576i.d2v")
AssumeFPS(25)
AssumeTFF()
A=LAST
# type 1 conversion - deinterlaced
A=A.converttoyuy2(interlaced=true)
A=A.bicubicresize(720,A.height)
#A=A.TDEINT(mode=1,order=1) # mode=0=same rate output mode=1=double rate output (bobbing) order=0=BFF order=1=TFF
A=A.Yadif(mode=1,order=1) # mode=0=deinterlace mode=1=doubleframerate, order=0=BFF order=1=TFF
A=A.bicubicresize(A.width,576)
A=A.AssumeTFF()
A=A.SeparateFields()
A=A.SelectEvery(4,0,3) # top field first
A=A.Weave()
A=A.Converttoyv12(interlaced=true)
A
SetPlanarLegacyAlignment(True)
2. "interlaced" resizing
LoadPlugin("C:\SOFTWARE\DGindex\DGDecode.dll")
B=B.converttoyuy2(interlaced=true)
B=B.SeparateFields()
B=B.bicubicresize(720,288)
B=B.Weave()
B=B.AssumeTFF()
B=B.Converttoyv12(interlaced=true)
B
SetPlanarLegacyAlignment(True)
3. And, for good measure, an example FFMPEG interlaced conversion (this version http://ffdshow.faireal.net/mirror/ffmpeg/ffmpeg.rev10464.7z) using this .BAT command file
set fINPUT=D:\HDTV\1080i-to-576i.mpv
set fOUTPUT=D:\HDTV\1080i-to-576i-OUTPUT-ffmpeg.mpv
set fSIZE=720x576
set fASPECT=16:9
set fMAXBITRATE=9200k
"C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -target pal-dvd -ilme -ildct -flags +ildct+ilme -top 1 -sameq -maxrate %fMAXBITRATE% -dc 10 -s %fSIZE% -aspect %fASPECT% -an "%fOUTPUT%"
PAUSE
Results :-
1. Yadif deinterlacing,
pass1 encoding time: 0:04:34 (274 s)
fps: 5.5
total CPU time: 0:04:34 (274 s)
nr. of gops: 117
nr. of frames: 1500
nr. of I-frames: 117
nr. of P-frames: 535
nr. of B-frames: 848
average bitrate: 8353
minimum bitrate: 7166
maximum bitrate: 9386
bytes in bitstream: 62668460
bits in bitstream: 501347680
average Quantizer: 2.891
total elapsed time: 0:04:35 (275.30 s)
2. "interlaced" resizing
pass1 encoding time: 0:03:06 (186 s)
fps: 8.1
total CPU time: 0:03:06 (186 s)
nr. of gops: 118
nr. of frames: 1500
nr. of I-frames: 118
nr. of P-frames: 534
nr. of B-frames: 848
average bitrate: 8398
minimum bitrate: 7289
maximum bitrate: 9382
bytes in bitstream: 63006590
bits in bitstream: 504052720
average Quantizer: 2.834
total elapsed time: 0:03:07 (187.23 s)
3. FFMPEG interlaced resizing
fps=22 (not sure how to measure cpu time and elapsed time of a line in a .BAT file)
bitrate=6945.7 (reported by ffmpeg, is the average I guess)
filesize=52,058,112
Visually, option 3 seems comparable with 1 and 2 at first glance.
So given the relative processing speeds, I'm going to punt for ffmpeg for things I'm feeling average about and only for "great gear" will I use the the option 1 avisynth/HC combo. Happy to be talked out of it if anyone knows better. :)
PS I bought VideoRedo upon Pookie's recommendation, to cut out "uninteresting" bits of 1080i HD captured clips before down-encoding to SD for authoring into DVD.
zambelli
21st September 2007, 09:48
A=A.converttoyuy2(interlaced=true)
When reading a .d2v source you should just use MPEG2Source(upconv=true) instead. That will do motion-adaptive upsampling which means any progressive frames will get upsampled using the progressive algoritm.
2. "interlaced" resizing
B=B.SeparateFields()
B=B.bicubicresize(720,288)
This could cause slight line shimmering, but in all likelihood nobody would ever notice.
halsboss
21st September 2007, 12:20
This could cause slight line shimmering, but in all likelihood nobody would ever notice.
Thanks, that'd be scharfis_brain's blood pressure thing, then. Looked "close enough" for "ordinary" material I guess... personal preferences on speed vs quality & "content-value".
zambelli
30th September 2007, 03:14
Thanks, that'd be scharfis_brain's blood pressure thing, then. Looked "close enough" for "ordinary" material I guess... personal preferences on speed vs quality & "content-value".
An alternative would be to use Bob(height=288).
halsboss
20th October 2007, 02:04
http://forum.doom9.org/showthread.php?p=1056919#post1056919 shows latest ffmpeg options, and commandline which converts an extracted PAL HDTV interlaced 1080i video stream into a DVD-compatible PAL SD interlaced 576i video stream ready for DVD authoring...
"C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i inputfile.mpv -target pal-dvd -ilme -ildct -flags +ildct+ilme -top 1 -sameq -maxrate 9400k -dc 10 -s 720x576 -aspect 16:9 -an outputfile.mpv
which seems close enough for some ordinary conversions.
halsboss
16th December 2007, 01:00
Now ... to encode the audio...
scharfis_brain
16th December 2007, 01:32
separatefields().resize().weave()
http://home.arcor.de/scharfis_brain/samples/chr-sep-res-wv.png
vs.
bob().resize().reinterlace()
http://home.arcor.de/scharfis_brain/samples/chr-bob-res-reintl.png
is just not my blood pressure.
and replacing bob with a motion adaptive deinterlacer will squeeze out even more image detail!
also you will want to resize in two steps to improve speed by at least a factor of 2!
source("blah.xxx")
resize(704,height)
anybob()
resize(width, 576)
separatefields().selectevery(4,0,3).weave() #reinterlace
halsboss
16th December 2007, 01:34
no offense meant, oh wise one ... it was a throwaway allusion line from elsewhere... nice pics on your website.
If you have some FPS enhancing magic (refer results above http://forum.doom9.org/showthread.php?p=1046975#post1046975 ) there'd be people falling about right and left to use it.
Guest
16th December 2007, 01:42
no offense meant, oh wise one ... Knock off the sarcasm and references to people's blood pressure, else rule 4's are looming. And if you want to discuss it, do it in PM, not here.
halsboss
20th December 2007, 09:20
You mis-interpret ! No sarcasm at all ! It was an admiration/respect statement based on scharfis_brain posting history and respect from others. No more posting from me !!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.