Giter Club home page Giter Club logo

yasea's Introduction

“[yasea] is being sponsored by the following tool; please help to support us by taking a look and signing up to a free trial”

GitAds

Yet Another Stream Encoder for Android

Android Arsenal

Yasea is an Android streaming client. It encodes YUV and PCM data from camera and microphone to H.264/AAC, encapsulates in FLV and transmits over RTMP.

Branch

non-gpuimage for Android without GL ES library like development board.

android-16 for Android API 16+.

aac-hev2 for Youtube live broadcast that is not compatible with conventional flash media players.

Feature

  • Android mini API 21.
  • H.264/AAC hard encoding.
  • H.264 soft encoding.
  • RTMP streaming with state callback handler.
  • Portrait and landscape dynamic orientation.
  • Front and back cameras hot switch.
  • Recording to MP4 while streaming.
  • Beautiful filters with GPUImage.
  • Acoustic echo cancellation and automatic gain control support.

Test

You may build your own private RTMP server srs. Remember to modify the URL by yourself. Have fun!

NOTE if you feel high latency, please check your bandwidth limits and player buffering.

Acknowledgements

Sponsor

  • dotEngine -- A brilliant realtime multimedia communication service vendor with open cross-platform SDK (github).

yasea's People

Contributors

anmokoto avatar begeekmyfriend avatar bruunand avatar deathemperor avatar jw20082009 avatar nikhilkilivayil avatar obarong avatar penninghlhd avatar thegobot avatar vkuzub avatar z2045217 avatar zohaadafzal avatar zzugyl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yasea's Issues

How to change the resolution of the push?

How to change the resolution of the push?
Can be compatible with the resolution of the different mobile phone support, and to set the size of the preview, frame deformation

分辨率 清晰度的问题(模糊问题)

你的分辨率固定如下:
public static final int VWIDTH = 640;
public static final int VHEIGHT = 480;
public static final int VCROP_WIDTH = 384;
public static final int VCROP_HEIGHT = 640;

public static int vCropWidth = VCROP_WIDTH;   // Note: the stride of resolution must be set as 16x for hard encoding with some chip like MTK
public static int vCropHeight = VCROP_HEIGHT;  // Since Y component is quadruple size as U and V component, the stride must be set as 32x

我的分辨率 根据机子类型进行设置,例如:
public static final int VWIDTH = 864;
public static final int VHEIGHT = 480;
public static final int VCROP_WIDTH = 480; //16x
public static final int VCROP_HEIGHT = 864; //32x

但画面就模糊了

推流时晃动马赛克非常严重

提高了码率,到1M了但是推流时马赛克还是比较严重,而且实际推流码率肯定不能是1M,所以作者有关注到这个问题吗?加了这个属性:
videoFormat.setInteger(MediaFormat.KEY_PROFILE,MediaCodecInfo.CodecProfileLevel.AVCProfileHigh10);
videoFormat.setInteger(MediaFormat.KEY_LEVEL, MediaCodecInfo.CodecProfileLevel.AVCLevel11 );
没管用

有点卡,播放不平滑

推流到srs服务器, 用VLC播放,将android端移动,VLC播放不是十分流畅,画面不平滑。但是用srs-sea推流,VLC播放则要平滑许多,请问是不是哪里参数没有调整好,应该怎么解决这个问题?

writeThread not closed

I guess the following is missing in the stop() function in srsEncoder.java. May be that is why the writeThread continues to wait even after stop publishing

if(publisher != null) {
Log.i(TAG, "stop publisher");
publisher.shutdown();
}

Supporting Adobe FMS server

Hi @begeekmyfriend .. I am trying your library however when I add my URL which is a Adobe FMS server to start streaming, sometimes, it hangs, some times it shows first frame and then hangs and some times, it is published however, when I want to play in wowza server test player, it does not show anything.

Not Working on Android M

Hi

Thanks for your Effort.
The code is working fine in Level 19, But its not working in Level 23 (Android M).
Can you please give me some solution..

Thanks

ANR while stopping broadcast.

Hello,
Thanks for a pure java rtmp streaming library.
I'm facing a issue while stopping the broadcast, the application hangs and just stop responding.
I'm getting these log when I stop broadcast.

I/Yasea: stop audio worker thread
04-20 19:29:04.939 12009-12009/net.ossrs.sea I/SrsEncoder: stop aencoder
04-20 19:29:04.947 12009-12151/net.ossrs.sea I/OMXMaster: clearPlugins: 0 key=aec50290 value=0
04-20 19:29:04.947 12009-12151/net.ossrs.sea I/OMXMaster: clearPlugins: 1 key=aec50358 value=b47fe544
04-20 19:29:04.950 12009-12151/net.ossrs.sea I/OMXMaster: clearPlugins: 2 key=aee0b140 value=b47fe2a4
04-20 19:29:04.952 12009-12009/net.ossrs.sea I/SrsEncoder: stop vencoder
04-20 19:29:04.964 12009-12009/net.ossrs.sea I/SrsEncoder: stop muxer to SRS over RTMP
04-20 19:29:04.964 12009-12009/net.ossrs.sea D/RtmpConnection: closeStream(): setting current stream ID to -1
04-20 19:29:04.965 12009-12009/net.ossrs.sea I/SrsMuxer: worker: disconnect SRS ok.
04-20 19:29:04.965 12009-12264/net.ossrs.sea D/WriteThread: WriteThread: wrote packet: RTMP Command (command: closeStream, transaction ID: 0), size: 24
04-20 19:29:04.965 12009-12264/net.ossrs.sea D/WriteThread: WriteThread: waiting...
04-20 19:29:04.966 12009-12265/net.ossrs.sea I/RtmpConnection: shutdown(): Shutting down read/write threads
04-20 19:29:04.966 12009-12009/net.ossrs.sea D/AndroidRuntime: Shutting down VM
04-20 19:29:04.980 12009-12009/? I/SrsEncoder: stop muxer to SRS over RTMP
04-20 19:29:04.985 12009-12019/? I/art: Debugger is no longer active
04-20 19:29:05.966 12009-12264/? D/WriteThread: WriteThread: waiting...
04-20 19:29:06.966 12009-12264/? D/WriteThread: WriteThread: waiting...
04-20 19:29:07.966 12009-12264/? D/WriteThread: WriteThread: waiting...
04-20 19:29:08.967 12009-12264/? D/WriteThread: WriteThread: waiting...
04-20 19:29:09.967 12009-12264/? D/WriteThread: WriteThread: waiting...
04-20 19:29:10.968 12009-12264/? D/WriteThread: WriteThread: waiting...

How is the flv muxed

I have a test server with Nginx and RTMP-Module. When I am trying to stream to the server I am not able to view the rtmp tream in VLC or any other player.

I am also trying a command like this

exec_push ffmpeg -i rtmp://127.0.0.1:1935/staging_live_v1/$name -map 0:a -map 0:v -c copy -b:v 512k -r 30 -movflags faststart /Videos_staging/staging_mp4/$name.mp4 2>>/Videos_staging/staging_mp4/$name-out.txt;

it is failing with the following

Input #0, flv, from 'rtmp://127.0.0.1:1935/staging_live_v1/tst':
Duration: N/A, start: 26.979000, bitrate: N/A
Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp
Stream map '0:v' matches no streams.

美颜

我想在推流的时候对数据进行美颜,可以直接对数据进行操作吗?如何绘制到预览界面呢?还是绘制到预览界面需要使用GLSurfaceView 这类的呢?

yasea由竖屏转为横屏后,播放端花屏

yasea由竖屏转为横屏,播放器端仍然是竖屏而且花屏,退出重进后可以正常显示横屏。播放器用的是ijkplayer。srs的web在线播放不会出现花屏。但是客户端播放器不论是ijkplayer还是vlc都是花屏。

推H264数据流

MTK平台的Gallery2项目中有一个MediaCodecRecorder.java, 其中有用到MediaMuxer把音频和视频数据保存到文件, 即mMediaMuxer.writeSampleData(trackInfo.index, encodedData, bufferInfo);我想把这里的encodedData的视频数据推到服务器, 偿试了flvMuxer.writeSampleData(videoFlvTrack, encodedData, bufferInfo);可是数据并没有传到服务器, 我断点看了一下, 第次if (avc.is_sps(frame))和if (avc.is_pps(frame))都是不成立的, 所以没办法上传服务器, 请教一下,我要如何修改才能实现这个功能?

Plug flow direction

I want to support Horizontal screen and Portrait to plug flow
and I use SrsPlayer play the video to see the real-time data , I found the frame rate remained at around 9 and the rate remained at around 500.

Field requires API level 21

SrsEncoder.java

This line is giving the warning that Min API Level 21 is required
MediaFormat videoFormat = MediaFormat.createVideoFormat(MediaFormat.MIMETYPE_VIDEO_AVC, vCropWidth, vCropHeight);

support with android 4.xxx

Hello guys
I have tested this app on android 4.4 and send only audio, is there some way to get video properly?

Thanks on advance

addTrack function in SrsFlvMuxer

if (format.getString(MediaFormat.KEY_MIME) == MediaFormat.MIMETYPE_VIDEO_AVC) {

should that be

if (format.getString(MediaFormat.KEY_MIME).equalsTo(MediaFormat.MIMETYPE_VIDEO_AVC)) {

Hi :) about record push

hello 作者:),我看您的code中已经有了mp4录制的功能了,目前yasea中是否有接口推送mp4录播文件至服务器?

yasea 基于 MediaCodec 硬编码

iOS 平台上无论硬编还是软编,由于是 Apple 一家公司出厂,几乎不存在因为芯片平台不同而导致的编码差异。然而,在 Android 平台上,Android Framework SDK 提供的 MediaCodec 编码器,在不同的芯片平台上,差异表现很大, 不同的厂家使用不同的芯片,而不同的芯片平台上 Android MediaCodec 表现略有差异,通常实现全平台兼容的成本不低。另外就是 Android MediaCodec 硬编层面的 H.264 编码画质参数是固定的 baseline,所以画质通常也一般。

极客兄怎么理解?关于 andriod 上面软硬编码。

没画面的问题

操作步骤:
启动推流--->按home键回到桌面-->回去
画面黑屏,可是依旧有在推流,而且也有声音

没声音的问题

情境:
A手机在在同个页面进行先播放rtmp流 然后打开 yasea推流,发现推过去的流是没有声音的。
请问是不是因为播放rtmp流的播放器占用了音频,所以推流拿不到声音?
我使用的播放器是:PLDroidPlayer

About plug flow state

When in use, I would like to know the status of plug flow such as connection, data is written and disconnection.

The publisher states can meet the situation that connection is successful but not successful writing data, causing the plug flow side is not consistent with player endpoint.

Question: can you help me use Yasea with a custom Camera Preview?

Hi @begeekmyfriend , in my app I am using GLSurfaceView for displaying the camera preview frames so that I can add filters.

Can you help me use Yasea with this custom Camera?

Basically in the Yasea example, this is where the magic happens

private void onGetYuvFrame(byte[] data) {
    if(isPushing)
        mEncoder.onGetYuvFrame(data);
}

But in the custom camera,

  1. We extend GLSurfaceView
  2. Set renderer
  mRenderer = new CameraSurfaceRenderer(this);
  setEGLContextClientVersion(2);    // GLES 2.0, API >= 8
  setRenderer(mRenderer);
  /*// the frequency of refreshing of camera preview is at most 15 fps
  // and RENDERMODE_WHEN_DIRTY is better to reduce power consumption*/
  setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
  1. On draw we draw to the Preview Surface and to the Media Codec as well
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

    if(applyEffect)
    {
        applyEffect = false;
        mDrawer.applyEffect(effect);
    }

    if (requesrUpdateTex) {
        requesrUpdateTex = false;
        // update texture(came from camera)
        mSTexture.updateTexImage();
        // get texture matrix
        mSTexture.getTransformMatrix(mStMatrix);
    }

    // draw to preview screen
    mDrawer.draw(hTex[0], mStMatrix);
    if (mVideoEncoder != null) {
                // notify to capturing thread that the camera frame is available.
               mVideoEncoder.frameAvailableSoon(mStMatrix, mMvpMatrix);
    }
  1. In the MediaEncoder,
mSurface = mMediaCodec.createInputSurface(); ==> We create an input surface

mRenderHandler.setEglContext(shared_context, tex_id, mSurface, true); ==. Set EGLContext

Can help me figure out how to record from the OpenGL texture instead of the YUVFrame? This will be a great enhancement and we can add realtime video filters to live streaming.

使用PLDroidPlayer播放器sdk播放时只有视频没有声音

测试设备:台电Android平板
服务器使用nginx-rtmp
yasea:16-07-05 master的版本
使用七牛的播放器sdk Android版本:https://github.com/pili-engineering/PLDroidPlayer 1.3.0

  1. 测试PLDroidPlayer是不是不能播放声音:
    播放 rtmp://live.hkstv.hk.lxdns.com/live/hks 是有视频和声音,播放yasea推送的内容没有声音。
  2. 测试yasea是不是采集的声音有问题:
    在pc上使用flash提供的rtmp播放器播放yasea推送的视频,有声音。在Android上使用PLDroidPlayer播放没声音。
    现在怀疑yasea推送的数据格式跟PLDroidPlayer的实现有冲突的地方。

libyuv bug

Hi Leo,
Thanks again for an awesome library,
I just tested the new libyuv jni library on Nexus 5 and I think there's a small bug on the output frames.
A stripe of pixels on the left side of the frame that shows the right part of the frame.
Attached image below.
I marked the stripe in RED border

yuvbug

Rotated frame of video when user rotate the screen

Hi @begeekmyfriend ..how are you. Thanks for helping me yesterday.

I have one more doubt like if I rotate the screen, the preview changed accordingly however the frames which are generated and sent are not rotated accordingly. Where to rotate that in order to get right frames in video.

I am attaching a image which is actually I have tried recording at landscape mode.

mypic

The picture latency issue

Have joined the delay, please push the strategy, I found that I use any player playing are five seconds of delays

About resolution

When I change the resolution , Camera-JNI: Callback buffer was too small! Expected 522240 bytes, but got 518400 bytes! hanpped.

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.