View Full Version : Cropping Video
EpheMeroN
16th July 2008, 09:10
I always thought when you cropped for dvd conversion, you had to AddBorders(x,x,x,x) to maintain proper AR.
Yet when I Crop(8,8,-8,-8) and AddBorders(8,8,8,8) to this 704x480 source everything becomes slightly squished inward. Am I doing something wrong?
NOTE: For whatever reason you can't tell any difference with the two photos, but when source and then filtered video are played back in software players there's a clear difference.
SOURCE:
http://img87.imageshack.us/img87/5632/sourcelc3.jpg
WITH SCRIPT:
http://img87.imageshack.us/img87/6455/editedyu9.jpg
AND THE SCRIPT I AM USING:
LoadPlugin("C:\Multimedia\AviSynth 2.5\Plugins\DGDecode.dll")
LoadPlugin("C:\Multimedia\AviSynth 2.5\Plugins\NicAudio.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\TDeint.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\DeBlock.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\FFT3DFilter.dll")
Video1 = MPEG2Source("C:\Users\User1\Desktop\cc08p.d2v")
\ .Crop(8,8,-8,-8).TDeint(1,1).DeBlock(quant=30, aOffset=0, bOffset=0).AddBorders(8,8,8,8)
\ .FFT3DFilter(sigma=1.8, bt=5, bw=32, bh=32, ow=16, oh=16, ncpu=2)
\ .SeparateFields().SelectEvery(4,0,3).Weave()
Audio1 = NicAC3Source("C:\Users\User1\Desktop\cc08p T80 2_0ch 128Kbps DELAY 0ms.ac3")
\ .Normalize(0.95)
AV2 = AudioDub(Video1,Audio1).Trim(0,40046).FadeIn0(10).FadeOut0(5)
AV3 = AudioDub(Video1,Audio1).Trim(40047,69376).FadeIn0(5).FadeOut0(5)
AV4 = AudioDub(Video1,Audio1).Trim(69382,99140).FadeIn0(5).FadeOut0(5)
AV5 = AudioDub(Video1,Audio1).Trim(99144,128743).FadeIn0(5).FadeOut0(5)
AV6 = AudioDub(Video1,Audio1).Trim(128745,150836).FadeIn0(5).FadeOut0(12)
Blank1 = BlankClip(AV2).Trim(0,59).Amplify(0.0)
Blank2 = BlankClip(AV2).Trim(0,26).Amplify(0.0)
AlignedSplice(Blank1,AV2,Blank2,AV3,Blank2,AV4,Blank2,AV5,Blank2,AV6,Blank1)
J_Darnley
16th July 2008, 10:53
When you say the source video, do you mean the MPEG video, or the script without the crop and addborders? The MPEG video will be scaled to get the correct aspect ratio but the script will not because AviSynth scripts do not have any aspect ratio information. Those pictures you posted don't have any AR distortion.
mikeytown2
16th July 2008, 11:08
I am assuming that your target is DVD since you used 704x480. You might have 16:9 instead of 4:3 checked on your encoder. If the above is square pixels then you need to convert them in order to encode it properly.
Edit: Took out info that is most likely useless.
smok3
16th July 2008, 11:14
but this is 4:3 and when converting 4:3 to 4:3 (same res and PAR), what is there to calculate? (and there is no squashing, maybe the black border makes that appearance?)
mikeytown2
16th July 2008, 11:27
704/480 is 1.46. If the source somehow is square pixels, then he needs to convert it in order to have it look right on a dvd. If its 4:3 then no conversion is needed.
smok3
16th July 2008, 11:30
well, its not square, so its not 1.46 either...
mikeytown2
16th July 2008, 11:37
Yeah i agree with smok3 that this is 4:3. As for the squishing, what encoder are you using? Could it have 720x480 hard coded in, thus the slight error?
Quick Comparison of 2 pics in first post, 3rd is the hypothesis
a = ImageReader("sourcelc3.jpg").BicubicResize(640,480)
b = ImageReader("editedyu9.jpg").BicubicResize(640,480)
c = ImageReader("editedyu9.jpg").AddBorders(8,0,8,0).BicubicResize(640,480) #720x480
Interleave(a,b,c)
EpheMeroN
16th July 2008, 21:53
When you say the source video, do you mean the MPEG video, or the script without the crop and addborders?
Source video = source MPEG video
I am assuming that your target is DVD since you used 704x480. You might have 16:9 instead of 4:3 checked on your encoder.
Yes. Target is DVD. 704x480 was the original source's resolution. I had 4:3 checked in encoder.
f its 4:3 then no conversion is needed.
I'm re-encoding video to filter it. Otherwise I would've totally left it alone.
Yeah i agree with smok3 that this is 4:3. As for the squishing, what encoder are you using?
I'm using CCE v2.70 to encode this project.
EpheMeroN
16th July 2008, 21:55
Could the squishing be happening because of my placement of AddBorders(8,8,8,8) in my script?
I just noticed I had it placed before I re-interleaved the video.
EpheMeroN
16th July 2008, 22:00
http://www.mediafire.com/?r3lw9wwyegg
smok3
16th July 2008, 22:41
a. better post your encoded video, i cant see what could be wrong with script (well, your screenshots confirm that nothing is wrong)
b. what software players did you try? (what happens if you force 4:3 in media player classic for example)
is this source some sort of DVB source? (i can't believe how crappy it looks)
EpheMeroN
17th July 2008, 00:19
a. better post your encoded video, i cant see what could be wrong with script (well, your screenshots confirm that nothing is wrong)
b. what software players did you try? (what happens if you force 4:3 in media player classic for example)
is this source some sort of DVB source? (i can't believe how crappy it looks)
Encoded video sample here: http://www.mediafire.com/?g9mrrxclexe
I tried playback in MPC (yes, even with 4:3 forced) and VLC software players. Both show video squished.
Source is from a digital cable channel. Blame my provider for that god awful heavy compression they tend to use on smaller networks like G4.
smok3
17th July 2008, 12:50
yes, as you see your encoded sample became 720x480 for some reason.
EpheMeroN
18th July 2008, 01:18
yes, as you see your encoded sample became 720x480 for some reason.
Is this a bug in CCE?
I'm going to run a test encode with the same script but using HC Encoder later to see if the output resolution is 704x480 or 720x480.
45tripp
18th July 2008, 02:13
define bug.
i'd stab at a guess that you're using 2.7sp and have dvd compliancy ticked.
untick it.
wouldn't want to halt your effort to try HC though.
HC will output what you give it.
use it.
tripp
discofever
18th July 2008, 07:09
i'd stab at a guess that you're using 2.7sp and have dvd compliancy ticked.
untick it.
As ttripp said, untick the 'for dvd box' on the main settings screen, and double check your 'area settings' as well
EpheMeroN
18th July 2008, 13:04
Is this what you guys are referring to in CCE?
http://img379.imageshack.us/img379/3323/61835955bc1.jpg
And yes, I am using CCE 2.7 SP.
Alex_ander
18th July 2008, 13:52
Yes. This setting forces outer frame size 720x480 for NTSC framerate. If your input video has lower frame size and the CCE 'Resize' checkbox (just under, with 720x480 suggested) is clear, then the encoded video will be centered in 720x480 frame and will get additional (to those from script) black borders. So if you want 704x480, uncheck both 'For DVD' and 'Resize' boxes in case your script settings provide that picture size (or you can leave just 'For DVD' checked to get 704x480 + 2x8 pxl borders inside 720x480 which is also OK). Anyway don't use resizing since your video is interlaced.
The proportions in your caps come from NTSC 'stored' AR which is ~3:2 and is exactly 4:3 at playback, so it's OK that you see them different while playing.
EpheMeroN
21st July 2008, 05:06
Well, unchecking that option in CCE corrected the AR issue I was having. It really was never an issue in AviSynth!
But, now I did notice an issue with my script. When I am joining my trims together, I was trying to place a blank clip in-between segments of 26 blank black frames, yet they aren't there. Why are the Blank2 = BlankClip(AV2).Trim(0,26).Amplify(0.0) not working when I do something like AlignedSplice(Blank2,AV2,Blank2) ?
EpheMeroN
21st July 2008, 23:12
Is there a bug in BlankClip by calling it twice? I can't figure out why it's not working correctly.
mikeytown2
21st July 2008, 23:17
This works for me....
vid = ColorBars().Trim(0,999)
Blank2 = BlankClip(vid, 26) #26 frames
Blank2 ++ vid ++ Blank2
BlankClip (http://avisynth.org/mediawiki/BlankClip)
EpheMeroN
21st July 2008, 23:55
If you look at my script though, Blank1, which only gets inserted at the beginning and end of the video, works fine with the 59 frames I allocated to it. It's just the Blank2 insertions that aren't working. This type of template script used to work all the time.
mikeytown2
22nd July 2008, 00:02
try adding
Blank2 = Blank2.ShowFrameNumber()
and report back what is wrong. We need more details on what is "wrong". what is blank2 doing/not doing that is wrong?
EpheMeroN
23rd July 2008, 01:48
try adding
Blank2 = Blank2.ShowFrameNumber()
and report back what is wrong. We need more details on what is "wrong". what is blank2 doing/not doing that is wrong?
Where would I put that in my script?
Gavino
23rd July 2008, 03:11
Where would I put that in my script?
Put it right after the line where you originally define blank2. It will help to show you if/when/where blank2 shows up in the output.
Please also :script: exactly as you used it.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.