I'm using FMS 4.5 to record a live stream with H264 encoding. The broadcaster is Flash Player 11. The resulting MP4 file has video but no audio. I have spent a couple of days trying to figure this one out but it simply doesn't work properly. Could it be possible the audio encoders (Nellymoser and Speex) for Microphone object in Flash Player 11 are not compatible with MP4 container?
Here are some of my findings:
1) If I broadcast without H264 encoding, the resulting FLV file is correct and has both audio and video.
2) If I broadcast using H264 encoding, the resulting F4V/MP4 file has video but no audio.
3) If I record an FLV file with H264 encoding, the resulting file has audio but no video.
I understand that FLV container doesn't allow H264 encoding. But why does the MP4 container outputs with no audio after F4VPP post-processing?
Is there any other alternative solution to this problem? I'll really appreciate some help with this one.
Hi Apurva,
Here's my flash player broadcaster code:
-----------------------------
camera.setQuality(0,80);
camera.setMode(320,240,30);
mic.codec = SoundCodec.SPEEX;
mic.encodeQuality = 10;
mic.gain = micVolumeSlider.value;
mic.rate = 16;
mic.framesPerPacket = 2;
mic.setUseEchoSuppression(true);
mic.setSilenceLevel(0);
videoDisplay.attachCamera(camera);
h264Settings = new H264VideoStreamSettings();
h264Settings.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_3_1);
h264Settings.setQuality(0, 80);
h264Settings.setMode(320,240,30);
sendStream.attachAudio(mic);
sendStream.attachCamera(camera);
sendStream.videoStreamSettings = h264Settings;
sendStream.publish(eventID, "live");
-----------------------------
For the server-side, I'm using the default main.asc that comes with livepkgr (except that I have changed f4f: to mp4:) and im publishing the stream to EVENTID?adbe-live-event=liveevent&adbe-record-mode=record.
Can you tell me if you used the same settings to broadcast from flash player in your test? Did you play your mp4 back in a flash player with or without f4vpp post-processing?
Apurva,
I'm doing NetStream.publish("EVENTID.mp4?adbe-live-event=liveevent&adbe-record- mode=record", "live") so it should add .mp4 automatically right? The following is my player code:
<?xml version="1.0" encoding="utf-8"?>
<!-- controls\videoplayer\VideoPlayerEvent.mxml-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import org.osmf.events.MediaPlayerStateChangeEvent;
import org.osmf.events.TimeEvent;
protected function vpCompleteHandler(event:TimeEvent):void {
myTA.text = "Video complete - restarting."
}
protected function vpMediaPlayerStateChangeHandler(event:MediaPlayerStateChangeEvent):vo id {
if (event.state == "loading")
myTA.text = "loading ...";
if (event.state == "playing")
myTA.text = "playing ...";
}
]]>
</fx:Script>
<s:VideoPlayer
source="http://DOMAIN.COM/FILE.MP4"
width="350" height="250"
loop="true"
autoPlay="true"
complete="vpCompleteHandler(event);"
mediaPlayerStateChange="vpMediaPlayerStateChangeHandler(event);"/>
<s:TextArea id="myTA" width="350" height="25"/>
</s:Application>
Hi Adeel,
I'm sorry for the delay in reply. It took me some time to investigate the possibilites for you.
If you want to playback a live stream via http protocol, then you need to record the streams in f4f format. If you require to record the live stream in an mp4 container then I suggest you use rtmp playback.
Here are my suggestions -
1. If what you require is HTTP Dynamic streaming then please follow this : http://help.adobe.com/en_US/flashmediaserver/devguide/WSd391de4d9c7bd6 09-52e437a812a3725dfa0-8000.html
2. If recording to an mp4 container is your priority then, I suggest rtmp playback instead of http.
3. If you need both, i.e, store your live content and playback live via HTTP then I see 2 possibilities :
a. Use MPP (multi-point publish). So basically publish a live stream in f4f to one application and have that publish the live stream into mp4 container to another application. Although this leads to content duplication, you can playback the stream via http from the first application and also have your mp4 stream in the second application.
b. Else you can use the DVR functionality. By default the live stream is stored by the livepkgr on disk, by using DVR, the client can seek back and forth in the livestream and view from the start. However, the f4f fragments will be saved and not an mp4 file.
If you let me know what is the exact use-case I might be able to help you out better.
Thanks,
Apurva
Thanks for the detailed response and investigation Apurva. My use case is that I want to broadcast a live stream which is played using HTTP stream live and then later played from the generated MP4 file. So MPP is a great idea and I'll definitely use that to generate an mp4 and live stream with f4f.
But my main question still holds.
1) Whether I use MP4 or F4F, can either of these be played in a flash player directly without post-processing?
2) I tried post-processing a .f4f segment using f4vpp. The video plays back correctly, but there is no audio. I read somewhere on internet that this is a bug with f4vpp tool perhaps?
Thanks so much!
Hi adeel,
I'm sorry I didn't get back to you earlier but I investigated the issue on my end and am unable to reproduce your issue!
Here's the process I'm following :
1. I duplicate the default livepkgr in my applications folder and replace the main.far with the main.asc in samples.
2. I edit the main.asc as : var s = Stream.get("mp4:" + streamObj.name + ".mp4");
3. I publish a stream from FMLE with the streamname livestream
4. A livestream.mp4 is recorded in the streams folder.
5. During publish I tried : rtmp://<server-ip>/livepkgr/mp4:livestream.mp4 - playback is fine (audio and video)
6. After a few minutes I stop publish, copy my livestream.mp4 into webroot/vod and play as : http://<server-ip>/hds-vod/livestream.mp4.f4m - playback is fine (audio-video)
7. Then I downloaded the f4vpp from here : https://www.adobe.com/cfusion/entitlement/index.cfm?e=fms35 I copy the linux folder onto my machine and run the command :
./f4vpp -s -i livestream.mp4 -o flattened.mp4
I get the following messages :
The conversion process starts...
The conversion process completes successfully...
and the following output files :
flattened.smil and flattened_1.mp4
8. I copy the flattened_1.mp4 onto a windows machine and play it via vlc player - playback is fine (audio-video)
Are you doing anything differently?
Thanks,
Apurva
Apurva, Thanks again for all the details in your response. It's very helpful.
It works for me fine too if I use FMLE, but not when I use Flash Player 11 to broadcast. FMLE supports AAC and MP3 audio format while broadcasting but Flash Player 11 I believe is just limited to NELLYMOSER or SPEEX?
hi adeel.raza. i found this problem too! Do you have solution ?
North America
Europe, Middle East and Africa
Asia Pacific