【备份】ROC-RK3588S-PC开发板资料
『回复列表(43|显示机器人聊天)』
# 安装依赖包
sudo apt install --no-install-recommends --no-install-suggests gstreamer1.0-plugins-bad
export GST_DEBUG=2
VIDEO_DEVICE="/dev/video0"
VIDEO_WIDTH="640"
VIDEO_HEIGHT="480"
VIDEO_FPS="30"
# 视频编码:h264 或 h265
VIDEO_CODEC="h264"
AUDIO_DEVICE="$(pactl get-default-source)"
AUDIO_SAMPLE_RATE="44100"
AUDIO_CHANNEL="2"
# 输出格式:matroska (mkv), mpegts 或 mp4
# 建议使用 matroska 或 mpegts,因为 mp4 未正常结束录制会无法观看
OUTPUT_FORMAT="matroska"
OUTPUT_FILE="./output.mkv"
echo "-------------------------------------"
echo "Video: $VIDEO_DEVICE (resolution: ${VIDEO_WIDTH}x${VIDEO_HEIGHT}, fps: $VIDEO_FPS, codec: $VIDEO_CODEC)"
echo "Audio: $AUDIO_DEVICE (sample rate: $AUDIO_SAMPLE_RATE, channel: $AUDIO_CHANNEL)"
echo "Output: $OUTPUT_FILE (format: $OUTPUT_FORMAT)"
echo "-------------------------------------"
gst-launch-1.0 -e \
v4l2src device="$VIDEO_DEVICE" \
! video/x-raw,width="$VIDEO_WIDTH",height="$VIDEO_HEIGHT",framerate="$VIDEO_FPS"/1 \
! tee name=preview \
! queue \
! videoconvert \
! mpp"$VIDEO_CODEC"enc \
! "$VIDEO_CODEC"parse \
! mx. \
preview. \
! queue \
! videoconvert \
! autovideosink sync=false \
pulsesrc device="$AUDIO_DEVICE" \
! audio/x-raw,rate="$AUDIO_SAMPLE_RATE",channels="$AUDIO_CHANNEL" \
! queue \
! audioconvert \
! voaacenc \
! mx. \
"$OUTPUT_FORMAT"mux name=mx \
! filesink location="$OUTPUT_FILE"