FPV Camera(RPI3+V2.1) | wfb_ng Release 23.01 | Ubuntu 20.04 xfce软解测试

92 篇文章 37 订阅

@[TOC](FPV Camera(RPI3+V2.1) | wfb_ng Release 23.01 | Ubuntu 20.04 xfce软解测试)

1. 简介

与其他Linux桌面系统相比,Xfce消耗更少的CPU,仅使用1%的CPU。因此低CPU是Xfce的独特卖点之一。在FPV Camera(RPI3+V2.1) | wfb_ng Release 23.01 | Intel® Core™2 Duo CPU T6570 @ 2.10GHz gnome软解测试上,发现genome在720P 60FPS时,H264解码占用大量CPU资源,因此我们尝试减少桌面系统对CPU的占用率来看看有什么新的发现。

2. 安装xfce

xfce安装

$ sudo apt install tasksel
$ sudo tasksel install xubuntu-desktop
$ sudo apt install xfce4
$ sudo apt install xfce4-goodies

浏览器firefox无法上网,使用chromium替换

$ sudo apt-get remove firefox
$ sudo apt-get install chromium-browser

重启系统使用xfce桌面

$ sudo reboot

3. 测试

3.1 gst-launch-1.0 1280x720 720P 30FPS

$ gst-launch-1.0 v4l2src do-timestamp=true io-mode=mmap device=/dev/video0 \
				extra-controls="controls,image_stabilization=1,h264_profile=4,h264_i_frame_period=60,h264_level=11,power_line_frequency=1,exposure_metering_mong=1,exposure_dynamic_framerate=0,scene_mode=0,video_bitrate_mode=1,video_bitrate=2000000,repeat_sequence_header=1" \
				! video/x-h264,profile=high,width=1280,height=720,framerate=30/1,stream-format=byte-stream \
				! h264parse disable-passthrough=true ! rtph264pay config-interval=1 pt=96 mtu=1400 aggregate-mode=zero-latency ! udpsink host=127.0.0.1 port=5602 sync=false

gst1280x720@fps30

3.2 gst-launch-1.0 1280x720 720P 45FPS

$ gst-launch-1.0 v4l2src do-timestamp=true io-mode=mmap device=/dev/video0 \
				extra-controls="controls,image_stabilization=1,h264_profile=4,h264_i_frame_period=60,h264_level=11,power_line_frequency=1,exposure_metering_mong=1,exposure_dynamic_framerate=0,scene_mode=0,video_bitrate_mode=1,video_bitrate=2000000,repeat_sequence_header=1" \
				! video/x-h264,profile=high,width=1280,height=720,framerate=45/1,stream-format=byte-stream \
				! h264parse disable-passthrough=true ! rtph264pay config-interval=1 pt=96 mtu=1400 aggregate-mode=zero-latency ! udpsink host=127.0.0.1 port=5602 sync=false

gst1280x720fxce@fps45

3.3 gst-launch-1.0 1280x720 720P 60FPS

$ gst-launch-1.0 v4l2src do-timestamp=true io-mode=mmap device=/dev/video0 \
				extra-controls="controls,image_stabilization=1,h264_profile=4,h264_i_frame_period=60,h264_level=11,power_line_frequency=1,exposure_metering_mong=1,exposure_dynamic_framerate=0,scene_mode=0,video_bitrate_mode=1,video_bitrate=2000000,repeat_sequence_header=1" \
				! video/x-h264,profile=high,width=1280,height=720,framerate=60/1,stream-format=byte-stream \
				! h264parse disable-passthrough=true ! rtph264pay config-interval=1 pt=96 mtu=1400 aggregate-mode=zero-latency ! udpsink host=127.0.0.1 port=5602 sync=false

gst1280x720fxce@fps60

3.4 gst-launch-1.0 800x600 SVGA 60FPS

$ gst-launch-1.0 v4l2src do-timestamp=true io-mode=mmap device=/dev/video0 \
				extra-controls="controls,image_stabilization=1,h264_profile=4,h264_i_frame_period=60,h264_level=11,power_line_frequency=1,exposure_metering_mong=1,exposure_dynamic_framerate=0,scene_mode=0,video_bitrate_mode=1,video_bitrate=2000000,repeat_sequence_header=1" \
				! video/x-h264,profile=high,width=800,height=600,framerate=60/1,stream-format=byte-stream \
				! h264parse disable-passthrough=true ! rtph264pay config-interval=1 pt=96 mtu=1400 aggregate-mode=zero-latency ! udpsink host=127.0.0.1 port=5602 sync=false

gst800x600fxce@fps60

3.5 gst-launch-1.0 640x480 VGA 60FPS

$ gst-launch-1.0 v4l2src do-timestamp=true io-mode=mmap device=/dev/video0 \
				extra-controls="controls,image_stabilization=1,h264_profile=4,h264_i_frame_period=60,h264_level=11,power_line_frequency=1,exposure_metering_mong=1,exposure_dynamic_framerate=0,scene_mode=0,video_bitrate_mode=1,video_bitrate=2000000,repeat_sequence_header=1" \
				! video/x-h264,profile=high,width=640,height=480,framerate=60/1,stream-format=byte-stream \
				! h264parse disable-passthrough=true ! rtph264pay config-interval=1 pt=96 mtu=1400 aggregate-mode=zero-latency ! udpsink host=127.0.0.1 port=5602 sync=false

gst640x480fxce@fps60

3.6 gst-launch-1.0 480x320 HVGA 60FPS

$ gst-launch-1.0 v4l2src do-timestamp=true io-mode=mmap device=/dev/video0 \
				extra-controls="controls,image_stabilization=1,h264_profile=4,h264_i_frame_period=60,h264_level=11,power_line_frequency=1,exposure_metering_mong=1,exposure_dynamic_framerate=0,scene_mode=0,video_bitrate_mode=1,video_bitrate=2000000,repeat_sequence_header=1" \
				! video/x-h264,profile=high,width=480,height=320,framerate=60/1,stream-format=byte-stream \
				! h264parse disable-passthrough=true ! rtph264pay config-interval=1 pt=96 mtu=1400 aggregate-mode=zero-latency ! udpsink host=127.0.0.1 port=5602 sync=false

gst480x320fxce@fps60

4. 总结

4.1 1280x720 720P 30FPS x 3张清晰延时,统计平均 128ms,最小128ms,最大128ms

  • 第一张:1019 - 891= 128 ms

在这里插入图片描述

  • 第二张:531 - 403= 128 ms

在这里插入图片描述

  • 第三张:843 - 715= 128 ms

在这里插入图片描述

4.2 1280x720 720P 45FPS x 3张清晰延时,统计平均 85ms,最小80ms,最大88ms

  • 第一张:179 - 91 = 88 ms
    在这里插入图片描述

  • 第二张:331 - 243 = 88 ms
    在这里插入图片描述

  • 第三张:187 - 107= 80 ms

在这里插入图片描述

4.3 1280x720 720P 60FPS - 视频卡顿

鉴于该模式下,整体视频出现卡顿,延时测试取消。

在这里插入图片描述

4.4 800x600 SVGA 60FPS x 3张清晰延时,统计平均 85ms,最小80ms,最大88ms

  • 第一张:523 - 435 = 88 ms

在这里插入图片描述

  • 第二张:603 - 515 = 88 ms
    在这里插入图片描述

  • 第三张:499 - 419 = 80 ms

在这里插入图片描述

4.5 640x480 VGA 60FPS x 3张清晰延时,统计平均 56ms,最小40ms,最大80ms

  • 第一张:323 - 283 = 40 ms

在这里插入图片描述

  • 第二张:315 - 267 = 48 ms

在这里插入图片描述

  • 第三张:643 - 563 = 80 ms

在这里插入图片描述

4.6 480x320 HVGA 60FPS x 3张清晰延时,统计平均 48ms,最小48ms,最大48ms

  • 第一张:219 - 171 = 48 ms

在这里插入图片描述

  • 第二张:379 - 331 = 48 ms

在这里插入图片描述

  • 第三张:283 - 235 = 48 ms

在这里插入图片描述

4.7 视频延时测试结果

  • 1280x720 720P 30FPS x 3张清晰延时,统计平均 128ms,最小128ms,最大128ms
  • 1280x720 720P 45FPS x 3张清晰延时,统计平均 85ms,最小80ms,最大88ms
  • 1280x720 720P 60FPS - 卡顿
  • 800x600 SVGA 60FPS x 3张清晰延时,统计平均 85ms,最小80ms,最大88ms
  • 640x480 VGA 60FPS x 3张清晰延时,统计平均 56ms,最小40ms,最大80ms
  • 480x320 HVGA 60FPS x 3张清晰延时,统计平均 48ms,最小48ms,最大48ms

5. 参考资料

【1】wfb-ng Release 23.01镜像无头烧录&配置(2)
【2】wfb-ng Release 23.01镜像无头烧录&配置(1)
【3】wfb-ng 锁定WiFi接口
【4】Raspbian镜像无头烧录
【5】How to install a web browser in XFCE?
【6】How install XFCE and remove gnome on Ubuntu 20.0.4 LTS
【7】How to Install XFCE Desktop or Xubuntu in Ubuntu 22.04|20.04
【8】Gnome vs Xfce Differences
【9】模拟FPV-肥鲨HDO2+无牙仔2+熊猫VT5804ML1+Foxeer野火 时延测试
【10】FPV Camera(RPI3+V2.1) | wfb_ng Release 23.01 | ubuntu20.04 gnome软解测试
【11】FPV Camera(RPI 3B+/Zero W+V2.1) | wfb_ng Release 23.01 | H264硬解测试

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
将FFmpeg命令转化为C语言代码需要使用FFmpeg的C语言API,下面是一个简单的示例: ```c #include <stdio.h> #include <libavformat/avformat.h> #include <libavutil/opt.h> int main(int argc, char *argv[]) { int ret; AVFormatContext *in_fmt_ctx = NULL; AVCodecContext *in_codec_ctx = NULL; AVOutputFormat *out_fmt = NULL; AVFormatContext *out_fmt_ctx = NULL; AVStream *in_stream = NULL; AVStream *out_stream = NULL; AVPacket pkt; // 打开输入文件 const char *input_file = "/home/tsdl/Downloads/FPV_2021-0-1_12-37-23.h264"; if ((ret = avformat_open_input(&in_fmt_ctx, input_file, NULL, NULL)) < 0) { fprintf(stderr, "Could not open input file '%s'\n", input_file); goto end; } // 获取输入流信息 if ((ret = avformat_find_stream_info(in_fmt_ctx, NULL)) < 0) { fprintf(stderr, "Failed to retrieve input stream information\n"); goto end; } // 获取输入视频流 int video_stream_index = -1; for (int i = 0; i < in_fmt_ctx->nb_streams; i++) { if (in_fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { video_stream_index = i; break; } } if (video_stream_index == -1) { fprintf(stderr, "Input file does not contain a video stream\n"); goto end; } in_stream = in_fmt_ctx->streams[video_stream_index]; in_codec_ctx = avcodec_alloc_context3(NULL); if (!in_codec_ctx) { fprintf(stderr, "Failed to allocate codec context\n"); goto end; } if ((ret = avcodec_parameters_to_context(in_codec_ctx, in_stream->codecpar)) < 0) { fprintf(stderr, "Failed to copy codec parameters to codec context\n"); goto end; } // 打开输出URL const char *output_url = "http://192.168.114.34:1985/rtc/v1/whip/?app=live&stream=livestream"; if ((ret = avformat_alloc_output_context2(&out_fmt_ctx, NULL, "rtc", output_url)) < 0) { fprintf(stderr, "Could not allocate output format context\n"); goto end; } out_fmt = out_fmt_ctx->oformat; // 添加输出流 out_stream = avformat_new_stream(out_fmt_ctx, NULL); if (!out_stream) { fprintf(stderr, "Failed to create new output stream\n"); goto end; } AVCodecParameters *codecpar = out_stream->codecpar; codecpar->codec_type = AVMEDIA_TYPE_VIDEO; codecpar->codec_id = AV_CODEC_ID_H264; codecpar->width = in_codec_ctx->width; codecpar->height = in_codec_ctx->height; codecpar->format = in_codec_ctx->pix_fmt; avcodec_parameters_to_context(out_stream->codec, codecpar); // 打开输出URL if (!(out_fmt->flags & AVFMT_NOFILE)) { if ((ret = avio_open(&out_fmt_ctx->pb, output_url, AVIO_FLAG_WRITE)) < 0) { fprintf(stderr, "Could not open output URL '%s'\n", output_url); goto end; } } // 写输出文件头 if ((ret = avformat_write_header(out_fmt_ctx, NULL)) < 0) { fprintf(stderr, "Error occurred when writing output file header\n"); goto end; } // 转码并输出 while (1) { ret = av_read_frame(in_fmt_ctx, &pkt); if (ret < 0) { break; } if (pkt.stream_index == video_stream_index) { av_interleaved_write_frame(out_fmt_ctx, &pkt); } av_packet_unref(&pkt); } // 写输出文件尾 av_write_trailer(out_fmt_ctx); end: if (in_fmt_ctx) { avformat_close_input(&in_fmt_ctx); } if (in_codec_ctx) { avcodec_free_context(&in_codec_ctx); } if (out_fmt_ctx) { if (out_fmt_ctx->pb) { avio_closep(&out_fmt_ctx->pb); } avformat_free_context(out_fmt_ctx); } return ret; } ``` 上面的代码使用了FFmpeg的C语言API来打开输入文件、获取输入流信息、获取输入视频流、打开输出URL、添加输出流、转码并输出、写输出文件头和输出文件尾等操作。请注意,此处的代码仅供参考,具体实现可能需要根据实际情况进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值