播放MPEG电影,在特定的地方开始和结束?

时间:2010-08-26 18:22:26

标签: flash movie mpeg playback seek

我使用FFMPEG将MTS视频编译成MP4格式。该视频长达2分钟。

我希望能够播放视频但是从0:15秒开始,在0:45秒结束。实际上我希望播放软件只显示30秒的播放时间。该软件必须是基于Flash的应用程序,以便集成到HTML中。

有谁知道会这样做的软件?提前谢谢。

2 个答案:

答案 0 :(得分:0)

<?xml version="1.0" encoding="utf-8"?>

<mx:Style>
    @font-face {
        src:url("assets/arial.ttf");
        font-family: Arial;
    }

    .timeStyle {
        color: #FFFFFF;
        font-family: Arial;
        font-size: 12;
    }

    .playPauseStyle {
        /* play button skins */
        skin: Embed('assets/control_play.png');
        downSkin: Embed('assets/control_play_blue.png');

        /* pause button skins */
        selectedUpSkin: Embed('assets/control_pause.png');
        selectedOverSkin: Embed('assets/control_pause.png');
        selectedDownSkin: Embed('assets/control_pause_blue.png');
    }

    .stopStyle {
        skin: Embed('assets/control_stop.png');
        downSkin: Embed('assets/control_stop_blue.png');
    }

    .controllerStyle {
        bottom: 5;
        left: 5;
        right: 5;
        paddingBottom: 5;
        paddingLeft: 5;
        paddingRight: 5;
        paddingTop: 5;
        alpha: 0;
        background-color: #000000;
        background-alpha: 0.5;
    }
</mx:Style>

<mx:Script>
    <![CDATA[
        import mx.events.VideoEvent;

        private function showControls():void {
            fadeIn.play([controls]);
        }

        private function hideControls():void {
            fadeOut.play([controls]);
        }

        private function videoDisplay_playheadUpdate(evt:VideoEvent):void {
            var pTime:Date = new Date(videoDisplay.playheadTime * 1000 || 100);
            var tTime:Date = new Date(videoDisplay.totalTime * 1000);
            time.text = dateFormatter.format(pTime) + " / " + dateFormatter.format(tTime);
        }

        private function playPauseButton_click(evt:MouseEvent):void {
            if (videoDisplay.playing) {
                videoDisplay.pause();
            } else {
                videoDisplay.playheadTime=**YOUR TIME HERE**
                videoDisplay.play();
            }
        }

        private function stopButton_click(evt:MouseEvent):void {
            videoDisplay.stop();
        }
    ]]>
</mx:Script>

<mx:Fade id="fadeIn" alphaFrom="0.0" alphaTo="1.0" />
<mx:Fade id="fadeOut" alphaFrom="1.0" alphaTo="0.0" />

<mx:DateFormatter id="dateFormatter" formatString="NN:SS" />

<mx:Label text="Mouse over the VideoDisplay control below to show control buttons." />
<mx:Canvas rollOver="showControls()" rollOut="hideControls()">
    <mx:VideoDisplay id="videoDisplay" source="http://www.helpexamples.com/flash/video/caption_video.flv" autoPlay="false" playheadUpdate="videoDisplay_playheadUpdate(event)" />
    <mx:HBox id="controls" styleName="controllerStyle" alpha="0.0">
        <mx:Button id="playPauseButton" styleName="playPauseStyle" toggle="true" selected="{videoDisplay.playing}" click="playPauseButton_click(event)" />
        <mx:Button id="stopButton" styleName="stopStyle" click="stopButton_click(event)" />
        <mx:Spacer width="100%" />
        <mx:Label id="time" styleName="timeStyle" />
    </mx:HBox>
</mx:Canvas>

或在此处查看更多内容 http://blog.flexexamples.com/2007/08/05/building-a-basic-controller-for-the-videodisplay-control/comment-page-1/#comment-329

答案 1 :(得分:0)

我发现了一些可以解决问题的服务器端软件:

http://h264.code-shop.com/

根据您运行的Web服务器提供不同的风格。允许视频流式传输。还可以让你决定从哪里开始和结束。