A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Best way to play mp4 video or convert flv

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    3

    Unhappy Best way to play mp4 video or convert flv

    Hello,
    I am creating a projector for windows which is supposed to play
    various videos.

    The client would like to plaw WMV. I told him it's not possible. Is it?

    What is the best way to play an mp4 video so It has no loss of frames, rapid freezes, or other disturbing effects? So it can play smoothly.

    Or what the best compromise in quality compression to FLV format, to have it run smoothly?

    Thanks.

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    If your machine is slower you're going to lose frames no matter what format you try to play or how you try to play it. Most playback codecs are designed to degrade gracefully but on slow hardware or when you have to push a LOT of bits to play a video, it's not going to be pretty.

    The only things you can do are (1) reduce the quality or bitrate of the video until it plays smoothly on your test machines or (2) find a better way to play the video.

    You can't play WMV files with Flash but you can do it with a commercial projector tool. This is also another way to play video more efficiently. My product, SWF Studio, includes a video player based on Windows Media Player that CAN play WMV files (or any other type WMP can handle) and it will be very close to the same efficiency as you see in WMP.

    Note: We're also working on a newer DirectShow based playback solution that will really open up the ability to play and even protect your video.

    Here's a list of commercial tools that you might want to have a look at...

    SWF Studio http://www.northcode.com (my baby)
    mProjector http://www.screentime.com
    SWFKit http://www.swfkit.com
    SWiSH Studio http://www.swishzone.com
    Jugglor http://www.jugglor.com
    Zinc http://www.multidmedia.com
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

  3. #3
    Junior Member
    Join Date
    Dec 2010
    Posts
    3

    Northcode

    I did download your baby just minutes before you told me.

    Openened it. How can I produce a little projector to test the ability of the palyer? (want to play WMV)

    Should I create the SWF in flash ( I have cs4) and then import in northcode?


    Important: is there a way to set the video play full sceen and then exit video from full screen WITHOUT exiting the projector from fullscreen?

    Thanks.

  4. #4
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Create a new FLA (test.fla) and drop this code (below) in it.

    Publish test.FLA to test.SWF.

    Open SWF Studio and drag and drop test.SWF on the UI, which will ask if you want to make this your main movie. Say yes.

    Save this proect in the same folder as your FLA as test.SPF.

    Press the Build button in SWF Studio and it should generate test.EXE in the same folder.

    Make sure there's a WMV file called test.wmv in the same folder as your finished EXE.

    Run the EXE.

    Code:
    ssCore.init();
    ssDefaults.synchronousCommands = true;
    
    // this should be the first WMVideo command executed 
    // by your application (otherwise it defaults to an older 
    // interface of WMP which is less functional)
    
    ssCore.WMVideo.setVersion({version:"9"});
    
    // tell SWF Studio where to find your video (i.e. in the 
    // same folder as the EXE, and called "test.wmv")
    
    ssCore.WMVideo.setResource({resource:"startdir://test.wmv"});
    
    // set the size of the video window to match your projector
    // window size
    
    ssCore.WMVideo.setPosition({x:0, y:0});
    ssCore.WMVideo.setSize({width:Stage.width, height:Stage.height});
    
    ssCore.WMVideo.setNotify({event:"onComplete"},{callback:onComplete});
    
    function onComplete(return_obj, callback_obj, error_obj)
    {
        // stop video without quitting projector (it should stop
        // anyway in onComplete, but you can call WMVideo.stop
        // any time you like to stop the video
        ssCore.WMVideo.stop();
    }
    
    // start the video playing 
    ssCore.WMVideo.play();
    If you make the projector start in fullscreen mode... see the Size setting on the Window Tab then can use the code above (WMVideo.setSize, WMVideo.setPosition) to make the video match the size of the projector.

    You can also use WMVideo.setFullscreen to move the video in and out of fullscreen mode whenever you like. If you want to make it work like FLV playback, disable the Exit when the escape key is pressed option on the Application Tab and you can manage the ESC key yourself.

    That's a bit of a firehose of information all at once so if you have any questions, just let me know
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

  5. #5
    Junior Member
    Join Date
    Dec 2010
    Posts
    3

    I tried with no success

    Hello,
    I tried with no success..

    I created a new test.fla with nothing but the code you told me, in it.
    Then I created the test.swf, imported in Northcode, and launched the build.

    The projector is created but nothing happens. Only a white screen.
    Should I add some buttons or what?

    Apart from the fact that I get an Eset antivirus alert by opening it.
    I could not redistribute software with fake or not Alerts.

  6. #6
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Check out http://www.northcode.com/support/delbono_video.zip (3.29M).

    I've included the FLA source and a compiled EXE in the ZIP file.

    All you have to do is put a file called test.wmv in the same folder as the EXE and it will play it. I've enhanced this one a bit with some keyboard helpers.

    ctrl+p - play (or replay) video

    ctrl+f - fullscreen (affects window)
    ctrl+n - normal window

    alt+f - fullscreen (affects just video)
    alt+n - normal window

    The alt+f and alt+n keys use WMVideo commands to enable fullscreen video playback without changing the size of the screen. This uses hardware acceleration on most systems and should play better.

    We had problems with false positives from some virus scanners with 3.8 but the version I used for this EXE is much better. I ran video.exe through virustotal.com and it triggered one really obscure scanner and trend micro.

    I can get you access to the same development build if you want to try this. I know people
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center