Skip to main content
Participant
June 1, 2012
Question

Recording/Streaming with H264 Produces bad MP4

  • June 1, 2012
  • 3 replies
  • 1504 views

I have installed FMS 4.5 and trying to use my flash recorder app to stream to the FMS to produce an MP4 file. An MP4 file gets generated on the FMS server but the file cannot be played with quicktime, VLC player, or windows media player. Can anyone kindly help me figure out what I am doing wrong or point me to right direction?

Here is my flash code:

private function init():void

{                                      

_netConnection = new NetConnection();

_netConnection.client = this;        

_netConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

_netConnection.connect("rtmp://127.0.0.1/test");

...

}

private function publishStream():void

{                                    

_netStreamRecord = new NetStream(_netConnection);

_netStreamRecord.bufferTime = 360;       

                                                                            

var h264Settings:H264VideoStreamSettings;                                     

h264Settings = new H264VideoStreamSettings();                                 

h264Settings.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_3_1);      

h264Settings.setQuality(90000, 90);                                           

h264Settings.setMode(640,480,12);                                                                                 

_camera.setQuality(90000, 90);                                                

_camera.setMode(640,480,12,true);                                                                                 

_camera.setKeyFrameInterval(6);                                               

                                                                                              

                                                                                              

_microphone.codec = SoundCodec.SPEEX;                                         

_microphone.encodeQuality = 10;                                               

_microphone.gain = 50;                                                        

_microphone.rate = 16;                                                        

_microphone.framesPerPacket = 2;                                              

_microphone.setUseEchoSuppression(true);                                      

_microphone.setSilenceLevel(0);                                               

_netStreamRecord.attachCamera(_camera);            

_netStreamRecord.videoStreamSettings = h264Settings;

_netStreamRecord.attachAudio(_microphone);

_netStreamRecord.publish("mp4:test.mp4", "record");

var metaData:Object = new Object();                            

metaData.codec = _netStreamRecord.videoStreamSettings.codec;   

metaData.profile = h264Settings.profile;                       

metaData.level = h264Settings.level;                           

metaData.fps = _camera.fps;                                    

metaData.bandwith = _camera.bandwidth;                         

metaData.height = _camera.height;                              

metaData.width = _camera.width;                                

metaData.keyFrameInterval = _camera.keyFrameInterval;          

metaData.copyright = "VideoGenie Inc., 2012";                  

_netStreamRecord.send("@setDataFrame", "onMetaData", metaData);

}

Thanks in advance for your help

This topic has been closed for replies.

3 replies

Known Participant
June 1, 2012

Use f4vpp to process the MP4 file. The generated mp4 file needs post-processing before it can be played in different players.

vgdevAuthor
Participant
June 4, 2012

Great. Thaks. That answers that. But is there any way to automatically run f4vpp on the recorded files as soon as they are done publishing? Either through an automatic post-process or through a secondary call to a method on fms from my flash recorder code? If none of these are an option, is there a way for an external script to know if the file on disk is done recording (and it is not being streamed to) to run f4vpp on it?

MichaelKazlow
Legend
June 1, 2012

Moved to the Flash Media Server Forum

Mylenium
Legend
June 1, 2012

Ask such specific questions in the product forum.

Mylenium