Here's what I use:

#!/usr/bin/env python
#
# change bytes at positions 240, 244, 441
# change 2 bytes at 240 from 01 40 to 02 80
# change 2 bytes at 244 from 00 f0 to 01 e0
# change 4 bytes at 441 from 02 80 01 30 to 01 40 00 f0
"""
badcamera.py
run without arguments to change all the mp4 files in a directory
so that they report the correct size
"""

import glob
import getopt
import sys

class FileList:
    def __init__( self ):
            self.List = glob.glob("*.[mM][pP]4")

class FileEditor:
    def __init__( self, aFileList ):
                self.List = aFileList
                self.bs = (1,1,1)
                self.count = (2,2,4)
                self.seek = (240,244,441)
                self.skip = (0,2,0)

    def Run( self ):
                for fname in self.List:
                    print "processing file %s" % fname
                    f = file( fname, 'r+b')
                    f.seek( 240 )
                    f.write(chr(2))
                    f.write(chr(128))
                    f.seek( 244 )
                    f.write( chr( 1 ) )
                    f.write( chr( 224 ) )
                    f.seek( 441 )
                    f.write( chr( 1 ) )
                    f.write( chr( 64 ) )
                    f.write( chr( 0 ) )
                    f.write( chr( 240 ) )
                    f.close()

                   
def main():
    # parse command line options
    try:
        opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
    except getopt.error, msg:
        print msg
        print "for help use --help"
        sys.exit (2)
    # process options
    for o, a in opts:
        if o in ("-h", "--help"):
            print __doc__
            sys.exit(0)
    # process arguments
    #for arg in args:
    #    process(arg) # process() is defined elsewhere   

    aFileList = FileList()
    aFileEditor = FileEditor( aFileList.List )
    aFileEditor.Run()

if __name__ == '__main__':
    main()

On 4/30/06, muzzol <[EMAIL PROTECTED]> wrote:
En/na Herman Robak ha escrit:
>  Do you REALLY want to recode the stream, if only the header is wrong?
> I would have tried a streamcopy first, just to fix the container:
>
>  ffmpeg -i prova.avi -acodec copy -vcodec copy prova.mov
>

i'm no sure is only about the header. i'll try to put up a little sample
to show you the problem.

--
========================
      ^ ^
      O O
     (_ _)
muzzol(a)mail.ru
========================
jabber id: muzzol(a)jabber.dk
========================
No atribueixis qualitats humanes als ordinadors.
No els hi agrada.
========================
<echelon spamming>
bomb terrorism bush aznar teletubbies
</echelon spamming>


_______________________________________________
Cinelerra mailing list
[email protected]
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra



--
http://ThreeWayNews.blogspot.com
Your source. For everything. Really.

Reply via email to