Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
5th May 2012, 21:24 | #1 | Link |
EphMan
Join Date: May 2004
Posts: 737
|
Turning Video mid-way in script
I have a cell phone video of my daughter learning how to ride her bike for the first time. The first 1/3 or so of the video is recorder vertically, and then I turned the phone horizontally for a wider shot and proceeded to record the remainder of the video that way. In my script if I add "TurnLeft()" it corrects the video for that, but how can I keep the beginning video as is and adjust the video mid-way within 1 script?
So far I have this: Code:
LoadPlugin("C:\Program Files\AviSynth\Plugins\ffms2.dll") Import("C:\Program Files\AviSynth\Plugins\FFMS2.avsi") FFmpegSource2("C:\Users\User1\Desktop\VIDEO0007.mp4",atrack=-1) Trim(730,1543) TurnLeft() |
5th May 2012, 21:42 | #2 | Link |
Registered User
Join Date: Jun 2009
Location: UK
Posts: 263
|
Try this:
Code:
LoadPlugin("C:\Program Files\AviSynth\Plugins\ffms2.dll") Import("C:\Program Files\AviSynth\Plugins\FFMS2.avsi") FFmpegSource2("C:\Users\User1\Desktop\VIDEO0007.mp4",atrack=-1) Trim(0,729) ++ Trim(730,1543).TurnLeft() This outputs frames 0 to 729 unchanged, followed by frames 730 to 1543 rotated. Ah, hang on though... You won't be able to join the clips directly like that, as they now have completely opposite aspect ratios. So, you somehow have to conform them to the same aspect ratio and *then* use the "++" to concatenate them. Try: Code:
LoadPlugin("C:\Program Files\AviSynth\Plugins\ffms2.dll") Import("C:\Program Files\AviSynth\Plugins\FFMS2.avsi") FFmpegSource2("C:\Users\User1\Desktop\VIDEO0007.mp4",atrack=-1) # This assumes the source clip is wider than it is tall: W = width() H = height() Border = BlankClip(Last,height = (W-H)/2) StackVertical(Border,Last,Border) # We should now have a square clip, where width and height are both equal to W Trim(0,729) ++ Trim(730,1543).TurnLeft() If the source clip is actually taller than it is wide, then just change: Code:
Border = BlankClip(Last,height = (W-H)/2) StackVertical(Border,Last,Border) Code:
Border = BlankClip(Last,width = (H-W)/2) StackHorizontal(Border,Last,Border) Last edited by pbristow; 5th May 2012 at 21:53. |
8th May 2012, 09:11 | #5 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,433
|
Quote:
Did you follow this part of pbristow's post? |
|
8th May 2012, 22:33 | #6 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Looks like BlankClip() and friends need some id10t error protection for negative attributes. Oops!
And really the AddBorders method should be preferred here, it has no need for the static blank clip and the copy of it's pixels. The Stack method would be appropriate if you wanted to fill the borders with some form of texture. Last edited by IanB; 8th May 2012 at 23:07. |
9th May 2012, 05:16 | #7 | Link | |
EphMan
Join Date: May 2004
Posts: 737
|
Quote:
Also, I uploaded the MP4 video from my phone to SendSpace so you guys could help me out. The entire video is 20mb. http://www.sendspace.com/file/3bo14x |
|
9th May 2012, 06:58 | #8 | Link |
Registered User
Join Date: Jan 2006
Location: Finland
Posts: 134
|
Code:
FFMpegSource2("VIDEO0007.mp4",atrack=-1) AddBorders(160,0,160,0) # 160+480+160 = 800 Trim(0,729) ++ Trim(730,1543).TurnLeft() Resulting video here www.sendspace.com/file/6n6yrp |
13th May 2012, 16:05 | #9 | Link | |
EphMan
Join Date: May 2004
Posts: 737
|
Quote:
|
|
14th May 2012, 06:35 | #10 | Link |
Registered User
Join Date: Jan 2006
Location: Finland
Posts: 134
|
@EpheMeroN
A video can only have one resolution. If you want the output resolution to match the second part of the video, you will need to scale the first part down by a lot (or crop a lot, which would leave very little of the original content). Try: Code:
FFMpegSource2("VIDEO0007.mp4",atrack=-1) # 480 / (800/480) = 288 # (800 - 288) / 2 = 256 Trim(0,729).BilinearResize(288,480).AddBorders(256,0,256,0) ++ Trim(730,1543).TurnLeft() |
Tags |
angle, aspect, rotate, turn |
Thread Tools | Search this Thread |
Display Modes | |
|
|