To make it simple, here is what I'm trying to do. I have videos that look like this:
And I would like the videos to look like this in the end:
I don't want the image's horizontal resolution to change, nor do I want the vertical resolutions of the top and bottom to change either. I simply want to be able to insert black in the middle and push the top and bottom apart. Of course, I would also letterbox this end result so that the final resolution is more normal.
I looked in VirtualDub and the closest thing I could find would be the logo filter...
But that clearly overwrites the image. I really couldn't find any setting that would allow the image to be pushed apart.
I really don't think this would be difficult to program (simply push apart the image by 84 pixels like I did in Paint), so, would it be possible to create an Avisynth script that would do this?
I've never ran Avisynth before (I prefer GUI, like VirtualDub, Avidemux, etc.), but I would be willing to learn how to use Avisynth if I could achieve what I described above.
Or, is there another way to achieve this? (VirtualDub filter, etc.) If necessary, I suppose I could save the top and bottom segments as separate videos if required.
Anyway, I would appreciate any help given. Thanks!
+ Reply to Thread
Results 1 to 6 of 6
-
-
yes you can do it in avisynth fairly easily , or any NLE like vegas, premiere etc..
I'm assuming you don't want that white edge on the bottom of the middle black portion?
An example how to do this
Code:a=AVISource("video.avi") a.crop(0,192,0,0,true) bottom=last a.crop(0,0,0,-192,true) top=last middle=blankclip(a,height=84) stackvertical(top, middle, bottom)
http://avisynth.org/mediawiki/Main_Page#New_to_AviSynth_-_start_here
Of course, I would also letterbox this end result so that the final resolution is more normal.
Last edited by poisondeathray; 5th Jun 2011 at 10:21.
-
First, I have to say sorry for the untimely response. Second, I have to say thank you for the info! I read up on how to use Avisynth and tried your code. I saved it in an .avs file and opened it up in VirtualDub. It worked like a charm.
No, I don't want that white edge on the bottom of the black portion. VirtualDub's logo filter added that in for some reason, but it's a moot point now.
The video is being prepared to be joined with other video clips, which are in a 16:9 format. So, I increased the size of the video and then letterboxed it that way (16:9) so the video isn't a goofy 256 x 468 and can be joined with the other clips. I uploaded the experimental letterboxed result to YouTube. I saved it in 720p, though in the future this won't be necessary. (I'll save as 854 x 480 instead since none of my clips are HD.)
Looks good to me. Thanks again for your help.
As far as learning more about Avisynth and what you did with this script...
First, you set the video as "a" so it can easily be referenced in the rest of the script.
I couldn't find where it discusses crop on the Avisynth Wiki, but I found this page. So then, the crop function crops pixels off (left edge, top edge, right edge, bottom edge). From what I gather from this function, the measurements of the video can be thought of in Cartesian coordinates (x,y) and what Avisynth does is move the edge of the video Z number of pixels along the x-axis and y-axis, except that the y-axis is backwards. So then, the right and bottom edges should always be negative. Or am I making this too complicated? I suppose that if the sign was wrong on one of the variables, then the video frame would be extended by a certain number of black pixels instead?
Adding "true" to the variables allows the video to be processed faster, from what I gather? I don't really follow what was discussed because I am not familiar with byte alignment, etc.
In v2.53 an option align (false by default) is added:
Cropping an YUY2/RGB32 image is always mod4 (four bytes). However, when reading x bytes (an int), it is faster when the read is aligned to a modx placement in memory. MMX/SSE likes 8-byte alignment and SSE2 likes 16-byte alignment. If the data is NOT aligned, each read/write operation will be delayed at least 4 cycles. So images are always aligned to mod16 when they are created by AviSynth.
If an image has been cropped, they will sometimes be placed unaligned in memory - "align = true" will copy the entire frame from the unaligned memory placement to an aligned one. So if the penalty of the following filter is larger than the penalty of a complete image copy, using "align=true" will be faster. Especially when it is followed by smoothers. -
Yes you can use any variable . You could have called it "original", or "main", or "z"
There's probably more efficient ways to write code, but I like breaking it out and keeping things simple
I couldn't find where it discusses crop on the Avisynth Wiki, but I found this page. So then, the crop function crops pixels off (left edge, top edge, right edge, bottom edge). From what I gather from this function, the measurements of the video can be thought of in Cartesian coordinates (x,y) and what Avisynth does is move the edge of the video Z number of pixels along the x-axis and y-axis, except that the y-axis is backwards. So then, the right and bottom edges should always be negative. Or am I making this too complicated? I suppose that if the sign was wrong on one of the variables, then the video frame would be extended by a certain number of black pixels instead?
http://avisynth.org/mediawiki/Crop
The right and bottom are always prefaced with negative
Adding "true" to the variables allows the video to be processed faster, from what I gather? I don't really follow what was discussed because I am not familiar with byte alignment, etc.
In v2.53 an option align (false by default) is added:
Cropping an YUY2/RGB32 image is always mod4 (four bytes). However, when reading x bytes (an int), it is faster when the read is aligned to a modx placement in memory. MMX/SSE likes 8-byte alignment and SSE2 likes 16-byte alignment. If the data is NOT aligned, each read/write operation will be delayed at least 4 cycles. So images are always aligned to mod16 when they are created by AviSynth.
If an image has been cropped, they will sometimes be placed unaligned in memory - "align = true" will copy the entire frame from the unaligned memory placement to an aligned one. So if the penalty of the following filter is larger than the penalty of a complete image copy, using "align=true" will be faster. Especially when it is followed by smoothers.
A very good tool to use is AvspMod. You can preview scripts (hit f5), compare scripts in multiple tabs using number keys, use macros , sliders
Just curious - Why is the video formatted like that in the first place? -
There are two different ways to supply the parameters to Crop(), described in http://avisynth.org/mediawiki/Crop as
Crop(clip clip, int left, int top, int width, int height, bool align)
and
Crop(clip clip, int left, int top, int -right, int -bottom, bool align)
A positive value for the fourth and fifth parameters is taken as the desired width or height of the result.
A negative (or zero) value is taken as the amount to be cropped off the right or bottom of the original.
You can use either form (even mixing one style for width/right and the other for height/bottom), whichever is more convenient for the job in hand - pdr's script uses the second form.
But the "bottom=last" and "top=last"... Is "last" the last video that had been generated within the script?
Another way of writing pdr's script could be:
Code:AVISource("video.avi") bottom = crop(0,192,0,0,true) top = crop(0,0,0,-192,true) middle=blankclip(last,height=84) stackvertical(top, middle, bottom)
-
Awesome, thanks for explanations guys! This makes more sense than when I was trying to figure it out on my own. You know, this information you guys posted might be helpful to a lot of people. Why not add it to the Avisynth Wiki article?
And AvspMod looks like a very nice tool, I'll check it out.
This video comes from a Nintendo DS emulator. I work with video game footage for my video projects and I use emulators to record the footage. This is what a game looks like on a Nintendo DS:
(Sorry for the bad picture.)
In some games, what goes on in the game goes behind the middle part where there is no screen. Here, you can see that the top of the loop is cut off at the top of the bottom screen. It's there "in game", but not on either screen.
Anyway, the .avis the emulator produces have the screens directly stacked on top of one another. In games like the one above, it makes the game look strange since there is supposed to be empty space between the screens. (See the screenshot at the top of this post.)
By splitting apart the screens and putting black between them, it makes the video footage look like how it looks on a Nintendo DS, like in the YouTube video I embedded.
Similar Threads
-
Black Levels in Windows Media Center using Hauppauge HD PVR
By Mitterhouse in forum Capturing and VCRReplies: 0Last Post: 17th Jun 2011, 13:16 -
VirtualDubMod vertically stretching video from M2V
By Yarko1967 in forum Video ConversionReplies: 2Last Post: 17th Apr 2011, 00:16 -
captured video vertically squeezed, fix during conversion?
By krcoggins in forum Video ConversionReplies: 2Last Post: 16th Feb 2009, 15:32 -
How to Paste Insert frames from Virtualdub (Snapshot source frame) ?
By Bilskate in forum EditingReplies: 1Last Post: 18th Aug 2008, 15:21 -
Insert blank frames at end of video
By kidcash in forum EditingReplies: 5Last Post: 28th Jan 2008, 04:52