I've tried the suggestion from fadden to mirror the Android screen to PC, but the vlc player screen show nothing:
What would be the correct commands lines for this function? Thanks.
To start screen recording, use adb shell screenrcord [options] filename command. Press Ctrl+C to stop record recording. Uses adb pull command to pull a file from Android device to your Mac.
Use the ADB option exec-out instead of shell in the screencap command. For example, adb exec-out screencap screenshot. png. This command will store the screenshot direct on your PC in the folder where you have started the command.
Since vlc can't play the h264 file from adb std output, I turn to use ffplay as stream player and it works via the following command:
adb shell screenrecord --output-format=h264 - | ffplay -
OS X binary ffplay and streaming screens:
Thanks!!
I don't remember the vlc command line that I used for the initial testing. I've tried a few different things recently, on desktop Linux (Ubuntu 15.10).
VLC
If you just pipe the output into vlc --demux h264 -
, it appears to work, but you get gradually farther behind. Adding --h264-fps=60
seems to help that, but you start getting errors ("ES_OUT_SET_(GROUP_)PCR is called too late
"). Adding --clock-jitter=0
seems to make the errors less traumatic, but it's still pretty messed up.
ffplay
A simple ffplay -
works, but it seems to take a few seconds to decide to start, and ends up lagging well behind the entire time.
Using ffplay -framerate 60 -framedrop -bufsize 16M -
gives you a decent quality that lasts for quite a while. This is due to the below command that synchronises the framerate and bitrate as the video will otherwise be trying to play at 30fps making everything look/get slower over time due to the extra frames. The bitrate will then help keep the video properly timed as best as possible. I've found it works within a 100-1000MS delay; similarly to most Bluetooth headsets. You might get a "consider increasing probesize" error that may freeze the stream. It's best to restart screenrecord or try appending -probesize 16M
Note: This configuration with ffplay works with the following adb command piped beforehand. If you're running GPU intensive tasks or using an older phone, a size of 1280x720
is a better recommendation. If your phone doesn't support 60fps (or doesn't seem to record in 60fps) change until appropriate with values such as 30 or 24.
adb exec-out screenrecord --bit-rate=16m --output-format=h264 --size 1920x1080 -
mplayer
The command mplayer -demuxer h264es -
seems to yield the best results. Starts immediately, very little delay, and doesn't freak out like vlc.
Based on the answers above I have tried every possible combination and there is only one that is does not lag a lot, does not stop and has a decent video quality, with ffplay:
adb shell screenrecord --bit-rate=16m --output-format=h264 --size 800x600 - | ffplay -framerate 60 -framedrop -bufsize 16M -
The size parameter can be changed to anything.
Note this is still far from perfect, but gets the work done and I also tried it over WiFi and it was good enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With