I’ve always viewed regular expressions as some sort of nasty dark art that only a Perl developer could love, but today I picked up on a tool, RegexBuddy, that promises to make me fear regex no longer. This gem fell to me by virtue of one of the many dev mailing lists I skulk on–osflash.org, courtesy of a thread started by John Grden and answered by Antony Jones. There are a couple of caveats here–1) this is a windows only app (thankfully Parallels / Crossover help mitigate this) and 2) This is not a free app (runs $30 US).
ROCKS indeed Antony!
Thankfully, RegexBuddy works with Crossover:
After a bit of fiddling I figured out how to use flvtool2 to overwrite the existing metadata values for an flv or even add completely new name value pairs.
In most circumstances the video tool used to encode an flv will insert a few values into the file’s metadata. Typically you will find properties such as duration, width, height, etc. stored in the file allowing you to to respond to the data when the flv’s onMetaData event fires.
You can also use flv metadata “injectors” such as flvtool2 to do this for you if your encoder failed to insert the data, or you wish to augment the metadata (the injectors often add additional metadata that is not included by the encoder).
However, it can sometimes be useful to change the values set by the encoder / injector. For example, perhaps I’ve performed a cut operation on an flv with flvtool2 and would now like the duration to reflect the new timestamp value. In this scenario you use flvtool2′s “-key:value” switch to change the value of an existing property, or key.
Here’s a short video illustrating how to overwrite existing metadata values using flvtool2.
You can also add completely new name / value pair to an flv’s metadata:
flvtool2 -U -drummer:Portnoy example.flv
If you’re interested in more commands take a look at the flvtool2 wiki.
I’m a couple of years late to this party, but there’s a neat Ruby based tool, Flvtool2, which allows you to stamp metadata in flv files, insert cue points–both navigation and event, and allows you to slice and dice an flv file based on defined in and out points (kudos to Norman Timmler for writing this app and making it available to the community).
Unfortunately, the documentation for this tool is almost non-existent – SPAM apparently took down the wiki. Another problem, I encountered at least, is that the builds available from RubyForge contain bugs. Fortunately, you can download the source from svn where the bugs appear to be fixed.
Since the documentation is so sparse I thought I’d post some example usage where the search bots might possibly find it.
If you wish to insert onCuePoint events into your flv, Flvtool2 accepts an xml / yaml file that declares the cue point data. The screen shot below illustrates how you can insert both “event” and “navigation” cue points. Navigation cue points should theoretically corresponds to a keyframe stamp so that an flv seek action can be assured of starting from the given timestamp.
You can view a list of of the possible commands by typing the following in your commandline shell.
To simply print out all of the metadata for a given flv simply use the following command.
flvtool2 -P some.flv
To insert cue points declared in the tags.xml file use the -A command with the -t switch. In the example below I’ll actually chain a few commands together (Add, Print, Update). The -P prints the metadata from the given file to stdout and the -U updates the flv with an onMetaTag event.
flvtool2 -APUt tags.xml src.flv output.flv
Here’s what running the proceeding code might look like.
The next example illustrates how to carve a new flv that’s four seconds long from the source flv based on in / out timestamps in milliseconds. To do this use the -C command along with the -i / -o switches.
flvtool2 -Cio 1000 5000 src.flv splice.flv
If you are interested in using flvtool2 as part of an automated ant build script you’ll need to invoke Ruby via the exec task, pass in flvtool as the ruby application to run and then pass in the desired commands, switches and arguments. The screenshot below is an example of this in action.
So there are just a ton of applications for a tool like this for both client and server-side applications which should be obvious to just about everyone likely to read this post. If you’re bored, it’s also extremely interesting to to take a peek at the metadata injected by various commercial encoders or video sharing sites (gootube et al). Enjoy!
After years of resistance I finally caved and bought a sleek, shiny MacBook Pro over the weekend. I’ve been slowly figuring out how to set up my AMES development environment and that means figuring out the basics of using the Unix shell. I struggled to find a simple explanation of how to set environment variables, so I’m inserting a couple of screen grabs which illustrate how to add MTASC and Swfmill to the PATH environment variable.
I downloaded, unzipped and placed the mtasc and swfmill binaries in their respective folders in the following folder:
Method 1 : A Session Variable – Using the bash shell, this adds the mtasc and swfmill binaries to the PATH variable for the current terminal session. When you close the shell and reopen it, you’ll have to add the files to the PATH variable again.
Method 2: Add to Startup Script – Place the command in a startup script called bashrc which can be found along the path below. The modified PATH will always be available to any bash shell and no further editing is needed.
This method is similar to how environment variables are set in Windows (without the gui absraction layer). the bashrc file is a simple text file and you simply add the commands to this script which is run everytime the os loads.