[Vnc2swf-users] How to set FLV meta data (was Re: About FLV output.)
Status: Alpha
Brought to you by:
euske
From: Oscar U. <osc...@pr...> - 2009-04-02 22:24:30
|
Folks, I updated __init__.py and commented out import play, and that got me further, so I could at least test. The result of this, was being able to use the vnc2swf-recorder script to output .flv reading from a streaming stdin input. However the resulting output files contained blank frames. Seeing that v.0.10.0 swf.py had the updates to write out the meta-data for .flv formats, I attempted to simply update this file with the diff, but with the same bad result as before. Below is an approximate diff. "flvtool++" (v.1.1) apparently is a work around for this situation. It will create the flv meta data, but does not write the correct height meta-data value either because pyvnc2swf writes it incorrectly (see swf.py use of 'rect' in FLVWriter), or because flvtool++.cpp does uses an incorrect algorithm to read it. The diff resolves this. Thanks [osc@builder-freebsd ~/packages/flvtool++/src/patch]$ diff flvtool++.cpp /usr/ports/multimedia/flvtool++/work/flvtool++.cpp 190,191c190,191 < h = ((*(vptr++)) & 0x0f) << 8; < h += ((*(vptr++)) & 0xff); --- > h = ((*(vptr++)) & 0xff) << 4; > h = ((*(vptr++)) & 0xf0) >> 4; [osc@rt01 /var/ee/www/swf]$ ~/flvtool++ /tmp/FILM078.flv /tmp/FILM078.2.flv Video: 878x629 SCREEN Total: 313234 video bytes (190.329029 kbps), 0 audio bytes (0.000000 kbps), 13.166000 seconds long Final onMetaData tag contents: { audiodatarate: 0.000000 audiosize: 0.000000 canSeekToEnd: true datasize: 316322.000000 duration: 13.166000 framerate: 12.076561 hasAudio: false hasCuePoints: false hasKeyframes: true hasMetadata: true hasVideo: true height: 629.000000 keyframes: { filepositions: { 544.000000 } times: { 0.000000 } } lasttimestamp: 13.166000 metadatacreator: flvtool++ (Facebook, Motion project, dweatherford) metadatadate: Thu Apr 2 22:10:27 2009 totalframes: 159.000000 videocodecid: 3.000000 videodatarate: 190.329029 videosize: 313234.000000 width: 878.000000 } [osc@builder-freebsd ~/packages/vnc2swf/src/pyvnc2swf-0.9.5/pyvnc2swf]$ diff swf-0.10.0.py swf.py 854d853 < 857,871d855 < < # Meta Data information must be at the start of the file.... < # Reserve here an area of 100 char to store meta data information < # I know this is a bit ugly.. But i have no better idea... < i = 0 < self.pos = self.outfp.tell() < self.writeui8(18) < self.writeub24(100) < self.writeub24(0) < self.writeui32(0) < self.outfp.flush() < while i < 100: < self.writeui8(0) < i = i+1 < self.writeub32(111) 885,926d868 < # To be correctly played into a FLV Player, flv files has to handle some meta data < # With framerate and duration, many flv player successfully read the produced < # FLV Stream < import struct < < # Flushing all the remaining data < self.outfp.flush() < < # Write metadata information < self.outfp.seek(self.pos) < < # The needed metadata are stored in flv with amf format. < # For documentation, see : < # - http://osflash.org/flv < # - http://pyamf.org/ < # Following metadata was generated with the help of pyamf < < duration = framecount / self.framerate < meta = '\x02\x00\nonMetaData\x08\x00\x00\x00\x00\x00\x08' < meta += 'duration\x02' + struct.pack('>H',len(str(duration))) + str(duration) < meta += '\x00\x0ccanSeekToEnd\x01\x01\x00\t' < meta += 'framerate\x02' + struct.pack('>H',len(str(self.framerate))) + str(self.framerate) + '\x00' < # writing metadata duration < self.writeui8(18) < self.writeub24(100) < self.writeub24(0) < self.writeui32(0) < # Insert pseudo Data to fill the rest of the reserved space < rest = 100 -len(meta) -22 < meta +='\x0fuselessdatabuff\x02' + struct.pack('>H',rest) < data = '' < while len(data)<rest: < # Inserting Blank Data < data += '\x00' < meta += data < meta += '\x00\x00\t' < self.write(meta) < print len(meta) < self.writeub32(111) < < self.outfp.seek(0,2) #The end of file < self.outfp.flush() Command I am using test For v. 0.10.0 400 zcat FILM075.vnc.gz | vnc2swf-recorder -n -z -o /tmp/FILM078.flv -V For v. 0.9.5 411 zcat FILM078.vnc.gz | /usr/local/pyvnc2swf/bin/vnc2swf.py -n -z -o /tmp/FILM078.flv -V > ----- Original Message ----- > From: "Oscar Usifer" <osc...@pr...> > To: oli...@wa... > Cc: "General discussion about vnc2swf" <vnc...@li...> > Subject: Re: [Vnc2swf-users] About FLV output. > Date: Thu, 2 Apr 2009 13:52:36 -0500 > > > It complains pygame is not installed. Is there a version that uses > PIL instead, or is there a setup option to set it to use PIL? > > Thanks > > > > > ----- Original Message ----- > > From: "Olivier Hervieu" <oli...@wa...> > > To: "Oscar Usifer" <osc...@pr...> > > Cc: "General discussion about vnc2swf" <vnc...@li...> > > Subject: Re: [Vnc2swf-users] About FLV output. > > Date: Thu, 02 Apr 2009 10:26:44 +0200 > > > > > > The attached tarball has a setup.py that respect standard python > > distribution style. > > > > Run > > > > python setup.py build > > python setup.py install > > > > You can have some help by running > > > > 'python setup.py --help' or 'python setup.py --help [command name]' > > > > Forget the old makefile. I leave it here for euske. > > > > Regards, > > > > Olivier. > > > > Oscar Usifer a écrit : > > > Greets Olivier, > > > > > > Just a few requests. I would like to test it out, but am not > > able > to get it into an installed state. I tried to run > > setup.py, but > it seems to output usage along the way instead of > > actually > performing an install. I was not able to use your > > package, as > make fails as well. Could you please update so that > > it is > compatible with the current build system? Also, I have a > > target > system that I use for installation, so the setup/make > > would need > an option to install into a target directory instead > > of into a > system. I can take your work and figure out how to > > get it > completely installed, but not everyone has the time or > > desire to > go to that level of energy output. Also, I am > > beginner level with > Python, which makes it less accessible. > > > > > > Thanks, > > > OSC > > > > > > > > > > > > > > >> ----- Original Message ----- > > >> From: "Olivier Hervieu" <oli...@wa...> > > >> To: vnc...@li..., "Yusuke Shinyama" >> > > <yu...@cs...> > > >> Subject: [Vnc2swf-users] About FLV output. > > >> Date: Mon, 30 Mar 2009 16:49:48 +0200 > > >> > > >> > > >> Hi all, > > >> > > >> Vnc2swf can produce FLV. But produced files present some drawbacks. > > >> > > >> - files has only one keyframe (also report a few weeks ago), > > >> - files has no metadata. This means that support of pyvnc2swf > > >> FLV files is not complete for most FLV players (impossible to > > >> scroll, total record time is not available (a good example : > > >> test your pyvnc2swf FlV in FlowPlayer)). > > >> > > >> I attach a tarball containing some modifications: > > >> > > >> - add a '-k' option to specify the keyframe rate > > >> - Add meta data on the produced flv. > > >> > > >> Note that I also repackage pyvnc2swf to be more pythonic. >> > > Vnc2swf scripts, edit and play are replaced by scripts >> > > vnc2swf-recorder, vnc2swf-editor and vnc2swf player. The >> > > distribution is now built and installed with setuptools. > > >> > > >> The Cli interface was successfully tested on Ubuntu 8.04 and Debian Lenny. > > >> > > >> Also note that I did not (and do not want to) install > > python-tk. >> I paid attention to add some options in the GUI. > > But these >> changes are not yet tested,. > > >> > > >> I leave to Euske or others to test and commit these changes. > > >> > > >> Regards, > > >> > > >> Olivier Hervieu. > > >> << pyvnc2swf-0.10.0.tar.gz >> > > >> > > >> > > > > > > > > > > > > > > > -- > Be Yourself @ mail.com! > Choose From 200+ Email Addresses > Get a Free Account at www.mail.com > > > ------------------------------------------------------------------------------ > _______________________________________________ > Vnc2swf-users mailing list > Vnc...@li... > https://lists.sourceforge.net/lists/listinfo/vnc2swf-users > -- Be Yourself @ mail.com! Choose From 200+ Email Addresses Get a Free Account at www.mail.com |