Giter Site home page Giter Site logo

toberole / mediaplus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from javandcpp/mediaplus

0.0 0.0 0.0 179.88 MB

android audio and video capture and rtmp protocol streaming.

License: MIT License

CMake 0.30% Java 1.63% C++ 56.82% C 40.96% Objective-C 0.29%

mediaplus's Introduction

MediaPlus

android 音视频采集与推流:

  • Rtmp推流截图
  • 水印截图
  • Android相机采集NV21格式数据,并使用libyuv转换I420(yuv420p)、处理I420旋转、前置摄像头镜像; 音频采集PCM数据:2通道、16位、采样率48000KHz,音视频软编。
  • 当前版本支持RTMP协议推流。
  • 支持视频添加水印功能。
  • 适用于Android移动音频和视频的采集和推流。
  • 暂无任何视频滤镜等其他特效。
  • 搭建RTMP测试服务(如:nginx+rtmp、crtmpserver、Red5等);也可以写入本地文件,只需更改推流地址,如:“/mnt/sdcard/test.flv”。

JNI 核心 API说明:


* 初始化音视频采集
LiveJniMediaManager.InitAudioCapture(int channles, int SampleRate, int SampleBitRate);
LiveJniMediaManager.InitVideoCapture(int inWidth, int inHeight, int outWidth, int outHeight, int fps, boolean mirror);
	
* 初始化音视频编码器
LiveJniMediaManager.InitAudioEncoder();
LiveJniMediaManager.InitVideoEncoder();

* 水印添加
LiveJniMediaManager.SetWaterMark(boolean enable,byte[] waterMark,int waterWidth,int waterHeight,int positionX,int positionY);
    
* 开始推流
LiveJniMediaManager.StartPush(pushUrl);
        
* 发送音视频数据至底层
LiveJniMediaManager.EncodeH264(videoBuffer, length);
LiveJniMediaManager.EncodeAAC(audioBuffer, length);
 
* 停止推流与资源回收
LiveJniMediaManager.Close();
LiveJniMediaManager.Release();

   

RtmpPushStreamer使用示例:

 mRtmpPushStreamer = new RtmpPushStreamer.Builder()
                     .withActivity(LiveActivity.this)
                     .withSurfaceView(surfaceView)
                     .withWaterMark(true, ivWaterMark, 90, 30)  //参数:true 水印开关 水印图片 宽(90px)\高(30px)
                     .withPushStreamCall(new PushStreamCall() {
                            @Override
                            public void PushSucess() {                     
                               #-------"推流成功"--------#
                            }

                            @Override
                            public void PushFailed() {
                               #-------"推流失败"--------#
                            }
                        }).build();

-- API文档 --

mediaplus's People

Contributors

loneswordman avatar javandcpp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.