Vibrations when exploding/repacking movie
        Posted  
        
            by Stefano Borini
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Stefano Borini
        
        
        
        Published on 2010-04-18T07:37:34Z
        Indexed on 
            2010/04/18
            7:43 UTC
        
        
        Read the original article
        Hit count: 366
        
Please bear with me, I know that what I'm doing can sound strange, but I can guarantee there's a very good reason for that.
I took a movie with my camera, as avi. I imported the movie into iMovie and then exploded the single frames as PNG. Then I repacked these frames into mov using the following code
movie, error = QTMovie.alloc().initToWritableFile_error_(out_path, None)
mt = QTMakeTime(v, scale)
attrib = {QTAddImageCodecType: "jpeg"}
for path in png_paths:
    image = NSImage.alloc().initWithContentsOfFile_(path)
    movie.addImage_forDuration_withAttributes_(image, mt, attrib)
    movie.updateMovieFile()
The resulting mov works, but it looks like the frames are "nervous" and shaky when compared to the original avi, which appears smoother. The size of the two files is approximately the same, and both the export and repacking occurred at 30 fps. The pics also appear to be aligned, so it's not due to accidental shift of the frames.
My question is: by knowing the file formats and the process I performed, what is the probable cause of such result ? How can I fix it ?
© Stack Overflow or respective owner