VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. Member
    Join Date
    Jan 2003
    Location
    United States
    Search Comp PM
    Hoping someone could give me a suggestion or two of what to do with an recording of the 2017 eclipse I made with my camcorder.

    I didn't have any sort of tracking mount which would have been what I needed, instead I figured I'd set the camera up, let the sun move across the frame and then post-process it to align everything. I took one early pass and got sidetracked and didn't check again. I think what I did was to use vdub to deinterlace and export all frames. There's a crap-load of frame even when done at 30 fps. Thinking back, I may have recorded progressive frames, so there may have been 60 full frames/second. I can't remember but will investigate.

    What I'm hoping to hear is someone has a trick to measure an inter-frame x/y movement and then be able to create a fine movement script for avisynth/vdub. I just have no idea other than taking several sequences of frames and trying to manually measure the movement. This sounds like hell, so I'm hoping someone can come up with a less painful way to do this. I believe I took a large group of frames into photoshop and tried to align with transparencies but that was slow.

    I expect I'll also be throwing away a large percentage of the frames, and then also changing the playback framerate to play quicker.

    I've got an older version of adobe's CS5 so photoshop and premier. I've also got an older version of Vegas if any of those will help. I just recall that Premier at that time didn't play well with avisynth there was something about creating a frameserver and importing to be able to do anything but I don't recall any thing which would help. But... maybe vegas has a motion tool which I could align the first and last frames and let it find the path?

    Sorry for the bit of rambling, I've thought about this a bit but without a good knowledge of the tools and what they can do for me.

    Thanks for any ideas!!!
    Quote Quote  
  2. No need to export individual frames. AviSynth can do it all -- open the video, deinterlace, track, speedup. Motion should be nearly linear so it should be trivial to track it with Animate(). I need a sample though. Long enough to show significant motion.

    And, of course, any full featured NLE can track something like this.
    Quote Quote  
  3. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    I've heard that Vegas has great auto tracking but with Adobe PP you have to manually set keyframes. So for example you would center the eclipse every 100-1000 frames or so and Adobe will do the rest.
    Quote Quote  
  4. Member
    Join Date
    Jan 2003
    Location
    United States
    Search Comp PM
    Thanks for the suggestions.
    jagabo I don't know Animate but will look into it, I'm use to the other stuff like deinterlace, bob, weave, playback rate, drop frames, etc. Yes the motion would be linear, but what makes it tricky is you go from a full sun, to a sliver and tracking that last edge may through the auto stuff off. I did try blender once and that had a tough time with the auto part.

    Karma, Vegas does have a nice start/stop key frame and will auto transition between the key frames pretty nicely. I do have a few other issues I'll need to work through. The motion is linear top-left to bottom right at a constant rate but... I did reframe every so often (no fixted interval) and will have to just split on those. So with the changing framing the video frame gets moves away from the Top-left and results in the background showing so I'll need to figure out some interesting pattern with blur on that region to blend it.

    There's a third issue after total coverage when the sun in coming out from behind the moon the solar glasses I had taped onto the camcorder weren't positioned correctly so I get a nice green/red glow from the painters tape that I need to figure out how to fix...

    Image
    [Attachment 50386 - Click to enlarge]
    Quote Quote  
  5. Here's an example using Animate() to track on object that's moving linearly:

    Code:
    function MoveSun(clip black, clip sun, float x, float y)
    {
        Overlay(black, sun, x=Int(x), y=Int(y))
    }
    
    function CropSun(clip v, float x, float y)
    {
        Spline36Resize(v, 448.0, 448, x, y, 448, 448) # using resize rather than crop gives us sub-pixel accuracy
    }
    
    ImageSource("Ecliplse000119.png", start=0, end=1000, fps=29.97).ConvertTOYV24()
    ShowFrameNumber(x=650, y=500) # stamp frame number on sun as reference
    black = BlankClip(last) # a black clip onto which we'll pan the sun image
    
    background = Animate(0,1000, "MoveSun", black,last,-300,-200, black,last,1500,500) # the sun pans across the background
    sun = Animate(0,680, "CropSun", background,143.0,69.0, background,1372.0, 550.0) # crop a 448x448 box that follows the sun
    Overlay(background, sun, background.width-sun.width, 0) # overlay the stationary sun at the top right corner of the original video
    Trim(0,680)
    The first Animate() just pans the stationary sun image across the black background to have a moving sun to track. The second Animate() crops out a 448x448 box that follows the sun -- this is the part you're interested in. Here I overlaid the stabilized sun at the top right of the video but you would probably want to just return the stabilized sun image. The sun is shaky because the Overlay() used to pan it across the frame isn't sub-pixel accurate.
    Image Attached Files
    Quote Quote  
  6. Member
    Join Date
    Jan 2003
    Location
    United States
    Search Comp PM
    Thanks for the script, I took a shot and am not clear how the actual tracking in happening because I can't quite figure out the relationship between the movesun and cropsun functions. I my modified the script to use a real clip doesn't quite do what thought.

    I took two frames 2997 frames apart (100 seconds of 29.97 source) and found the sun moves , like you simulated, down right 166,311 so the interframe movement would be (.166, .311 wrong) 0.0553887220553887, 0.1037704371037704. (Although I'm not sure why these deltas are important..)

    Code:
    am=DirectShowSource("00086.MTS",audio=false).SeparateFields().Bob().SelectEven().BicubicResize(1920/1,1080/1)
    background=am 
    black = BlankClip(last) # a black clip onto which we'll pan the sun image
    I tried every combination of Animate I could think of without any luck... for example
    Code:
    sun = Animate(0,1000, "CropSun", background,367.0,25.0, background,201.0, -314.0) # destination has moved 166, 311 to the left and up
    sun = Animate(0,1000, "CropSun", background,367.0,25.0, background,533.0, 336.0) # destination has moved 166, 311 to the right and down
    {these were unique runs, not both in the script at the same time}
    The cropped sun block's movement is not stationary so I'm doing something wrong and need to dig deeper.

    Then I remember I messing with my source for deinterlacing... which may sound silly given the speed at which the sun moves, but I found there were visible interlaced frames...

    I then started second guessing if I've lost half my frames or did I get them back. It's been a long time since I've used avisynth often. S I checked both original and scripted videos in vdub have the same frame counts, and frame rates.

    I need to spend some more time trying to figure out why I'm not moving like I thought but suspect it's something dumb.

    Edit: Then I realized my inter-frame deltas mentioned were based on seconds not frames and corrected that.
    Last edited by jeff d; 5th Oct 2019 at 11:36.
    Quote Quote  
  7. You don't need the black clip. I was using that just in the creation of a moving sun video from your still image. Of course, it doesn't really hurt in your script because you create it but never use it (it's ignored).

    I think what you're missing is that the first two arguments (0, 1000) to Animate are the frame numbers over which to animate. So you need to change them to reflect the frame numbers over which you're tracking.

    http://avisynth.nl/index.php/Animate
    Quote Quote  
  8. Member
    Join Date
    Jan 2003
    Location
    United States
    Search Comp PM
    Yeah, I left the black in just as a filler, but agree it's not needed.

    As for the frame number yes I understand. I had changed those values from yours to just do a larger section test BUT... I didn't realize the end needed to match the final frame of the source. Made that change and the sun does stay put!!! Thanks.

    If I can find a place to host a clip I'll share something.

    I had also discovered a bone headed thing where I wasn't taking the final position in the clip but rather the position @ 2997 frames in, yeah for me!
    I adjusted the final position to be at the final frame but then something strange happened and I can't figure out why.
    My frames have doubled from 4xxx to 8xxx. I was playing around with AssumeFPS trying to get it to play quicker but when that didn't work I deleted it. No the 4635 frame clip shows up in vdub with 8055 frames. I am making progress, thanks!!
    Quote Quote  
  9. Member
    Join Date
    Jan 2003
    Location
    United States
    Search Comp PM
    Alright, I think I need a little help because something doesn't make sense...
    I have two image frame0 and frame4634, I bring both into photoshop with my ruler units set to pixels.
    I calculate the movement by shifting frame0 over down until it lines up with frame 4624's sun, the deltas are (267, 385)

    I setup Animate to start with the position of 367.0, 25.0 of background which is my source clip, the final position is 634.0, 410.0:
    Code:
     
    background=DirectShowSource("00087.MTS",audio=false).SeparateFields().Bob().SelectEven().BicubicResize(1920/1,1080/1)
    Animate(0,4634,"CropSun", background, 367.0, 25.0, background, 634.0, 410.0) # destination has moved 166, 311 to the left and up
    The resulting clip horizontally looks good but vertically it move up and I can't figure out why that no longer locks the vertical. I may just restart my system and see if it's some strange lingering issue with the engine because I can't find a problem (but I'm clueless too)
    Quote Quote  
  10. At first I thought the sequence DirectShowSource("00087.MTS",audio=false).Separate Fields().Bob().SelectEven().BicubicResize(1920/1,1080/1) would double the number of frames but it looks like AviSynth realizes that the video is already fields after SeparateFields() so it doesn't double them again with Bob(). Still, I'd try just: DirectShowSource("00087.MTS",audio=false).Bob().Se lectEven(). There's no reason to follow with a resize, Bob() keeps the original frame size.

    Also DirectShowSource() should be used as a last resort. It's preferable to use LWlibabVideoSource() (included with the LSMASH package) or ffVideoSource() (included with the ffmpegSource package).

    With the numbers you've given I don't see why the tracking is off vertically but not horizontally. Try adding "return(background)" between the two lines and verify you have the right number of frames, the right frame size, and no distortion.
    Quote Quote  



Similar Threads