I'm using Windows 7 64 bit on my laptop and Android 5.0.1 on my Samsung Galaxy S4 device.
I'm trying to stream my device's screen via adb using following code:
adb shell screenrecord --output-format=h264 - | vlc -
I have vlc v2.2.4
But it doesn't show anything.
But if I use media player classic, which comes with k-lite mega codec pack v12.3.5 with the following code:
adb shell screenrecord --output-format=h264 - | "C:Program Files (x86)K-Lite Codec PackMPC-HC64mpc-hc64_nvo.exe" -
it's showing something like my screen, but image is totally broken.
And if I use adb shell screenrecord --output-format=h264 /sdcard/screenrecord.mp4
to record my devices screen, pull it from device and open it with media player classic, then it video is totally fine. However, vlc can't open even in this case.
What might be the problem? Why I can watch recorded videos, but cannot watch streamed video?
And one more follow-up question. I found adb-server's command to get device's screenshot. It's alternative to the adb shell screencap
command. I can use that command via QTcpSocket in Qt framework.
However, I couldn't find adb server alternative to adb shell screenrecord
. In this case I need to use QProcess to run commands and somehow forward output to QMediaPlayer. So far I couldn't succeed in it, cuz as I found QMediaPlayer::setMedia
accepts QMediaSource
or QIODevice
. I found that QProcess is inherited from QIODevice
and tried to supply it as an argument to QMediaPlayer:::setMedia
, but my program exited with error code 1. How can I forward QProcess
's output to QMediaPlayer
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…