28 Replies Latest reply: Mar 12, 2012 9:10 AM by nebbb RSS

    H.264 Player Encoding

    ImAStreamer Community Member

      OK, I can't believe my eyes that this might actually be true. Are we actually going to be able to encode video in the Flash Player with something besides the old Sorenson Spark codec?  Big kudos to Adobe if that is the case!


      Can someone provide an example for this?  I haven't been able to see any documentation on it.



        • 1. Re: H.264 Player Encoding

          I'm interested in encoding video with h264 codec as well.


          Can please some one provide an example ?


          Thank you !

          • 2. Re: H.264 Player Encoding
            Jozsef V

            Yes, the incubator build supports H.264 encoding at baseline and main profiles. You have to set the codec settings on NetStream object. Here is simple example:


              var h264Settings:H264VideoStreamSettings = new H264VideoStreamSettings();
              h264Settings.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_2);
              stream.videoStreamSettings = h264Settings;


            where stream is the publishing NetStream object.

            • 3. Re: H.264 Player Encoding
              aylarov Community Member

              Looks like it works, very good! Another question - if I send H264 encoded video with Speex audio it plays both, if I send H264 encoded video with PCMA/PCMU it plays only sound, are there any restrictions on different audio/video codecs combintations?

              • 4. Re: H.264 Player Encoding
                bdefore Community Member

                What are the imports for H264Profile, H264Level, and H264VideoStreamSettings? We still don't have an updated language reference.

                • 5. Re: H.264 Player Encoding
                  bdefore Community Member

                  Trial and error... They are all in flash.media namespace.

                  • 6. Re: H.264 Player Encoding
                    Octavian Naicu Community Member









                    catalog.xml from the playerglobal051211.swc lists them.

                    • 7. Re: H.264 Player Encoding
                      Jozsef V Community Member

                      There should not be, PCM should work with H.264. We will investigate and get you back shortly.



                      • 8. Re: H.264 Player Encoding
                        bmai209 Adobe Employee



                        There should be no restriction on audio codec.  I've tried it with the incubator build with these audio codec and video and audio works just fine.  Can you provide me your system info (OS, browser(s), cpu, gpu, etc...) so we can try to repro this in house?  Can you also provide the source to your test media, that would help us a lot.

                        • 9. Re: H.264 Player Encoding
                          Octavian Naicu Community Member

                          I've modified my exiting recording app (hdfvr.com) to record h.264 video and Speex audio using FMS4 server.


                          The recorded data is stored in a new f4v file. When paying back this file trough srtreaming it works fine.

                          When trying to play it locally after passing it trough Adobe's f4v Post Processor tool (Adobe Media Player) the sound does not play.


                          I've heard Speex/ASAO are not compatibe with f4v/mp4. Is this true? If yes is there a solution?

                          • 10. Re: H.264 Player Encoding
                            aylarov Community Member

                            I'm using MacOS 10.6.7 and Macbook Pro 13'', I will check again and will post files.

                            • 11. Re: H.264 Player Encoding
                              ImAStreamer Community Member

                              I tried that and it looks to be working.  Thank you! Two more questions for you.


                              1) Is there a way to determine in a live stream what video codec is being using (could you add something to NetStreamInfo if something doesn't already exist)?

                              2) Just curious why you went with adding the h264Settings to the NetStream vs. doing something like Camera.codec?  For consistency sake, you already have Microphone.codec so why didn't you go with Camera.codec? Just curious.


                              Looking forward to the documentation update so we can really see all the goodies you added.


                              Thanks again!

                              • 12. Re: H.264 Player Encoding
                                Jozsef V Community Member

                                1) Yes, codec type is available in VideoStreamSettings class:


                                public class VideoStreamSettings


                                  public function setMode(width:int, height:int, fps:Number):void

                                  public function setQuality(bandwidth:int, quality:int):void

                                  public function setKeyFrameInterval(keyFrameInterval:int):void


                                  public function get width():int

                                  public function get height():int

                                  public function get fps():Number

                                  public function get quality():int

                                  public function get bandwidth():int

                                  public function get keyFrameInterval():int

                                  public function get codec():String



                                2) I understand that we could have used Camera.codec and it is little cumbersome to use the current API. However, this is a much cleaner and extensible way. Codec really does not belong to camera (you can send out one stream with Sorenson and one stream with H.264). Furthermore, we can also very easily add additional H.264 options to H264VideoStreamSettings.

                                • 13. Re: H.264 Player Encoding
                                  bmai209 Adobe Employee

                                  setMode, setQuality, and setKeyFrameInterval are available methods in the VideoStreamSettings object but it does not change the published streams setting.  Please use the same methods in the Camera object if you want to change these properties.

                                  • 14. Re: H.264 Player Encoding

                                    Hi there,


                                    I am also very curious how the quality of new h.264 encoding via Flashplayer will be.

                                    As I understood, AAC audio won't be supported?


                                    I am not familiar with coding with eclipse etc, so maybe one of you guys who is already testing out the new features

                                    could build an swf and upload it, so we others could have a first glance at it?


                                    Would be great if we could have a swf with input fields for rtmp, application name, and a few quality, profile etc. settings,

                                    so we could test it on our own fms...


                                    Anybody willing? I would personally throw in a pizza delivery for the brave coder!!!!





                                    • 15. Re: H.264 Player Encoding
                                      nonsensemidget Community Member

                                      I've got the same problem.  When the recorded file is processed with the post processor tool, the resultant file has no audio.


                                      Any ideas how to get round this?

                                      • 16. Re: H.264 Player Encoding
                                        bmai209 Adobe Employee

                                        I was able to repro the issue of video playing back without audio if the recorded stream is flatten using the f4v post processor tool.  We're currently looking into it now.  Will provide more information when I get them.

                                        • 17. Re: H.264 Player Encoding

                                          报名语句:rtmpVideoStream.videoStreamSettings = h264Settings;
                                          报错信息:163 行1119: 访问可能未定义的属性 videoStreamSettings (通过 static 类型 flash.net:NetStream 引用)。

                                          编译的时候 videoStreamSettings 这个属性不会被识别,H264VideoStreamSettings像这些类均可以,不明原因,请作者指教。
                                          是不是跟编译器有关系,我用的是Flash Profession CS5.5

                                          • 18. Re: H.264 Player Encoding
                                            CaliseCheung Adobe Employee

                                            Hi Nick,

                                                It seems like you haven't got the authoring environment setup properly for using this feature.  This feature needs to be published to swf 13.

                                            For targeting for swf 13 , here are the few things you can do: (instruction for English version CS5.5)
                                            1. The playerglobal.swc (the one you downloaded from the incubator site) needs to be located in on ActionScript 3.0 folder. I would create a folder call FP11 and place the playerglobal.swc there. (you should already have FP10.2 which is installed with Flash CS5.5)
                                            C:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\ActionScript 3.0\FP11\playerglobal.swc


                                            2. Then you will need to make a xml for new FlashPlayer11 to point the Flash to use it. It locates at C:\Program Files\Adobe\Adobe Flash CS5.5\Common\Configuration\Players . You can copy any of the existing one and modify it.




                                              <player id="FlashPlayer11" version="13" asversion="3">
                                               <name>Flash Player 11</name>
                                               <path builtin="true"/>
                                               <path platform="WIN">Device Central/adcdl.exe</path>
                                               <path platform="MAC">Device Central/adcdl</path>
                                               <playerDefinitionPath as2="$(UserConfig)/Classes/FP10;$(UserConfig)/Classes/FP9;$(UserConfig)/Classes/FP8;$(Use rConfig)/Classes/FP7" as3="$(AppConfig)/ActionScript 3.0/FP11/playerglobal.swc" />


                                            3. Launch Flash and create files, File > Publish Settings, you will see the Flash Player 11 which you just added.  Use it to publish the script.



                                            You can check if your swf is publishing to swf 13 by have those line in the code:


                                            // first frame

                                            loaderInfo.addEventListener(Event.INIT, init); function init(event:Event):void {

                                                  trace("SWF " + loaderInfo.swfVersion);




                                            • 19. Re: H.264 Player Encoding
                                              nick.yau Community Member

                                              Thank you for your reply, in accordance with your instructions, I have  to solve this problem, the code is debugged, to achieve the effect I  wanted, very much. The problem is because my version is not compiled  FlashPlayer 11 lead.

                                              • 20. Re: H.264 Player Encoding


                                                So H264VideoStreamSettings has setMode, setQuality... but they don't work. (I confirm this). So will they work when Flash Player 11 is released? I mean are just not working YET?


                                                It would be very useful as you could send 2 different streams from 1 camera for dynamic (high quality / low quality) purposes.


                                                Thank you


                                                • 21. Re: H.264 Player Encoding
                                                  Jozsef V Community Member

                                                  No, they will not work for Flash Player 11. But they will work in future release. We designed the API with future extensibility in mind.



                                                  • 22. Re: H.264 Player Encoding
                                                    peterflex Community Member

                                                    When encoding live in h264 with the FP 11 (incubator) then playing it live on another client (through FMS or red5 server) the video sometimes (1/3 of times) has major skips. It's almost as if the video goes back to some older keyframes and then returns to live. Same experience with FME or with non-h264 produces smooth video.

                                                    If the server (fms or red5) records the video, the replay looks smooth, which is strange because I would have assumed the FP was not encoding well (being an alpha or beta).

                                                    Has anyone had this issue? I'm using a simple netStream.play();

                                                    Thank you.

                                                    • 23. Re: H.264 Player Encoding
                                                      Jozsef V Community Member

                                                      What version and platform are you using? I think new builds will be coming out shortly, could you please try when available?

                                                      • 24. Re: H.264 Player Encoding
                                                        Nick Yau

                                                        I use

                                                        flashplay 11 and cs5.5, compiled can be used.
                                                        • 25. Re: H.264 Player Encoding
                                                          gtr Community Member

                                                          bmai209 wrote:




                                                          There should be no restriction on audio codec. \

                                                          Does this include multi-channel AAC? How about Dolby Digital AC3 passthrough?



                                                          • 26. Re: H.264 Player Encoding
                                                            Jozsef V Community Member

                                                            I meant the exact version number (like 11,0,1,57) tand whether osx/win/linux platform.



                                                            • 27. Re: H.264 Player Encoding
                                                              bmai209 Adobe Employee



                                                              The codec I am referring to is the one we currently support in Flash which are Nellymoser (default) and Speex.  We will add support PCMU and PCMA with this upcoming release.

                                                              • 28. Re: H.264 Player Encoding
                                                                nebbb Community Member

                                                                Any update on the fix for F4VPP (the audio not playing after processing a MP4 file)?