View Full Version : how to crop an avi ( xvid , ac3 ) without reencode it ?
pimpMyHD
23rd December 2006, 14:16
I have several avi containing xvid and ac3. All of them have the same dummy grey 8 pixels at the bottom.
Can i write a avs script that can remove those lines, without reencode the whole files.
I tried to use this script i wrote (with the help of some post from this forum) on virtualdub mod :
# source XviD AVI file
file = "E:\TLSm\SAMOURAI.avi"
# open AVI video-only to get correct frame rate
AVISource(file, audio = false)
# save correct frame rate for DirectShowSource
frate = Framerate()
# reopen in DirectShow for better audio compatibility
DirectShowSource(file, fps = frate)
# crop the 8 lines of the bottom
crop(0,0,0,-8)
but i have not found the way to use it. If a save 'direct stream copy' i will need to reencode it.
So what is the way ?
thanks a lot, i know that my question is noob related ... but after several hours of search and test, i can't find my way.
by the way, Merry Xmas
bkman
23rd December 2006, 14:31
You can't crop the source without re-encoding. You could crop it during playback with something like ffdshow, though (conceivably).
bond
23rd December 2006, 14:44
does asp support setting cropping info in the header like avc? if yes, than you could make every decoder automatically only show the cropped video without needing to reencode
foxyshadis
23rd December 2006, 15:39
Yes, that's the only way xvid can support non-mod-8. According to Mpeg4Modifier (which is much better than xvid's source for these things, btw), the width and height are part of the avi itself and not the vol or vop, though they may or may not also be there. So try hex editing the riff header.
pimpMyHD
24th December 2006, 17:19
ok, i understand that i can't recrop a xvid without reencode it.
So, you say hat i can advise decoders that they must crop the video while decoding it. How can i perform that ?
( sorry but the discussion seems to become out of topic, according to you it is not an avs related problem )
Pookie
24th December 2006, 22:17
FFdshow - VideoDecoder Settings -Crop
foxyshadis
24th December 2006, 23:22
I can tell you how to do it with a hex editor, because I just tried and it worked, but if you're not comfortable with them you'll want to bail. And always work on a copy of the original unless you fancy occasionally losing a file.
Open windows calc, enter the height of the current file, and the set it to hex. Open virtualdub, and open tools->hex editor. Load your file in. Click on "strf" which will highlight the important chunk. (Not strl or strh.) Now look in the highlighted area of the left pane for the height, it'll probably start right underneath strf (the bytes will be backwards, but you should recognize it from what calc showed). Subtract 8 from the number (use calc if you aren't handy with hex) and replace the first byte - you probably won't need to touch the others. Save, and see if it worked.
pimpMyHD
25th December 2006, 11:10
thanks pookie, but i do not use ffdshow at all.
i will try the foxy method.
thanks a lot.
medp7060
26th December 2006, 10:22
thanks, foxyshadis. It is the first time I have heard to crop a clip without reencoding. I tested it and it worked!!!!
snowden
17th October 2007, 03:33
i have been looking everywhere for advanced editing techniques for some of my xvid and other videos and i've come across the beginnings of it in this topic...better here than never.
@foxyshadis: does this hex hack also apply to other file formats (video of course) such as MPEG-1/-2?
;)
foxyshadis
17th October 2007, 04:16
If you can get it to play without crashing, I suppose. Never tried, but some mpeg streams do have separate display size vs coded size.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.