Flash CS3 (9.0.2) Supports New Video and Audio Codecs; FLVPlayback Works, But …

Flash ActionScript 3.0

If you want to be able to deliver non-FLV video in Flash (how cool is that?!), head over to the Adobe Flash Support Center and download the Adobe Flash Player Update for Flash CS3 Professional (9.0.2).  The result?  At runtime, you’ll be able to load MOV and MP4 files encoded in the H.264 hi-def codec.  This is in addition to the usual FLV, and we’re talking Flash Player 9 only (specifically, version 9.0.115.0 or higher).  You’ll also be able to load M4A audio instead of only MP3.  The upgrade to the IDE allows you to view such content as you test and debug SWFs right in the authoring environment.  I’ve already installed and tested, and the update works … but I have seen one stumbling block.  You can work around it — in fact, you can work right through it — but it isn’t especially obvious. 

Using the FLVPlayback component

If you’re coding up your video content with a Video object and NetConnection/NetStream, you won’t see any issues, but if you’re a fan of FLVPlayback, you’ll have to fly blind during a few steps that are normally straightforward.  Here’s what happens for me in Windows XP (and perhaps your mileage may vary):

I drag an instance of FLVPlayback from the Components panel to the Stage.  I select the Parameters tab of the Property inspector and double-click source so I can browse to one of the new video file types.  This opens a Content Path dialog with a button that browses for files.  I click that button to locate an MP4 file, which opens a Browse for FLV file dialog, but nothing shows — even though I’m in the folder that has such files.  The reason nothing shows is because the Files of type list box in this dialog only has an entry for *.flv files.  To get around that, I type *.* into the File name field and hit Enter.  Now I can see my MP4s (and every other file type in that folder).  I double click my MP4.

Flash chews on that for a while.  Honestly … maybe a minute and a half.  Finally, Flash tells me “Failed to load FLV: [name of file].”  This surprises me, because, well, I didn’t browse for an FLV.  ;)   But I forged ahead anyway and clicked OK.  I selected Control > Test Movie to see if the association succeeded anyway.  It did.

So it does work.  But Flash plays a bit of hide-and-seek with you while it gets you there.  My take on it is, roll with the flow.  :)   It’s too bad that the manual association doesn’t seem to realize the new possibilities, but if it really gets on your nerves, you can always just set that source parameter via ActionScript 3.0:  just give your FLVPlayback component an instance name in the Property inspector, such as videoPlayer, and set its FLVPlayback.source property:

videoPlayer.source = "coolNewFormat.mp4";

23 Responses to “Flash CS3 (9.0.2) Supports New Video and Audio Codecs; FLVPlayback Works, But …”

  1. Martin Says:

    Thank you for posting this. I also was very confused because the FLVPlayback component didn’t appear to have changed.

    Unfortunately the “*.*” trick doesn’t work on a Mac. While it was possible before the update, now there is no way to select anything other than .flv. I hope Adobe will give us this possibility some day.

    Somewhere on Adobes website I found a solution. It works well with manually selecting the source of the FLVPlayback component and it is simple. Just rename the .mp4 file to .flv!

  2. David Stiller Says:

    Martin,

    Oh wow! Good find! Thanks for sharing this. That makes sense, too: it’s the codec that matters. The file extension doesn’t necessarily mean anything.

  3. Scott Says:

    This is a great tip… it does work on a Mac as well, you just have to specify the name manually because the OS dialog box will not let you do *.*

    So, don’t even bother browsing, just type the path in.

    Much easier then the action scrip stuff..!

  4. Michael Hoskins Says:

    Tinic Uro says that there will be new file extensions registered for new FLV containers: http://www.kaourantin.net/2007/10/new-file-extensions-and-mime-types.html

    I didn’t do the update yet, so can you say if .f4v works? Might have been overlooked in the update, though, if it’s only looking for .flv.

  5. David Stiller Says:

    To Scott …

    Glad it’s working for you!

    To Michael …

    I haven’t tried the F4V extension yet, but thanks for that link! I find Tinic’s blog entries to be very useful, and this one is a keeper.

  6. Tiago Dias Says:

    To Michael

    You can easily rename your mp4 to f4v and the FLVPlayback component will still be able to playback the file.

    To David
    When I select my file, all the ones I’ve selected until now are below 5minutes of playtime, the dialogbox goes away instantly and plays out correctly. Maybe there’s something else in the way..

  7. David Stiller Says:

    Tiago,

    Thanks for the input! :) In my tests, the duration of the video file has little bearing on the dialog box delay. Curious, eh?

  8. dzedward Says:

    Hey David, I’m sort of in a pickle with this. For some reason, my FLVPlayback isn’t accepting the mp4s.. I’ve created a Drag and Drop app with AIR, and I’m in process of updating to Beta 3. I figured as I was doing that, I’d add support for H.264 encoded media, might as well right. So I get this error when the mp4 gets dropped into the app

    VideoError: 1005: Invalid xml: URL: “file:///Users/dedmonds/Desktop/chaplin.mp4″ No root node found; if url is for an flv it must have .flv extension and take no parameters
    at fl.video::SMILManager/http://www.adobe.com/2007/flash/flvplayback/internal::xmlLoadEventHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    When it talks about ‘url’ it’s referring to the way I’m accepting the media on the drop… You think this is just not possible with AIR yet? I don’t see why not though…
    dz

  9. David Stiller Says:

    dz,

    I think I have an answer, but unfortunately, it’s only partly an answer. Tom Green, Adam Thomas, and I have been collaborating on a new book (I’m tech reviewer, this time). As you might expect, the book addresses the new H.264 support, and we’ve all been experimenting with it — but have run into a few snags. The good news is that Adobe is working with us (they’re always good like that!), but until everything gets finalized, it only makes sense not to steer anyone the wrong way. Out of respect, we’re holding off on conveying anything that might be subject to change.

    I imagine there might be a TechNote on the subject, but I don’t know for sure. As soon as I have anything useful, I’ll write up a new blog on it and try to remember to link from the comments on this one.

  10. Brian McBride Says:

    David,

    I am getting the same error as DZ/ My encode is from Sorenson Squeeze (latest version).

    I am loading the movie into the FLVPlayback component via AS3:
    videoContainer.tourVideo.load(”TESTa.mp4″);

    Any ideas?

  11. David Stiller Says:

    Brian,

    For better or worse, I’ve got to give you the same reply as I did dz. Until a resolution has been made “official” or public (i.e. with the publication of the book), the writing team has been asked to keep mum.

  12. Pascal Says:

    Hi,

    I’ve also made a try by downloading the following file supposed to be h264 encoded :
    http://blacksharkfr.free.fr/tm/Island_Tour_h264.avi

    I am loading the movie into the FLVPlayback and set the contentPath to Island_Tour_h264.avi, and I get a blank screen.. Strange, maybe it is not h264 video content.

    I tried with another movie found on http://www.osnews.com/story/19019/Theora_vs._h.264
    It works.

    In fact, I get the impression that some are working, some not…. :(

  13. Pascal Says:

    By the way, Is there any way to test whether the video is valid h264 one ?

  14. David Stiller Says:

    Pascal,

    I’m seeing the same thing — some work and some don’t — and as soon as I get the green light on sharing some of the answers turned up by our research, I’ll be sure to share! :) I’m really not trying to be cagey about it … it’s just that this book isn’t really “mine.”

  15. Pascal Says:

    I understand ! :)
    If I find something on my site, I will let you know ;)
    Thanks David.

  16. David Stiller Says:

    Pascal,

    Sure thing. :)

  17. Pascal Says:

    David,

    here I found a link who may help :
    http://www.adobe.com/devnet/flashplayer/articles/hd_video_flash_player.html

    especially the paragraph telling that Flash player doesn’t support h264 video encoded with alpha channel. Maybe it was the case with tha video which wasn’t working ….

  18. Robin Casey Says:

    If you get into some errors, like 1005;

    try to handle your php/asp flv-rendering-source in Flash like:
    your-path-way/to/heaven/ STREAM-HANDLER . php / anything-here.flv
    .php COULD be .asp here, :-p

    Flash adds ?xxxx to the file, so faking an extension in any other way won’t work.

  19. David Stiller Says:

    Robin,

    Thanks!

  20. Bob Says:

    Hello David,
    I jus bought the EdAS3 video book..Question. In AS3 I have a timeline. When the ser clicks to go to certain frame label I have a 3 second intro and outro flv palying in the back ground problem is it works ok the first time but if you go back to any of the pages you hear the flv playing but you don’t see the video..any help? Be happy to send you the file maybe there is a bewtter way to do this.
    Thanks Bob

  21. David Stiller Says:

    Bob,

    Based on what you’ve described, I don’t have an answer off the top of my head. When you say “go back to any of the pages,” I’m not sure what you mean. Are you saying you can leave the HTML page that actually holds the SWF and still hear the audio?

  22. Tom Trucco Says:

    Is one of the bugs that you can’t scrub in flash player with h.264 video? Have you found any workaround for it?

  23. simonini Says:

    the tips “rename f4v in flv” with flash cs3 update works for my stuff.

Leave a Reply