Skip to content

BruceWind/SoftCodec

Repository files navigation

SoftCodec

Build

中文

  • 1. encode with x264.
  • 2. push into RTMP server.
  • 3. encode with openh264.
  • 4. echo cancellation in software. Maybe need libspeex.

What It Does:

click to expand.
         phone                                                          
+-----------------------+                                               
|                       |                                               
|                       |                                               
|     +-----------+     |                                               
|     |           |     |   +----------------+        +----------------+
|     |  Camera   |-------->|  YUV format A  | -----> |  YUV format B  |
|     |           |     |   +----------------+        +----------------+
|     +-----------+     |                                     |         
|                       |                                     |         
|                       |                                     |         
|                       |                                     v         
|                       |      +------------+         +---------------+ 
|                       |      |            |         |               | 
|                       |      | YUV(NALs)  |<------  |     Codec     | 
|                       |      |            |         |               | 
|                       |      +------------+         +---------------+ 
|                       |            |                                  
|                       |            |                                  
|                       |            |                                  
|                       |            |                                  
|                       |            v                                  
|    +-------------+    |     +-------------+                           
|    |             |    |     |             |                           
|    |     WIFI    |<-------- | RTMP & FLV  |                           
|    |             |    |     |             |                           
|    +-------------+    |     +-------------+                           
|           |           |                                               
+-----------|-----------+                                               
            |                                                           
            |                      RTMP server                                     
            |                    +-----------+                                  
            |                    |           |
            |                    |   _____   |            
            |                    |  |_____|  |            
            +------------------->|    ___    |
                                 |   |___|   |
                                 |           |
                                 |           |
                                 |           |
                                 +-----------+            

Building & Testing

click to expand.

1. building

It depend on NDK 16, but you don't need to download manually. By the time you executed ./gradlew assembleDebug, gradle will download it automatically in case your computer has no NDK 16.

2. Testing with a RTMP server:

You must have a RTMP server which receives stream app pushed. The RTMP server can also transfer data to video players.

I had written a blog to teach someone else how to establish it. You can look into the blog.

3. Pushing stream.

modify this code line below in MainActivity to point to your rtmp server:

private String mRtmpPushUrl = "rtmp://192.168.50.14/live/live";

In addition, master branch has all of stable codes, If you want to look code in development, checkout other branches.

Take look at CodecLibsBuildSH in case you want to upgrade version of Codec.