eXport-it, android  UPnP Client/Server

eXport-it android UPnP/HTTP Client/Server

Android


an Android wireless file sharing application for video, audio, images and ebooks




eXport-it FFmpeg





What is the FFmpeg library?

FFmpeg (https://www.ffmpeg.org/) is a complete, cross-platform solution to record, convert and stream audio and video. FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation.

It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc... under a wide variety of build environments, machine architectures, and configurations.

The FFmpeg library itself is under LGPL 2.1 license. Enabling certain external libraries (like libx264) changes the license to be GPL 2 or later.

How is this library integrated in the Android application

I used the ffmpeg-android-maker script (contributors: Alexander Berezhnoi Javernaut + codacy-badger Codacy Badger + A2va) to compile the libraries. This script downloads the source code of FFmpeg from https://www.ffmpeg.org and build the library and assembles it for Android. The script produces shared libraries (*.so files) as well as header files (*.h files).

The main focus of ffmpeg-android-maker is to prepare shared libraries for seamless integration into an Android project. The script prepares the `output` directory that is meant to be used. And it's not the only thing this project does. The ffmpeg-android-maker's source code is available under the MIT license. See the LICENSE.txt file for more details on https://github.com/Javernaut/ffmpeg-android-maker/ The eXport-it FFmpeg libraries are just compiled with libaom, libdav1d, liblame, libopus and libtwolame...but not all associated libraries.

To develop the Java support for FFmpeg and run it on Android 7.1 to 12, I started from the MobileFFmpeg project documented on https://github.com/tanersener/mobile-ffmpeg/ by Taner Sener, which is not maintained anymore... and is licensed under LGPL 3.0 ...

Finally, I prepared a JNI Android Studio project with the libraries, include files and Java support code, and generate an .aar Library file to integrate as an additional library into my existing projects.


How to start a multicast channel

To start a multicast Channel requires to use a client, to access an UPnP server on your local network (Wi-Fi) with the FFmpeg support. This server should answer with the list the files it exports. If this server has the FFmpeg support, a small text "As a channel" must be shown in red at the end of the top line of the list page. When the text is "red", clicking on the "play" button works as before using UPnP protocol. If you click on the text, it should become "green" and clicking on the "play" button, after selecting video or audio files, should start a "channel".

The media files selected are played apparently in the same way than through UPnP, except the startup delay is longer due to additional tasks. You must keep this client playing the media files to keep the pipe active.

Using this pipe on other devices

IP multicast does not work over Internet, it works only on Local Area Network thus mainly on Wi-Fi. A multicast data channel can be share by many clients simultaneously. You are sending a media data flow on your Wi-Fi network and show these data on connected devices, nearly synchronously, just the latency delay difference.

With UPnP or HTTP streaming, each device requires the bandwidth of the video shown and the global bandwidth is the sum of both traffic. With multicast streaming, we send one data flow on the LAN which is shared between multiple clients.

If you use another client on your network after starting a channel, you should see an additional line on the client main window. Just clicking on this line should start the show.

It is also feasible to use other products like VLC, SMplayer, ... to show a video or to listen to music distributed over a multicast channel just using the "UDP" URL shown on the eXport-it client.

To stop a multicast channel

The good way for stopping a multicast Channel is to stop it on the client on which you started it because this channel is controlled there. Playing to the end of streamed media files should also give the end of the show.