Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

Netstrream.play.failed on Ubuntu 22.04

Open princeofspace opened this issue 2 years ago • 11 comments

Problem Description

SWF Content on Ubuntu 22.04 fails to stream mp4s. This was tested on various versions of the SDK and confirmed on AIR 33.1.1.889.

Steps to Reproduce

The following code is what I've been using to test with:

Files.zip

` package { import flash.net.NetConnection; import flash.display.MovieClip; import flash.net.NetStream; import flash.media.Video; import flash.events.NetStatusEvent;

[SWF(frameRate="24", width="800", height="800")]
public class Temp extends MovieClip {

	private var _connection:NetConnection = new NetConnection();
	private var _stream:NetStream;
	private var _video:Video = new Video();
	public function Temp() {
		_connection.connect(null);
		_stream = new NetStream(_connection);
		_video.attachNetStream(_stream);
		_stream.useHardwareDecoder = true;
		_stream.play('temp.mp4');
		
		_stream.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);

		_stream.client = this;

		addChild(_video);
	}

	private function onNetStatus(e:NetStatusEvent):void {
		trace('onNetStatus', e.info.code);
	}

	public function onMetaData(info:Object):void { }
	public function onTextData(info:Object):void { }
	public function onPlayStatus(info:Object):void { }
}

}

`

On a Mac, the result is that the video loads and plays with the following in the log:

onNetStatus NetStream.Play.Start onNetStatus NetStream.Buffer.Full onNetStatus NetStream.Buffer.Flush onNetStatus NetStream.Play.Stop onNetStatus NetStream.Buffer.Empty

On Ubuntu the video fails with the following log messages:

onNetStatus NetStream.Play.Start onNetStatus NetStream.Buffer.Full onNetStatus NetStream.Play.Failed onNetStatus NetStream.Play.Stop

Known Workarounds

I haven't been able to work around the issue.

princeofspace avatar Jun 21 '22 18:06 princeofspace

Hi - we're working on this, it looks like it's just linked with the removal of the software H.264 decoders from the runtime (due to patent licensing restrictions) so we're working on implementing a platform-specific implementation like was previously done for macOS/Windows...

thanks

ajwfrost avatar Jun 22 '22 10:06 ajwfrost

Video still doesn't work for Linux with latest AIR 50.0.1.1.

itlancer avatar Oct 17 '22 15:10 itlancer

@ajwfrost With latest AIR 50.2.2.1 it marked as resolved but for us it still doesn't work. The same NetStream.Play.Failed. Tested with multiple different Ubuntu 22.04 devices (also with VM). In all cases ffmpeg installed with OS:

whereis ffmpeg
ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz

itlancer avatar Mar 21 '23 13:03 itlancer

@itlancer This isn't using the ffmpeg binary, but rather the ffmpeg libraries (libavcodec.so and friends)

@ajwfrost Even using AIR 5.2.2.2, we can't get this to work. We are seeing "Invalid picture dimensions: 0 x 0!" which corresponds to a log message in libavcodec/indeo3.c. We built a minimal set of ffmpeg 5.1.2 libraries [1] just to support and test h.264 decoding and debug that issue. Using that, avcodec_find_decoder called with AV_CODEC_ID_INDEO3, which points to a difference between the enum in upstream and the version you are compiling against since AV_CODEC_ID_H264 is right next to it. Patching ffmpeg around that, we get further, but it crashes before displaying any frames of the video.

[1] We compiled using ./configure --prefix=~/ffmpeg --disable-stripping --disable-all --enable-protocol=file,cache,data,pipe,tee,unix --enable-parser=aac,aac_latm,h264,mpeg4video,mpegvideo,mpegaudio --enable-vaapi --enable-vdpau --enable-decoder=h264 --enable-avcodec --enable-avformat --enable-avfilter --enable-avdevice --disable-static --enable-shared --enable-rpath --enable-rdft --enable-filters --enable-ffplay --enable-demuxer=aac,avi,h264,m4v,mov && make && make install

BwackNinja avatar Mar 22 '23 21:03 BwackNinja

Hi Thanks for the details .. so this may be a mismatch between build time and run time I guess. I was just taking a look, we seem to have different classes to cope with different versions of ffmpeg (are they really not compatible?) -> it seems an app built against an older version of ffmpeg may not work when run on a newer version. Will ask the developer to look into this again... thanks

ajwfrost avatar Mar 23 '23 06:03 ajwfrost

Some success here. Tried several versions (including a couple libav releases) and they all still see avcodec_find_decoder called with AV_CODEC_ID_INDEO3, but FFmpeg 4.4.3 doesn't crash after patching around that. We can get video to display using the standard Video component, but it doesn't display with VideoTextures even though VideoTextures do now work with .flv files (so https://github.com/airsdk/Adobe-Runtime-Support/issues/2296 seems to be resolved).

There are issues with some video files though, which play fine on other platforms, ffmpeg-based players, and ffplay. With those videos, a frame of video does display, then the message [h264 @ 0x7fd2d400a940] no frame! is written to the command line when running, coming from ffmpeg, followed by the message Error decoding frame. I had better luck after encoding to the baseline profile.

BwackNinja avatar Mar 23 '23 23:03 BwackNinja

Andrew... Are there still plans to implement the ability to play MP4 (H.264) videos on iOS devices? Currently, we have to use FFmpeg to convert the MP4 video to FLV's in order to play the video on iOS devices.

amorganiv avatar Jun 27 '23 23:06 amorganiv

Hi @amorganiv -> just checking, do you need to use the Video class for playback or could you instead use StageVideo? This should give you the playback capabilities on iOS.

We are looking at all this currently though, one of the team was checking how we could pull out the decoded video frames from the iOS av player and upload them into the internal rendering system for use in Video objects.. so all this sort of thing (and also the ability for external components - i.e. ANEs - to be able to push decoded frames/data into AIR) is definitely still planned!

thanks

ajwfrost avatar Jun 28 '23 09:06 ajwfrost

Andrew... The StageVideo does work on iOS devices. Thank you! The only minor drawback is StageVideo objects always display behind other objects on the stage. The Video object is added to the display list. Glad to hear the team is looking into supporting the Video option on iOS.

amorganiv avatar Jun 28 '23 18:06 amorganiv

Has there been any update to this? We're still very interested in using video decoding capabilities with the Linux runtime, especially with hardware acceleration.

Also willing to test any new code as its being developed.

BwackNinja avatar Jul 13 '23 17:07 BwackNinja

@ajwfrost Video playback still doesn't work even with latest AIR 51.0.1.1 for Linux. NetStream::play() with IDataInput/ByteArray also doesn't work https://github.com/airsdk/ANE-PlayAssetDelivery/issues/20#issuecomment-1978250262 In any case:

NetStream.Play.Start
NetStream.Buffer.Full
NetStream.Play.Failed
NetStream.Play.Stop

itlancer avatar May 10 '24 19:05 itlancer