Link to home
Start Free TrialLog in
Avatar of StarDusterII
StarDusterII

asked on

Flex StageVideo has audio but no video

I'm trying to use StageVideo in a Flash Builder 4.5.1 project for a view based mobile app.  I'm using the SimpleStageVideo .swc from Thibault Imbert.  I hear the audio but don't see the video.  What have I done wrong?

nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.client = this;
simpleStageVideo = new SimpleStageVideo(320,240);
simpleStageVideo.addEventListener(Event.INIT, onInit);
simpleStageVideo.addEventListener(Event.ACTIVATE,onStatus);
simpleStageVideo.attachNetStream(ns);

var container:UIComponent = new UIComponent();
container.width = stage.stageWidth;
container.height = stage.stageHeight;
addElement( container );
container.addChild(simpleStageVideo);
ns.play(videoFile);

I'm also using -swf-version=11 in my additional compiler options.  Many posts say use 13 or 14 but I get a run time error (project terminated before connecting to debugger) when I try to start the project.  This may be the problem.  I'm using the 11.1 Flash debugger version.  
Avatar of ☠ MASQ ☠
☠ MASQ ☠

This is likely to be a video codec issue prior to the Flash conversion. What format is the original and how is the video stream encoded?
Avatar of StarDusterII

ASKER

Well, I've tried a number of mp4's and flv's and get the same result.  I can play the .flv's using the VideoDisplay comonent so I figured they should be fairly straight forward for playback so I've been mostly using them.  They were recroded from a live stream and encoded using Red5.  
Ok, I got my -swf-version problem solved... had to change the applicaiton-app.xml namespace to 3.1.  Now the app launches but still doesn't display video... just plays audio.
As far as the .flv format goes, it's video codec ID = 2 and Sorenson h.263.
If you are using Adobe AIR why you don't want to to try load movie using SWFLoader

<mx:SWFLoader id="swfLoader" width="100%" height="100%" scaleContent="false"
                      creationComplete="swfLoader.load('http://www.youtube.com/v/9AZDdthRhu8&feature?version=3')"/>
I can't play the youtube link.. but I also want to play mp4's so SWFloaded probably not a good choice.  I'm not sure but I don't think SWFloader plays .flv's either.
I gave you example of youtube because are using FLV format and mp4

Can you try and let me know if working for you or not?
Yeah, the youtube link doesn't work.  Say it was disabled by request when I try to play it.

I suspect that MASQUERAID is correct when talking about the codec.  I encoded it with ffmpeg for an iOS device and stageVideo just may not like that format.  I'll try to find an example mp4 from the OSMF site and test it with that.  Was really hoping to find a mp4 format that would work for both iOS and Android.
Sorry, I forgot to clarify that I did get the video working with .flv's.  I intended to include that fact in my comment to MASQUERAID but obviously I didn't.  That's why I think he's right about the video codec used for the mp4 videos (which aren't working).  To get this to play, I switched to the OSMF MediaPlayerSprite.

mps = new MediaPlayerSprite();
mps.width = 320;
mps.height = 240;
mps.scaleMode = ScaleMode.LETTERBOX;
if (container == null) {
container = new UIComponent();
addElement( container );
container.addChild(mps);
mps.resource = new URLResource(fileName);      
                                    }
Why you cannot convert mp4 files to FLV?
I'm generating both mp4 and flv, but they have to play on both iOS and Android devices.  I haven't had much luck with flv's on iOS.
Should work FLV  and MP4 is the same format
ASKER CERTIFIED SOLUTION
Avatar of ☠ MASQ ☠
☠ MASQ ☠

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I was originally encoding the mp4's with ffmpeg specifically for the iPad/iPhone.  The parameters I'm using are:

-acodec libfaac -ac 2 -vcodec mpeg4 -r 15 -s 640x480 -b 256kb -ab 96kb -ar 8000 -coder 1 -flags +aic+cbp+loop+mv4+naq -trellis 1

So, I guess I need to find what the OSMF player wants to see in an mp4.
Well, I got the mp4 to play by encoding with the following parameters:

-acodec libfaac -ac 1 -vcodec libx264 -r 15 -s 640x480 -ar 11025 -b 256k

I switched to the libx264 video codec rather than mpeg4 so I'm guessing that's the difference.  I can't test the ability to play this format directly because my son currently has my iPad but I think we have the answer.
Thanks, does sound like you're there now. I'm really sorry to have abandoned you somewhat on this one - real life getting in the way!