IOHelper ioHelper = new IOHelper(flvFile);
File tempOutFile = new File(flvFile.getAbsolutePath() + ".tmp");
ioHelper.setOutFile(tempOutFile);
FlvHeader flvHeader = new FlvHeader(ioHelper);
TagBroker tagBroker = new TagBroker(ioHelper, flvHeader);
MetaDataGen metaDataGen = new MetaDataGen(tagBroker, flvHeader);
metaDataGen.buildOnLastSecond();
metaDataGen.buildOnMetaData();
FileEmbedder fileEmbedder = new FileEmbedder(metaDataGen.getMetaData());
if("".equals(metaAuthor)) metaAuthor = "MediaCentre";
fileEmbedder.embedVar("metacreator", metaAuthor);
if(addedEmbedParameters.length > -1 && !"".equals(addedEmbedParameters[0])) fileEmbedder.embedVars(addedEmbedParameters);
metaDataGen.sealMetaData();
tagBroker.writeTags();
ioHelper.closeAll();
tempOutFile.renameTo(flvFile);
response.sendRedirect("../list/index.html");
}