We help IT Professionals succeed at work.

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.  
Comment
Watch Question

Most Valuable Expert 2013

Commented:
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?

Author

Commented:
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.  

Author

Commented:
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.

Author

Commented:
As far as the .flv format goes, it's video codec ID = 2 and Sorenson h.263.
Top Expert 2011

Commented:
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')"/>

Author

Commented:
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.
Top Expert 2011

Commented:
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?

Author

Commented:
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.
Top Expert 2011

Commented:
But you already start using OSMF check your solution in this post

http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Q_27187551.html

Author

Commented:
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);      
                                    }
Top Expert 2011

Commented:
Why you cannot convert mp4 files to FLV?

Author

Commented:
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.
Top Expert 2011

Commented:
Should work FLV  and MP4 is the same format
Most Valuable Expert 2013
Commented:
"FLV  and MP4 is the same format"

That's not the case, although both MP4 and FLV are container formats, this means there is not a fixed method of encoding and different codecs could be used.

Ignoring audio streams

.FLV is usually (but not always) a container for On2 VP6, Sorenson Spark, Screen video, Screen video 2 and H.264

.MP4 can be used as a container for at least 20 different video formats in addition to those listed for .FLV

The contention here is that either the video stream of the source is incompatible with the encoding process or the end result is a video format that is unsupported for playback on the client.  My money is on the former but without experimenting with different source streams it's going to be difficult to track this down.

Author

Commented:
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.

Author

Commented:
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.
Most Valuable Expert 2013

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