Skip navigation
ImAStreamer
Currently Being Moderated

H.264 Player Encoding

May 12, 2011 5:32 PM

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.

 

Thanks!

 
Replies
  • Currently Being Moderated
    May 13, 2011 4:32 AM   in reply to ImAStreamer

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

     

    Can please some one provide an example ?

     

    Thank you !

     
    |
    Mark as:
  • Currently Being Moderated
    May 13, 2011 8:08 PM   in reply to Spoh

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 14, 2011 7:14 AM   in reply to ImAStreamer

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    May 14, 2011 10:54 AM   in reply to ImAStreamer

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

     
    |
    Mark as:
  • Currently Being Moderated
    May 14, 2011 11:01 AM   in reply to bdefore

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

     
    |
    Mark as:
  • Currently Being Moderated
    May 14, 2011 1:14 PM   in reply to bdefore

    try

     

    flash.media.H264VideoStreamSettings

    flash.media.VideoStreamSettings

    flash.media.H264Level

    flash.media.VideoCodec

    flash.media.H264Profile

     

    catalog.xml from the playerglobal051211.swc lists them.

     
    |
    Mark as:
  • Currently Being Moderated
    May 14, 2011 11:11 PM   in reply to aylarov

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

     

    Jozsef

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2011 8:49 AM   in reply to aylarov

    aylarov,

     

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2011 10:09 AM   in reply to bmai209

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2011 1:25 PM   in reply to bmai209

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

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2011 4:01 PM   in reply to ImAStreamer

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 17, 2011 11:09 AM   in reply to Jozsef V

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 20, 2011 3:37 AM   in reply to ImAStreamer

    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!!!!

     

    Cheers

     

    thomas

     
    |
    Mark as:
  • Currently Being Moderated
    May 22, 2011 11:00 AM   in reply to Octavian Naicu

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    May 25, 2011 4:49 PM   in reply to nonsensemidget

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 13, 2011 4:41 AM   in reply to Jozsef V

    你好,你的文章很受用,但是要实现的时候,总是报一个错,swc也已经导入,麻烦看看知不知道原因:
    报名语句:rtmpVideoStream.videoStreamSettings = h264Settings;
    报错信息:163 行1119: 访问可能未定义的属性 videoStreamSettings (通过 static 类型 flash.net:NetStream 引用)。

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

    Attachments:
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 13, 2011 10:39 AM   in reply to nick.yau

    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.

     

    Sample:

     

    <players>
      <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;$(UserConfi g)/Classes/FP8;$(UserConfig)/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);

    }


      

     

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 14, 2011 1:34 AM   in reply to CaliseCheung

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 15, 2011 6:33 PM   in reply to bmai209

    Hi,

    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

    P.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2011 8:17 AM   in reply to peterflex

    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.

     

    Jozsef

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 9, 2011 1:08 PM   in reply to ImAStreamer

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 11, 2011 5:47 PM   in reply to peterflex

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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 11, 2011 6:26 PM   in reply to Jozsef V

    I use

    flashplay 11 and cs5.5, compiled can be used.
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 12, 2011 5:20 AM   in reply to bmai209

    bmai209 wrote:

     

    aylarov,

     

    There should be no restriction on audio codec. \

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

     

    Thanks!

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 13, 2011 10:53 AM   in reply to Nick Yau

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

     

    Jozsef

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 13, 2011 11:03 AM   in reply to gtr

    gtr,

     

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 12, 2012 9:10 AM   in reply to bmai209

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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points