Video on multiple platforms

What version of Visual Studio are you using?

I read this on MSDN:

Beginning with the UCRT in Visual Studio 2015 and Windows 10, vsnprintf is no longer identical to _vsnprintf . The vsnprintf function complies with the C99 standard; _vnsprintf is retained for backward compatibility with older Visual Studio code.

Iā€™m not sure if this matters, if we need to modify the library to use a different version?

Visual Studio 2017

I do not know exactly what the problem may be (I have no knowledge of c ++). Is there no way that the library works out of the box ?. As with other extensions?

Does it compile any differently if you replace vsnprintf with _vnsprintf in the library?

I just do not know where to change that ā€¦ In what file?

The package has been installed here: C: \ HaxeToolkit \ haxe \ lib \ openfl-webm \ 0,0,4 \

I tried (blindly, without knowing) to run ā€œclean.batā€ and then ā€œbuild_windows.batā€. A similar error (_vnsprintf) occurs in other files. But as I say, Iā€™m not used to working with a C ++ file structure

If you tell me a source file (with the path where it is, because there are many branches in that structure) I can open it and replace vsnprintf with _vnsprintf.

Maybe here? https://github.com/HaxeExtension/extension-webm/search?q=vsnprintf&unscoped_q=vsnprintf

Dont know if extension-web is the same version as openfl-webm, but the content of the files does not match ā€¦

I have searched in an editor all the matches of vsnprintf in the whole local structure, and I have modified it manually with _vsnprintf. The result of the compilation is similar:

C: \ HaxeToolkit \ haxe \ lib \ openfl-webm \ 0,0,4> openfl rebuild openfl-webm windows
Link: ā€¦/ndll/Windows/openfl-webm.ndll
Creating library obj / lib / openfl-webm.lib and object obj / lib / openfl-webm.exp
vpx.lib (postproc.c.o): error LNK2001: external symbol _vsnprintf unresolved
LIBCMT.lib (vsnprintf.obj): error LNK2001: external symbol _vsnprintf unresolved
vpx.lib (vp8_dx_iface.c.o): error LNK2001: external symbol _vsnprintf unresolved
vpx.lib (onyxd_if.c.o): error LNK2001: external symbol _vsnprintf unresolved
vpx.lib (threading.c.o): error LNK2001: external symbol _vsnprintf unresolved
vpx.lib (decodframe.c.o): error LNK2001: external symbol _vsnprintf unresolved

LIBCMT.lib (vsnprintf.obj): error LNK2001: external symbol __vsnprintf unresolved
obj / lib / openfl-webm.ndll: fatal error LNK1120: 2 external unresolved

oh, interesting:

https://social.msdn.microsoft.com/Forums/en-US/5150eeec-4427-440f-ab19-aecb26113d31/updated-to-vs-2015-and-now-get-unresolved-external-errors?forum=vcgeneral

Perhaps it does not need to be changed, but needs additional headers in each file, like <stdio.h>?

It seems that the files containing vnsprintf, already contained the #include <stdio.h>

We tested even on Android app and although it creates the apk, the problem is exactly the same.
Called from webm.Webm::boot webm/Webm.hx line 159
Called from cpp.Lib::load C:\HaxeToolkit\haxe\std/cpp/Lib.hx line 38
ā€œCould not load module openfl-webm@hx_vpx_codec_iface_name__0ā€

So I do not know how to get it going ā€¦

Ok, anyway for everything I read, the webm extension seems to have enough problems with video / audio, and at the same time it seems old (5 years old?) And ā€œabandonedā€ ā€¦

For us to have video (at least at the level of what Flash Player / AIR provides) is very important. Very few of our projects do not carry any video.

We have managed to develop a Class that allows us to play video with the same API on three platforms: Flash / AIR, Html5, Windows (using HaxeVLC from Datee - our modified github fork -). If I have time, at some point I will upload it to Github with an example of integration. This ā€œapiā€ is far from perfect but at the moment it can be valid for those targets (a pity that for Android app there is no alternative ā€¦).

So I hope (I pray, especially when AIR stops working in our main targets) that in the future this feature is an integral part of Haxe / OpenFL (including mobile app Android + iOS).

We will be aware of any developments in this area.

Thank you,

1 Like

We are in the same situation here. What prevents us to use OpenFL on all our projets is mainly the lack of video solution on some targets (windows & Android especially).
Can we hope that video on on target will be part of one of the next versions?
It would be really GREAT :slight_smile:

1 Like

Currently, the workaround is to use html5 + electron or cordova.
But yeah, it would be great! Maybe we should create a bounty for this?

For us, html5 canvas with integrated video is ā€œcr#pā€ (slow and less features). Html5 canvas, in general, gives less performance than any other target (working with the same amount of effort, it is more difficult to obtain canvas performance).

I prefer to export to: Windows, Android app, (and/or AIR while available). These platforms as the ā€œprime versionā€. And a html5 canvas version as a backup (but never as the ā€œbest versionā€ of the product). Unless the product is exclusively browser and the development is relatively ā€œsimpleā€. In any other case it is not profitable. Al least for us.

Like I said in other forum: ā€œBrowser engines - canvas - are not the best runtimes for multimedia like productsā€.

I just hope that more and more developers in the OpenFL community need this feature in multiplatform (or al least ā€œmain native platformsā€), because at present it seems stagnant.

1 Like

We support DOM, canvas or WebGL on HTML5. Iā€™ve been consistently impressed how well WebGL performs compared to other targets

Iā€™m going to publish linc_ffmpeg (ffmpeg v4.1 externs) with openfl&kha examples of how to play media files and capture camera input in near future, when I have time.

2 Likes

GREAT to hear!
Is it working fine?

Yes it is. At least on Windows platform. I plan to test it on other platforms as well.

2 Likes

Hey all!
I published https://github.com/Dimous/linc_ffmpeg
Utility wrapper for linc_ffmpeg is not production ready and I have no time to debug and test it on other platforms. Sorry for failing your expectations.

To AIR folks I would recommend to use NME (the father of OpenFL) (sorry, Joshua :grin:) because it implements Flash APIs in cpp (I mean ā€“ native-first). As far as I remember, I compiled https://github.com/haxenme/nme/tree/master/samples/Camera and https://github.com/haxenme/nme/tree/master/samples/StageVideo for Windows & Android and it worked. And if it doesnā€™t, you should file a bug. It is still maintained (by the author of hxcpp, btw).

2 Likes

Thanks Dimous!
We will try it when we have some more time ā€¦

Thank you very much again for the contribution.

1 Like

Hi again,

We have tried the example the dimous but the problem is that we can not compile it. I think it is developed for haxe 4 onwards and we are now working with Haxe 3.4.4.

I do not want to do experiments since I have a configuration that works for a series of projects. Probably updating Haxe 4 is problematic. Any experience on this topic?

On the other hand, Dimous. Does linc_ffmpeg work on Android ?. I ask it because I have seen the folders and libraries, and the example seems only for windows target. Even the ffmpeg libraries that you have to download are windows or macos version, but nothing Android. Maybe Iā€™m not understanding how ffmpeg works on Android.

Thanks

Hi, Phasor
linc_ffmpeg is a binding to Ffmpeg API. Yes, Ffmpeg itself is working on Android. There are plenty of build scripts, for example ā€“ https://github.com/tanersener/mobile-ffmpeg (even prebuilt binaries ā€“ https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.2)
I planned to include a minimal set of Ffmpeg source files to compile with Haxe native targets ā€“ https://github.com/Dimous/linc_ffmpeg/blob/master/src/linc/ffmpeg_files.xml
But Iā€™m not sure what is more tedious ā€“ to configure project.xml/hxp to include prebuilt libs or to integrate Ffmpeg sources. Because first you need to run ā€œconfigureā€ script to select needed codecs&formats, then you need to include only needed Ffmpeg source files which is not that simple because of cross-dependencies.

When I stumbled upon https://github.com/halfninja/android-ffmpeg-x264/ I realized that we (Haxe community) should do the same ā€“ to bind to fftools/ffmpeg.c and use it in full potential with simple text commands.

FFmpeg is quite powerful, supporting pretty much all audio/video media. But, if Iā€™m not mistaken, FFmpeg/libav and VLC can have attached to them a problematic license, if theyā€™re to be compiled into the application.

I truly appreciate the effort @Dimous has made with sharing his FFmpeg lib and itā€™s something I hope Iā€™ll have an opportunity to try.

If a more native to OpenFL option was to eventuate though, something like libvpx (VP8/VP9/Vorbis/Opus, ie: webm) might be more appropriate given it was created to free us from restrictive licenses.

2 Likes