Giter Site home page Giter Site logo

tonyxia2016 / androidscreencaster Goto Github PK

View Code? Open in Web Editor NEW

This project forked from magicsih/androidscreencaster

0.0 0.0 0.0 205 KB

A live android screen caster which encoding media by h264,webm via TCP and UDP with low latency

Java 100.00%

androidscreencaster's Introduction

AndroidScreenCaster

A live android screen caster which encoding media by h264,webm via TCP and UDP with low latency

MOTIVATION

I'm currently in charge of test automation team. We try to make possible functional testing for mobile games. While we're working on it, we needed to mirror live android screen to web browser. The first approach was MJPEG. We captured entire screen and sent it over network in every very short period. Surely, it was ineffiecient, slow and huge. The first approach was helpful anyway to prove our concept of system, though.

The second approach was encoding our media data by using well known codecs such as h264 and vp8. It ended up a success anyway. However, it was hard to find code examples. I mostly refer to android googlesource(specially media test cases). I hope this project helps you to save your time and understand concept of live screen casting on Android.

DEMO

Demo

TEST DEVICE

  • Samsung Galaxy S7 edge (Android 6.0)

REQUIREMENTS

  • ffmpeg on server (demonstrating works well)

SCREENSHOT

Screenshot

QUICK START

SERVER SIDE

  • ffplay -framerate 60 -i tcp://<your server ip here>:49152?listen

CLIENT SIDE(THIS APP)

  1. Put your remote host address(eg.IP)
  2. Choose format as H.264
  3. Tap Start
  4. Do some other jobs to make ffmpeg receiving enough media data.

SERVER SIDE FFMPEG COMMANDS

PLAY

TCP+H264

ffplay -framerate 60 -i tcp://<your server ip here>:49152?listen

TCP+VP8

ffplay -i tcp://<your server ip here>:49152?listen

UDP+H264

ffplay -framerate 60 -i udp://@:49152

UDP+VP8

ffplay -i udp://@:49152

RECORD

UDP+H264

ffmpeg -i udp://@:49152 -framerate 60 -codec:v libx264 -profile:v baseline -preset medium -b:v 250k -maxrate 250k -bufsize 500k -vf scale=-1:360 -an -threads 0 output.mp4

if you need to make play speed faster. one more encode to output.mp4

ffmpeg -i output.mp4 -vf "setpts=(1/2)*PTS" fast_output.mp4

UDP+VP8

ffmpeg -i udp://@:49152 -c:v libvpx -b:v 1M -c:a libvorbis output.webm

Reference

androidscreencaster's People

Contributors

magicsih 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.