android - 如何将 adb screenrecord 输出重定向到 pc(windows/linux) 存储

标签 android linux shell ffmpeg adb

在 linux 下,我使用下面的代码将 android 屏幕转换到 pc,效果很好

adb shell "screenrecord --time-limit 1 --output-format=h264 -; screenrecord --time-limit 180 --output-format=h264 -" | ffplay -

所以我认为存在将屏幕记录输出重定向到 pc 存储的方法,所以我尝试使用以下代码

adb shell "screenrecord --time-limit 1 --output-format=h264 -; screenrecord --time-limit 180 --output-format=h264 -" >> /tmp/t.mp4

但是输出的视频文件不能用vlc和google-chrome打开,怎么解决?

ffplay 属于 ffmpeg,所以我猜 ffmpeg 中存在类似的 cli 将输入视频流输出到视频文件

最佳答案

我找到解决方案,使用默认的 ffmpeg,在最新的 linux mint 中,它使用 avconv 代替 ffmpeg,但是 2 个 clis 语法是相同的,以下是我的代码

adb shell "screenrecord --time-limit 1 --output-format=h264 -; screenrecord --time-limit 180 --output-format=h264 -" | avconv -i - /tmp/t.mp4

关于android - 如何将 adb screenrecord 输出重定向到 pc(windows/linux) 存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53559359/

相关文章:

共享首选项的android默认值

linux - ARM:禁用 MMU 并更新 PC

linux - 使用 Batch 解决 Linux 通配符问题

linux - 从 bash 提示符和脚本向 docker exec 传递参数

android - 按照 Android 开发者文档添加 fragment 不起作用?

java - 无法解析 setLatestEventInfo 方法

linux - 将 ssh 结果拉到变量中

bash - Shell 脚本 - Sudo 权限随时间丢失

bash - 在 Ubuntu 16.04 中搞砸了 PATH 环境变量

android - admob adview 在旋转时导致 android 崩溃