Does anyone have an idea on how to shift lines say {l1,l2,l3,l4} left or right by N pixels in YUY2 cap.
+ Reply to Thread
Results 1 to 5 of 5
-
-
Yes it can be done in Avisynth. Install this program (version 2.6 is fine), then create a plain text file (can use Notepad), with the lines below, save it as shift.avs (make sure to change file type to all files *.*). Since installing Avisynth, *.avs files now play like a video, except they are actually running video adjustment commands.
The first line in the file should reference your video. The next lines decide what lines to shift. You have to adjust the example to use your video file and to set the lines to shift.
The command I made is shiftline(y,x) where y is the line #, starting at 0, and x is the shift, where x<0 shifts to the right. If the shift is always the same, you can write n=-50 then shiftline(1,n) shiftline(5,n) etc.
If you want to understand a little about Avisynth, how it works, top will return the lines from 0 to y-1, bot returns the lines from y+1 to the bottom, getline returns line y, now I split the video into 3 parts, the top is unchanged, the line is shifted, and the bottom unchanged. These are stacked together.
One more thing: the border pixels are made the same color as the last pixel, maybe you want the filler to be black? Also the shift can be subpixel like 5.5.
Code:avisource("c:\MyVideos\test.avi") #test shiftline(10,-50) function shift(clip v, float x, float y) { v#shift an image, x>0 shifts left, y>0 shifts up bilinearresize(last.width,last.height,x,y,last.width,last.height) } function top(clip v, int y) { y<>0?v.crop(0,0,0,y):nop } function bot(clip v, int y) { y<>v.height-1?v.crop(0,y+1,0,0):nop } function getline(clip v, int y) { #return a line of height 1 from y v.crop(0,y,0,1) } function shiftline(clip v, int y, int x) { y==0?stackvertical(getline(v,y).shift(x,0),bot(v,y)): \ y==v.height-1?stackvertical(top(v,y),getline(v,y).shift(x,0)): \ stackvertical(top(v,y),getline(v,y).shift(x,0),bot(v,y)) } function test{ colorbars(height=256, pixel_type="YV12") mt_lutspa(mode="absolute",yexpr="y").converttoyuy2 }
Last edited by jmac698; 16th Dec 2011 at 20:00. Reason: Updated
-
-
Fixed. I caught that in shiftline, but didn't update bot. And (s)he did say it was YUY2.
Similar Threads
-
Time shift from camcorder in PC
By petran63 in forum Newbie / General discussionsReplies: 0Last Post: 2nd Feb 2012, 15:32 -
Chroma shift help needed
By Cherbette in forum RestorationReplies: 26Last Post: 18th Jan 2012, 20:46 -
ADVC-55 and color shift?
By pgoelz in forum Capturing and VCRReplies: 28Last Post: 16th Mar 2010, 17:10 -
Variable time shift
By tbee in forum Video ConversionReplies: 1Last Post: 22nd Nov 2009, 12:02 -
Shift the subtitle
By cheerful in forum Newbie / General discussionsReplies: 4Last Post: 9th Nov 2007, 16:13