Vitamio android studio rtsp

Русские Блоги

Android мультимедийный API-фреймворк Vitamio

Я изучал MediaPlayer раньше

Однако форматы мультимедиа, поддерживаемые MediaPlayer, на самом деле ограничены.Как упоминалось в начале, Android Multimedia фактически включает в себя множество сторонних платформ.

Эта статья посвящена стороннему фреймворку для воспроизведения мультимедиа Android — фреймворку Vitamio, который поддерживает почти все медиа-форматы.

Фреймворк Vitamio

Обзор

Цзянь скачать со следующего адреса! ! Ссылка на причину: https://blog.csdn.net/nishigesb123/article/details/89576962

👇 — введение с официального сайта

Vitamio — это универсальная среда разработки мультимедиа на платформах Android и iOS, которая полностью поддерживает аппаратное декодирование и рендеринг на GPU. Vitamio завоевал расположение многих разработчиков по всему миру своим простым и легким в использовании интерфейсом API. На данный момент Vitamio используют более 10 000 приложений по всему миру, охватывая более 500 миллионов пользователей.

Vitamio может плавно воспроизводить видео высокого разрешения 720P или даже 1080P MKV, FLV, MP4, MOV, TS, RMVB и другие распространенные форматы видео. Он также может поддерживать MMS, RTSP, RTMP, HLS (m3u8) и другие распространенные форматы на Android и iOS. Протокол потоковой передачи видео, включая трансляцию по запросу и прямую трансляцию.

Поддержка потоковой передачи

Vitamio поддерживает различные распространенные протоколы потоковой передачи мультимедиа, аудио и видео по запросу или прямую трансляцию, например, могут без проблем поддерживаться следующие общие протоколы:

  • MMS
  • RTSP (RTP, SDP), RTMP
  • HTTP progressive streaming
  • HLS — HTTP live streaming (M3U8)

Аудио и видео форматы

Витамио подержанныйFFmpegВ качестве анализатора мультимедиа и наиболее важного декодера он разработал решения жесткого декодирования для разных мобильных платформ одновременно, которые могут идеально поддерживать стандартное кодирование видео, такое как H.264 / AVC, H.263, MPEG4, и покрывать сотни мультимедийных форматов. . В следующей таблице приведены лишь некоторые из наиболее распространенных поддерживаемых видеоформатов, за исключением специальных инструкций, все они поддерживают аппаратное ускорение:

  • DivX/Xvid
  • WMV (обычно только мягкое декодирование)
  • FLV
  • TS/TP
  • RMVB (только мягкое декодирование)
  • MKV
  • MOV
  • M4V
  • AVI
  • MP4
  • 3GP

Поддержка субтитров

Vitamio имеет отличную поддержку субтитров, включая множество общих внешних субтитров и встроенных субтитров во многих видеоформатах.Поддержка нескольких субтитров и других функций также очень полная. такие как:

  • SubRip(.srt)
  • Sub Station Alpha(.ssa) / Advanced Sub Station Alpha(.ass)
  • SAMI(.smi/.sami)
  • MicroDVD(.sub/.txt)
  • SubViewer2.0(.sub)
  • MPL2(.mpl/.txt)
  • Матроска (.mkv) встроенные субтитры

Больше возможностей

Помимо общих функций, перечисленных выше, Vitamio также проделал большую гуманную работу:

  • Поддержка нескольких звуковых дорожек и субтитров
  • Подробная оптимизация CPU и GPU
  • Поддержка различных устройств от мобильных телефонов до планшетов
  • Поддержка буфера воспроизведения потокового мультимедиа
  • Отрегулируйте соотношение сторон воспроизведения
  • Автоматическое определение кодировки текста, отклонение искажено

Есть и другие новые функции, не указанные в списке, см. Документацию для разработчиков.

Вводить

👇 Ниже приводится официальное введение

Импорт и использование

1. Импорт. После его загрузки вы можете обнаружить, что файла проекта .project нет. Вы можете импортировать проект через Файл -> Импорт -> Android -> Существующий код Android в рабочую область, а затем изменить имя проекта.

2. Проект VitamioBundle можно использовать в качестве библиотеки Android в демонстрационном проекте.

Примечание.
Если вы являетесь пользователем Windows, поместите VitamioBundle и демонстрационный проект в одну папку, иначе добавление библиотеки Android может завершиться неудачно. Для других проблем, как правило, можно очистить и перекомпилировать. По другим вопросам, пожалуйста, обратитесь к списку ошибок.

После скачивания полной версии проекта Vitamio на официальном сайте или Github

Щелкните правой кнопкой мыши свой проект

Нажмите Далее, чтобы настроить

Инструкции по настройке: Посмотрите на загруженный нами проект vitamio, посмотрите на папку src, вы можете сделать вывод, что имя пакета на самом деле io.vov.vitamio, поэтому 👆 также заполните это

Скопируйте файл иконки в наш vitamio после завершения

Переключитесь на просмотр проекта или работайте прямо в каталоге проекта

Читайте также:  Читалка pocketbook для андроид

Скопируйте содержимое четырех подпапок в папку libs загруженного проекта vitamio.

Выберите и скопируйте содержимое трех подпапок в папку libs загруженного проекта vitamio. Чтобы

Создайте папку jniLibs в каталоге проекта app / src / main и скопируйте 👆 в

Сначала я не знал, что As only распознает этот каталог.

Наконец, добавьте это предложение к оценке. Это так неразумно. Разве это не помогло мне автоматически составиться? . .

Пока это было импортировано

Затем я столкнулся с некоторыми ошибками, сказав, что в raw ничего нет, а затем я просто скопировал содержимое из папки res в свой проект.

использовать

Готов к работе

Вы можете обратиться к файлу конфигурации загруженного проекта исходного кода, для которого требуются следующие разрешения.

Воспроизвести аудиокейс

Если у вас есть эффект, вы больше не можете видеть его, звук действительно есть.

Консоль выводит кучу логов, очень полных

Воспроизвести видео кейс

Эта часть будет завершена завтра, сегодня мы почти отчаялись, чтобы пройти через эту призрачную штуку orz

Источник

Xinyustudio

A minute change can change a lot.

Android: How to play RTMP video streams

In the post Android: How to play RTSP or HLS video streams , there is one missing video streaming issue leaving unresolved: the RTMP videos.

This post outlines how to implement rendering RTMP videos on Android platform. This is far from a trivial problem, but I will get it done quickly using the open source Vitamio library.

    Download the Vitamio bundle from https://github.com/yixia/VitamioBundle , extract the zip file if you downloaded the zip file, or if you pull the source out of it, you will see a folder called “vitimio” there.

In Android Studio, create a project, let’s call it VideoStreamPlayer.

In Android Studio, go to File->Import Module, navigate to “VitamioBundle-master” folder you extracted or pulled from the source, select “vitamio” folder and press finish to import the library.

Add compile project(‘:vitamio’) in build.gradle(Module: app) dependencies section

  • Add the internet permission in your manifest, outside node
  • Build the app and make sure it works.
  • Go to the activity layout, add below code:

android:id=”@+id/vitamio_videoView”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”/>

  • In the activity class, add below code:

protected void onCreate(Bundle savedInstanceState) <
super . onCreate ( savedInstanceState ) ;

if ( ! LibsChecker . checkVitamioLibs ( this ) ) //Important!
return ;

setContentView ( R . layout . activity_main ) ;
mVideoView = ( VideoView ) findViewById ( R . id . vitamio_videoView ) ;
path = “rtmp://rrbalancer.broadcast.tneg.de:1935/pw/ruk/ruk” ;
mVideoView . setVideoPath ( path ) ;
mVideoView . requestFocus ( ) ;
>

Rebuild and run. That is it!

Tip 1: to make it easier to debug and troubleshooting, you might first make sure an rtmp stream is valid. You can do so by opening the RTMP url in VLC player.

Tip 2: If nothing displays in the activity, make sure if ( ! LibsChecker . checkVitamioLibs ( this ) ) is called.

Tip 3: Depending on the network, some RTMP might be very slow, so be patient when it loads.

Share this:

Like this:

7 thoughts on “ Android: How to play RTMP video streams ”

hey , first of all , thanks for the tutorial is really heplfull. i just have a litle problem. i can not play rtmp streams with vitamio. i just can play rtsp and other formats, but not the rtmp url. i just have this error on the logcat : E/Vitamio[Player]: Native libs libffmpeg.so not exists!.

I am very grateful if you can assist me a little about what’s going on that error.

This might be incorrect dependency problem. Make sure you have correctly configured the gradle setting file, as outlined above.

Hi Tahanks for the tutotial, it helped me, but the video is not get played, I am getting a pop-up i mean dialog with the msg – this video can’t play

Источник

How To Stream RTMP live in Android

Streaming live video/audio in android is one of the very few interesting parts we have. Whenever we talk of streaming, the possibility of using RTMP(Real Time Messaging Protocol) cannot be ruled out. As RTMP is one of the most basic protocols available for streaming live video/audio feed. But unfortunately Android’s standard VideoView does not support the playback of RTMP streams. Therefore to natively play a live RTMP stream on Android, an external library is required which can provide us an Android RTMP player. As of now I have discovered two libraries which can serve this purpose.

Читайте также:  Что такое гаджеты для android

First being the Android Vitamio library, and second being the LibVLC SDK for Android. In my opinion the later one is the better one. As this comes in a form of a plug-in solution from the open source organisation that built the worlds greatest video player ever, that right:- VLC. Therefore in this tutorial to build an example of Android RTMP player we will discuss how we can use the LibVLC SDK for Android. But before doing so lets, also have an overview of its counterpart, Vitamio library as well.

Android Vitamio Library

Vitamio is an open source project for Android and iOS built up on FFmpeg code. Vitamio provides us a clean and simple API with full and real hardware accelerated decoder and render-er. Vitamio is a very powerful library which supports a wide variety of video/audio formats like FLV, TS/TP, WMV, DivX, Xvid and many other standard formats. What makes it different is that it also supports the playback of embedded and external subtitles like .mkv and .srt. But Vitamio comes with a license, hence please go through this license page before using it in your project. In this Android RTMP example, we will not only discuss the live streaming of RTMP stream in Android, but will also discuss how we can stream m3u8 playlists(HLS), RTSP streams and MMS (Microsoft Media Stream). But through the usage of VLCs SDK for Android.

Android VLC SDK

VLC Media Player has been the most popular video file playback software available till date. The interesting part about it is that, it supports all major video/audio playback formats. Therefore when compared with other SDKs or libraries like Vitamio for RTMP streaming, it is considered to be far more superior by default. This gives us an obvious answer why we should use this LibVLC SDK for Android. Coincidentally, it is not very difficult to use this SDK in an Android app. Once done, you can play all the playback formats it supports, be it HLS, RTMP, RTSP, or even subtitles. Full SDK docs are available here. Therefore, without waiting lets integrate it in our app.

How to embed VLC Media Player in your Android App?

To use Android VLC Media Player SDK in your app, you may need to include the compiled code for vlc media player in your app. To do so, two ways are available:

Option 1: Manually compile SDK and use it through NDK as .so file:

Option 2: Use a Gradle dependency, compiled as an opensource project vlc-android-sdk by mrmaffen (May not be the latest version always).

So for this Android RTMP Streaming Example, I will be using this option. To do so, all you need to do is in your build.gradle (app) file, add a dependency as shown:

Streaming RTMP Stream Live in Android

Before heading directly to the implementation part, first lets understand RTMP a little. Real Time Messaging Protocol (RTMP) is a protocol owned by Adobe Systems. This protocol was developed to stream audio and video content to company’s proprietary flash player. But later on as it evolved, a part of it was released for public use. More of it can be read here. Mostly this type of protocol is used for IPTV and live VoD streaming, but it can be used in many other areas as well.

To play an RTMP stream in Android, a normal VideoView cannot be used, as it does not support the RTMP playback. But a WebView can be used to play the RTMP stream without any external library. This solves the problem but in my personal opinion web apps don’t give a nice look and feel to an app. Hence in this Android RTMP example we will be using an external SDK – VLC Media Player for streaming a live RTMP stream. After including it in the project, please add a SurfaceView in your layout file:

Читайте также:  Resident evil village android

Further to run this Android RTMP player, please code your activity something like this:

Although the above code is self explanatory, but please dont forget to change the RTMP path to play your stream. At times to stream an RTMP stream in Android, you may have to pass the headers along with the path. Luckily you may have seen above that LibVLC supports that too. Hence all types of RTMP streams can be used with Android VLC SDK. The above example would look something like this:

But before moving on to other parts, please don’t forget to add configChanges flag in your AndroidManifest for this Activity, as shown:

Full source code is also available here:

Android RTSP Streaming

Real Time Streaming Protocol (RTSP) is used for streaming content from media servers. Like YouTube uses RTSP streams to distribute content. The easy part about RTSP streaming is that, it can be done through the standard VideoView of Android. To read more about it please refer to my VideoView Example.

But if you are implementing a solution by using the embedded VLC Media Player Lib, you might prefer using the same for RTSP streaming as well. As a matter of fact Android VLC SDK supports all video/audio formats, hence it also supports the playback of RTSP stream. Therefore If you are building a media playback app, you may use the same code shown in the section above to playback an RTSP stream. All you need to do is replace the URL.

Android m3u8 Streaming

How to play m3u8 video in Android? is one of the most common questions among the Android developers. The easiest way to do HTTP Live Streaming (HLS) in Android is through the usage of standard VideoView. But as you might have guessed, there are some limitations to it. Through standard Android VideoView you can stream m3u8 streams but only on the devices having Android 3.0 and above. This is because the HTTP/HTTPS live streaming and HTTP/HTTPS progressive streaming protocols were introduced in Android 3.0 and full support with HTTPS was given in 3.1.

If you wish to do HTTP Live Streaming (HLS) and support Android m3u8 streaming, for earlier versions of android. You should consider using the Android LibVLC, as this library adds the support for playback of m3u8 lists along with many other formats on android API 9 and above. To do so the process is same- as shown in the sections above, just replace the URL with m3u8, HTTP Live Streaming URL:

Playing m3u8 stream on Android with VLC SDK would look something like this:

Android MMS Stream

Another uncommon format for streaming in Android is MMS. Since the Android LibVLC is a powerful library which supports very complex video playback formats, it also supports the playback of Microsoft Media Server (MMS) stream. Hence one should use this SDK to stream MMS as well. MMS is a network streaming protocol, mostly used for webcasts and live radio. Using embedded VLC media player library for the playback of an MMS stream in Android is not that different from using other protocols. All you have to do just replace the path variable to point to an MMS url:

Conclusion

As we discussed above, I would like to conclude by saying that LibVLC SDK is a very powerful multi-platform library, for iOS and Android both. By using Vitamio library one can stream limited types of video formats and protocols like RTMP, RTSP, HTTP Live, and HTTP progressive streaming protocol. But by using the Android VLC SDK, you can stream all the major video/audio formats available till date. Another great playback feature that comes along with LibVLC is that it supports the playback of subtitles and multiple audio tracks as well. Hope this helped. Connect with us through our Facebook, Google+ and Twitter profiles for more updates.

About Mohit Gupt

An android enthusiast, and an iPhone user with a keen interest in development of innovative applications.

Источник

Оцените статью