I have a few seconds clip in AVI which I obtained by combining 100 image frames in MATLAB. The video quality is amazing and exactly what I wanted. But there is some small shakiness as the video moves from one scene to the next. The shakiness is not from the camera but due to intensity changes when the images frames are combined I suppose. I tried VirtualDub with Deshake which did not do much. I thoght of trying After Effects to correct the problem but my video does not has one focal point which remains there throughout the shot. The video is basically captured from one corner of the beach and the camera has been moving to the left to capture the entire other scenes in the beach.
How would this shakiness be corrected so that there is smooth transition as the camera moves throughout the video?
+ Reply to Thread
Results 1 to 24 of 24
Matlab? Wow that's a new one...
So are these still images (photos) from a camera / dslr ?
Can you describe the transition issue more clearly? Is the "shakiness" an x,y translation ? or zoom issue ?
Is it a pan shot from a static focal point, like a tripod ? or is the camera actually moving? handheld or stabilized / rig ?
Or by "intensity changes", do you mean there are differences in exposure ? e.g. some photos might be more exposed or less exposed resulting in a "flickering" ?
Or better yet, post a sample of the video
Okay so here's a short clip of the video. I couldn't upload the complete video due to size restriction. As you can see the camera is moving to the left to capture more scene. Also the shakiness or certain level of discomfort within the video could be felt. What do you guys suggest?
Last edited by Sonia123; 15th Mar 2014 at 12:27.
I've only download a part of the file so far but... You'll have to use a higher frame rate. 15 fps is too low for smooth motion.
OK, got the entire video now. Here it is, motion interpolated from 15 fps to 60 fps.
Last edited by jagabo; 14th Mar 2014 at 18:09.
This sample is uncompressed RGB. For future reference - it's suitable to demonstrate with video compression to send smaller file sizes - because we're just looking at the shot composition, not something like examining image quality, or compression artifacts where small details and losslessness might be important .
For example you can load the AVI in virtualdub, video=>compression and use something like x264vfw, with a quality (CRF) level about 18-22 . That will probably reduce the filesize about 50x and yet be enough to get the point accross for this purpose
People helping out are less likely to download large files, but are usually ok with smaller files. The more people help out, the more input and suggestions you'll get
With your permission, I've done that to the file you've uploaded
I'm guessing you're referring to the "strobing" and the low FPS jagabo referred to is part of that problem. Normally video cameras have motion blur from the shutter, there is very little here so adding synthetic motion blur will help a bit
What were the source files originally ? Can you provide some details, and on the use of Matlab (what purpose did Matlab serve)
The higher interpolated framerate in jagabo's example helps. I think he used avisynth (free), but you can also do that with AE, using pixel motion or timewarp for example , or third party plugins like twixtor
But you said the problem specifically was with the scene transition . I didn't see a "scene transition" in that sample. Can you upload a compressed sample that exhibits the scene transition issue ?
Other commonly used ways to compress files are to use something like handbrake, or ripbot264, or megui, many choices
@jagabo and poisondeathray, that's an interesting result. Can you please describe exactly how you performed motion interpolation. I couldn't seem to implement this in AE. And thanks for your idea on compression, I'll do that next time.
I used AviSynth to change the frame rate from 15 fps to 60 fps. AviSynth is a script driven system for filtering video. It's pretty hard for a beginner to get started with. The script I used was pretty simple:
import("C:\Program Files (x86)\AviSynth 2.5\plugins\SmoothFPS2.avs") AviSource("fishing_100.avi") ConvertToYV12() SmoothFPS2(60000,1000)
You'll need to download and install AviSynth and mvtools.
I recommend you stick with the 32 bit versions of everything.
I highly recommend you figure out how to get your editor to output 60 fps natively. That should be easier and cleaner. Motion interpolation techniques like SmoothFPS2() don't always work well. It works pretty well with simple panning shots like yours, but even so, look closely at the edges of the frame of my video you'll see distortions. It gets much worse with complex motions.
Motion interpolation is just synthesizing new "in between" frames by looking at motion vectors. Sometimes it works great, other times it yields poor results - you can get object edge morphing artifacts that look ugly
As mentioned above, AE comes with 2 built in methods for motion interpolation, timewarp (the effect) , and pixel motion which is activate by time remapping and changing the frame blending switch for the comp to "pixel motion" instead of duplicates, or frame blends
Have a look at this basic tutorial at videocopliot, it should cover the basics of time remapping, frame blending vs frame duplication vs. motion interpolation. It refers to slow motion, but that's really the same concept . Your generating 4x the number of frames (if you wanted to do the same thing as jagabo's example from 15fps to 60fps), but playback FPS is increased 4x, so the duration is the same as the original
Honestly, avisynth is faster , free, and produces similar quality results to pixel motion or timewarp. Twixtor pro - the 3rd party plugin - produces slightly better results, and has more options like guides and trackers to guide the motion interpolation
Does that address your concerns? Where are the scene transition issues? I'm asking those other questions that you didn't answer about the source files and matlab because there might be better ways to put this together in the first place without resorting to interpolation techniques (which sometimes give poor results, and take a lot longer to compute in AE)
Thanks for that and yes, avisynth and is tough to get started with. The video is basically created from combination of images and in order to combine them together, I resorted to Matlab which did the job quite well since ffmpeg was a bit complicated for me to begin with. Both does the same stuff and ffmpeg is faster. However, Matlab is something that is easier but takes time.
I'll try that will AE again but seriously, Thanks again.
But are the images sequential from a photo camera, in photo mode ?
I had the impression you used matlab to do some transformations , not to arrange them sequentially
For example if you open a still image sequence in vdub , it will automatically append sequentially numbered images . You have AE, and it can do the same thing. I'm just wondering why the use of matlab ?
Was the "scene transition" a "red herring" ? Because this looks like the same scene
If you can live with a shorter clip you can just change the frame rate to 60 fps -- it will have 1/4 the running time but will look smooth. 30 fps will last 1/2 as long but still flicker a little. You could do either of those to the original AVI file using AVI FRate.
By the way, to work around the issue of artifacts at the edge of the frame you could crop them away and resize if necessary. After SmoothFPS2():
Crop(8,8,-8,-8) # remove 8 pixels from each side of the frame Spline64Resize(width+16, height+16) # restore the original frame size
Last edited by jagabo; 14th Mar 2014 at 21:40.
Motion interpolation (also called "optical flow") doesn't work well between scenes either. Basically it has to be done per scene or have some sort of scene detection built in. Large charateristic changes, large motions will cause the interpolation to fail miserably. So if you are having issues with actual scene transitions, that will pose problems
Another free one you can try that has curves that you can adjust is slowmovideo
That's an interesting one. I did it on AE and my video was basically 20 seconds long originally, so after increasing the fps to 60, the time got reduced to 5 sec and hence I stretched it to 20. The rendered video was stopping after every second. I think I should start with abisynth even though I have no knowledge to begin with. And yes, the images are sequential in photo mode with same exposure settings.
Hmm I think you probably missed a few steps in AE.
I'm assuming you're using pixel motion ,not timewarp (it's a bit different for timewarp)
1) put your 15fps video (or original video in a comp, or drag it to the make new comp button)
2) change the comp length by right clicking, composition settings. Change the duration to something more. E.g. if original was 100 frames, make it 400 frame if you wanted 4x slow mo . It doesn't really matter as long as it's longer in lenght of frames
3) right click the layer in the comp, time=> time stretch, stretch factor 400%
4) set the frame blending switch to pixel motion for BOTH the layer and the main switch . IIRC this is outlined in the tutorial video
You can render out the slowed video from AE (e.g an RGB AVI like your original sample) as 15fps , then change the FPS playback rate in vdub, or AVIFrate
Last edited by poisondeathray; 14th Mar 2014 at 22:18.
These are exactly the steps that I'm following from the video tutorial and I did it again after reading your post. The stops are really prominent.
I can't think of why "stopping after every second" would be happening. Does it stop & start every second ? So there is a "jerk" every second ?
If you open that exported AVI in vdub, and advance frame by frame, describe what is happening (e.g. are there duplicate frames at that 1 second mark, and every 1 second after that) ?
AVIsynth really isn't that difficult for this task. You just install it, download that 1 plugin , put the .dll in the plugins folder to auto load it. The script is basically a copy & paste job. You open a file in notepad, with changing the filename & paths to match, save it, change the extension from .txt to .avs
Edit: @jagabo - is any any additional codec required to decompress format YV12 since VD couldn't locate them?
Last edited by Sonia123; 15th Mar 2014 at 00:05.
Thanks for that!! Btw is the conversion to mkv built-in within VD or did convert avi to mkv externally?
He probably used x264.exe directly . It can be compiled with avisynth support
It could be as simple as
x264 --crf 18 -o output.mkv input.avs
There are many popular GUI front ends that can accept avs scripts eg. ripbot, megui, xvid4psp . It makes it easier without having to get into nitty gritty command line stuff
vdub (not vdubmod) can export basically anything with the external encoder feature. There are instructions at the vdub forum, but it involves commandline usage
For someone new to avisynth, I would recommend vdub just to preview the scripts (or avspmod as a script editor and to preview), then use one of the GUI encoders like ripbot to do the actual encoding. That would be the easiest way IMO
Last edited by poisondeathray; 15th Mar 2014 at 15:19.
Yes, I use the x264 CLI encoder. I have a batch file on my Desktop that I can drag/drop AVS files onto for a quick encode. This makes using the CLI encoder very simple:
Put a copy of x264.exe in C:\Windows\ or elsewhere in your search path. Then create a .BAT file on your Desktop, name it x264crf.bat and enter the following text:
start /b /low x264.exe --preset=slow --crf=18 --sar=1:1 --output %1.mkv %1 pause
Alternatively, you can put the batch file in your SendTo folder. Then you can right click on an AVS script and select SendTo -> x264crf.bat.
Thanks a ton!!!!