我正在尝试通过 ffmpeg 录制摄像机流,但我很难理解如何编写正确的录制命令。
这是根据v4l2的相机格式
$ v4l2-ctl -d 1 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'RG12'
Name : 12-bit Bayer RGRG/GBGB
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
Run Code Online (Sandbox Code Playgroud)
这就是我到目前为止所尝试的
ffmpeg -framerate 30 -video_size 1920x1080 -i /dev/video0 output.mkv
Run Code Online (Sandbox Code Playgroud)
这将返回这个文件和一个空的输出文件
$ ffmpeg -f v4l2 -framerate 30 -video_size 1920x1080 -i /dev/video0 output.mkv
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth …Run Code Online (Sandbox Code Playgroud)