如何以编程方式将ActionScript CuePoints注入FLV文件

时间:2014-01-28 22:47:00

标签: actionscript-3 flash video actionscript

我目前正在开发一个项目,我希望能够将ActionScript CuePoints注入输入视频文件。我希望每隔1秒注入一次,然后注入一个大约有11个字段的对象(不确定是否使用了这个术语?我是一个Java家伙)

然而我的问题是这些,我不熟悉AS3和Flash,并且不确定如何将一个MP4文件作为输入,使用一个XML文件,其中包含我将组织成对象的数据,然后输出FLV。 / p>

由于这是大型系统的一部分,我也不知道如何从命令行执行AS3程序,即$ console:flash injector.as Video.mp4 Info.xml

我希望注入这些提示点的原因是,在播放时,我想在播放视频文件时访问每个提示点的数据,这样我就可以在视频播放过程中使用这些数据。

我确信这不是一项特别复杂的任务,但是我在flash和AS3环境方面缺乏经验让我暂时难以理解。

到目前为止,我发现的有用文档是:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/video/FLVPlayback.html#addASCuePoint%28%29

Is it possible to create a 'command line' swf?

然而,我对于如何最好地进行而感到有点难过。非常感谢任何有关此事的帮助

1 个答案:

答案 0 :(得分:0)

您的问题是如何使用mp4文件中的提示点创建f4v? 您可以使用安装Flash时附带的Adobe Media Encoder执行此操作。 Media Encoder有一个对话框,您可以在其中手动添加在导出f4v或flv文件时将包含的提示点。

根据您已经找到的示例,如果您需要添加大量的提示点,最好使用动作脚本执行此操作:

// not tested, but should be something like this
for(var i = 0;i<100;i++) {
    player.addASCuePoint({time:i,name:"test"+i, type:"actionscript"});
}

// then, you can start listening for the cuepoints when the movie is playing:
player.addEventListener(MetadataEvent.CUE_POINT, cue_listener); 
function cp_listener(eventObject:MetadataEvent):void { 
    trace("Elapsed time in seconds: " + player.playheadTime); 
    trace("Cue point name is: " + eventObject.info.name); 
    trace("Cue point type is: " + eventObject.info.type); 
}