加入星计划,您可以享受以下权益:

  • 创作内容快速变现
  • 行业影响力扩散
  • 作品版权保护
  • 300W+ 专业用户
  • 1.5W+ 优质创作者
  • 5000+ 长期合作伙伴
立即加入
  • 正文
    • 01.前言
    • 02.编译过程
    • 03.网络视频点播终端
    • 04.总结
  • 推荐器件
  • 相关推荐
  • 电子产业图谱
申请入驻 产业图谱

【评测】米尔ARM+FPGA开发板基于ffmpeg的网络视频播放终端

2023/04/13
3494
阅读需 39 分钟
加入交流群
扫码加入
获取工程师必备礼包
参与热点资讯讨论

01.前言

米尔这款ARM+fpga开发板具备高性能的ARM MPU+多媒体能力,采用i.MX 8M Mini+Artix-7处理器,特别适合多媒体终端开发。本篇就体验搭建ffmpeg开发环境,并进行性能测试,进行视频播放,演示网络视频播放器等。

02.编译过程

交叉编译
下载代码

git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg/

交叉编译

./configure --cross-prefix=aarch64-linux-gnu- --enable-cross-compile --target-os=linux --cc=aarch64-linux-gnu-gcc --arch=arm64 --prefix=/home/lhj/opt/ffmpeg/board --enable-ffmpeg --disable-armv5te --disable-armv6 --disable-armv6t2
WARNING: aarch64-linux-gnu-pkg-config not found, library detection may fail.
make
make install

生成文件如下

lhj@lhj:~/FFmpeg$ tree /home/lhj/opt/ffmpeg/board/
/home/lhj/opt/ffmpeg/board/
|-- bin
| |-- ffmpeg
| `-- ffprobe
|-- include
| |-- libavcodec
| | |-- ac3_parser.h
| | |-- adts_parser.h
| | |-- avcodec.h
| | |-- avdct.h
| | |-- avfft.h
| | |-- bsf.h
| | |-- codec.h
| | |-- codec_desc.h
| | |-- codec_id.h
| | |-- codec_par.h
| | |-- d3d11va.h
| | |-- defs.h
| | |-- dirac.h
| | |-- dv_profile.h
| | |-- dxva2.h
| | |-- jni.h
| | |-- mediacodec.h
| | |-- packet.h
| | |-- qsv.h
| | |-- vdpau.h
| | |-- version.h
| | |-- version_major.h
| | |-- videotoolbox.h
| | |-- vorbis_parser.h
| | `-- xvmc.h
| |-- libavdevice
| | |-- avdevice.h
| | |-- version.h
| | `-- version_major.h
| |-- libavfilter
| | |-- avfilter.h
| | |-- buffersink.h
| | |-- buffersrc.h
| | |-- version.h
| | `-- version_major.h
| |-- libavformat
| | |-- avformat.h
| | |-- avio.h
| | |-- version.h
| | `-- version_major.h
| |-- libavutil
| | |-- adler32.h
| | |-- aes.h
| | |-- aes_ctr.h
| | |-- ambient_viewing_environment.h
| | |-- attributes.h
| | |-- audio_fifo.h
| | |-- avassert.h
| | |-- avconfig.h
| | |-- avstring.h
| | |-- avutil.h
| | |-- base64.h
| | |-- blowfish.h
| | |-- bprint.h
| | |-- bswap.h
| | |-- buffer.h
| | |-- camellia.h
| | |-- cast5.h
| | |-- channel_layout.h
| | |-- common.h
| | |-- cpu.h
| | |-- crc.h
| | |-- csp.h
| | |-- des.h
| | |-- detection_bbox.h
| | |-- dict.h
| | |-- display.h
| | |-- dovi_meta.h
| | |-- downmix_info.h
| | |-- encryption_info.h
| | |-- error.h
| | |-- eval.h
| | |-- ffversion.h
| | |-- fifo.h
| | |-- file.h
| | |-- film_grain_params.h
| | |-- frame.h
| | |-- hash.h
| | |-- hdr_dynamic_metadata.h
| | |-- hdr_dynamic_vivid_metadata.h
| | |-- hmac.h
| | |-- hwcontext.h
| | |-- hwcontext_cuda.h
| | |-- hwcontext_d3d11va.h
| | |-- hwcontext_drm.h
| | |-- hwcontext_dxva2.h
| | |-- hwcontext_mediacodec.h
| | |-- hwcontext_opencl.h
| | |-- hwcontext_qsv.h
| | |-- hwcontext_vaapi.h
| | |-- hwcontext_vdpau.h
| | |-- hwcontext_videotoolbox.h
| | |-- hwcontext_vulkan.h
| | |-- imgutils.h
| | |-- intfloat.h
| | |-- intreadwrite.h
| | |-- lfg.h
| | |-- log.h
| | |-- lzo.h
| | |-- macros.h
| | |-- mastering_display_metadata.h
| | |-- mathematics.h
| | |-- md5.h
| | |-- mem.h
| | |-- motion_vector.h
| | |-- murmur3.h
| | |-- opt.h
| | |-- parseutils.h
| | |-- pixdesc.h
| | |-- pixelutils.h
| | |-- pixfmt.h
| | |-- random_seed.h
| | |-- rational.h
| | |-- rc4.h
| | |-- replaygain.h
| | |-- ripemd.h
| | |-- samplefmt.h
| | |-- sha.h
| | |-- sha512.h
| | |-- spherical.h
| | |-- stereo3d.h
| | |-- tea.h
| | |-- threadmessage.h
| | |-- time.h
| | |-- timecode.h
| | |-- timestamp.h
| | |-- tree.h
| | |-- twofish.h
| | |-- tx.h
| | |-- uuid.h
| | |-- version.h
| | |-- video_enc_params.h
| | `-- xtea.h
| |-- libswresample
| | |-- swresample.h
| | |-- version.h
| | `-- version_major.h
| `-- libswscale
| |-- swscale.h
| |-- version.h
| `-- version_major.h
|-- lib
| |-- libavcodec.a
| |-- libavdevice.a
| |-- libavfilter.a
| |-- libavformat.a
| |-- libavutil.a
| |-- libswresample.a
| |-- libswscale.a
| `-- pkgconfig
| |-- libavcodec.pc
| |-- libavdevice.pc
| |-- libavfilter.pc
| |-- libavformat.pc
| |-- libavutil.pc
| |-- libswresample.pc
| `-- libswscale.pc
`-- share
|-- doc
| `-- ffmpeg
| |-- bootstrap.min.css
| |-- default.css
| |-- developer.html
| |-- faq.html
| |-- fate.html
| |-- ffmpeg-all.html
| |-- ffmpeg-bitstream-filters.html
| |-- ffmpeg-codecs.html
| |-- ffmpeg-devices.html
| |-- ffmpeg-filters.html
| |-- ffmpeg-formats.html
| |-- ffmpeg-protocols.html
| |-- ffmpeg-resampler.html
| |-- ffmpeg-scaler.html
| |-- ffmpeg-utils.html
| |-- ffmpeg.html
| |-- ffprobe-all.html
| |-- ffprobe.html
| |-- general.html
| |-- git-howto.html
| |-- libavcodec.html
| |-- libavdevice.html
| |-- libavfilter.html
| |-- libavformat.html
| |-- libavutil.html
| |-- libswresample.html
| |-- libswscale.html
| |-- mailing-list-faq.html
| |-- nut.html
| |-- platform.html
| `-- style.min.css
|-- ffmpeg
| |-- examples
| | |-- Makefile
| | |-- README
| | |-- avio_list_dir.c
| | |-- avio_reading.c
| | |-- decode_audio.c
| | |-- decode_video.c
| | |-- demuxing_decoding.c
| | |-- encode_audio.c
| | |-- encode_video.c
| | |-- extract_mvs.c
| | |-- filter_audio.c
| | |-- filtering_audio.c
| | |-- filtering_video.c
| | |-- http_multiclient.c
| | |-- hw_decode.c
| | |-- metadata.c
| | |-- muxing.c
| | |-- qsv_transcode.c
| | |-- qsvdec.c
| | |-- remuxing.c
| | |-- resampling_audio.c
| | |-- scaling_video.c
| | |-- transcode_aac.c
| | |-- transcoding.c
| | |-- vaapi_encode.c
| | `-- vaapi_transcode.c
| |-- ffprobe.xsd
| |-- libvpx-1080p.ffpreset
| |-- libvpx-1080p50_60.ffpreset
| |-- libvpx-360p.ffpreset
| |-- libvpx-720p.ffpreset
| `-- libvpx-720p50_60.ffpreset
`-- man
|-- man1
| |-- ffmpeg-all.1
| |-- ffmpeg-bitstream-filters.1
| |-- ffmpeg-codecs.1
| |-- ffmpeg-devices.1
| |-- ffmpeg-filters.1
| |-- ffmpeg-formats.1
| |-- ffmpeg-protocols.1
| |-- ffmpeg-resampler.1
| |-- ffmpeg-scaler.1
| |-- ffmpeg-utils.1
| |-- ffmpeg.1
| |-- ffprobe-all.1
| `-- ffprobe.1
`-- man3
|-- libavcodec.3
|-- libavdevice.3
|-- libavfilter.3
|-- libavformat.3
|-- libavutil.3
|-- libswresample.3
`-- libswscale.3

19 directories, 234 files
lhj@lhj:~/FFmpeg$

开发板上部署

将bin文件复制到windows下

cp /home/lhj/opt/ffmpeg/board/bin/* /mnt/d

将lib文件复制到windows下

cp /home/lhj/opt/ffmpeg/board/lib/* /mnt/d

再将上述lib文件*.a导入到开发板的/usr/lib目录下

将ffmpeg和ffprobe导入到~目录下

测试

chmod +x ffmpeg ffprobe

root@myd-jx8mma7:~# ./ffmpeg
ffmpeg version N-109734-g806ecace91 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --cross-prefix=aarch64-linux-gnu- --enable-cross-compile --target-os=linux --cc=aarch64-linux-gnu-gcc --arch=arm64 --prefix=/home/lhj/opt/ffmpeg/board --enable-ffmpeg --disable-armv5te --disable-armv6 --disable-armv6t2
libavutil 57. 44.100 / 57. 44.100
libavcodec 59. 60.100 / 59. 60.100
libavformat 59. 37.100 / 59. 37.100
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 56.100 / 8. 56.100
libswscale 6. 8.112 / 6. 8.112
libswresample 4. 9.100 / 4. 9.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
root@myd-jx8mma7:~#

root@myd-jx8mma7:~# ./ffprobe
ffprobe version N-109734-g806ecace91 Copyright (c) 2007-2023 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --cross-prefix=aarch64-linux-gnu- --enable-cross-compile --target-os=linux --cc=aarch64-linux-gnu-gcc --arch=arm64 --prefix=/home/lhj/opt/ffmpeg/board --enable-ffmpeg --disable-armv5te --disable-armv6 --disable-armv6t2
libavutil 57. 44.100 / 57. 44.100
libavcodec 59. 60.100 / 59. 60.100
libavformat 59. 37.100 / 59. 37.100
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 56.100 / 8. 56.100
libswscale 6. 8.112 / 6. 8.112
libswresample 4. 9.100 / 4. 9.100
Simple multimedia streams analyzer
usage: ffprobe [OPTIONS] INPUT_FILE

You have to specify one input file.
Use -h to get full help or, even better, run 'man ffprobe'.
root@myd-jx8mma7:~#

性能测试

https:://www.sample-videos.com/index.php#sample-mp4-video下下载测试视频改名为test.mp4

导入到开发板。

./ffmpeg -benchmark -i test.mp4 -f null -

打印如下

root@myd-jx8mma7:~# ffmpeg -benchmark -i test.mp4 -f null -
-sh: ffmpeg: command not found
root@myd-jx8mma7:~# ./ffmpeg -benchmark -i test.mp4 -f null -
ffmpeg version N-109734-g806ecace91 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --cross-prefix=aarch64-linux-gnu- --enable-cross-compile --target-os=linux --cc=aarch64-linux-gnu-gcc --arch=arm64

--prefix=/home/lhj/opt/ffmpeg/board --enable-ffmpeg --disable-armv5te --disable-armv6 --disable-armv6t2
libavutil      57. 44.100 / 57. 44.100
libavcodec     59. 60.100 / 59. 60.100
libavformat    59. 37.100 / 59. 37.100
libavdevice    59.  8.101 / 59.  8.101
libavfilter     8. 56.100 /  8. 56.100
libswscale      6.  8.112 /  6.  8.112
libswresample   4.  9.100 /  4.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
Metadata:
major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
creation_time   : 1970-01-01T00:00:00.000000Z
encoder         : Lavf53.24.2
Duration: 00:02:50.86, start: 0.000000, bitrate: 1474 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1086 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
Metadata:
creation_time   : 1970-01-01T00:00:00.000000Z
handler_name    : VideoHandler
vendor_id       : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
Metadata:
creation_time   : 1970-01-01T00:00:00.000000Z
handler_name    : SoundHandler
vendor_id       : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
Metadata:
major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder         : Lavf59.37.100
Stream #0:0(und): Video: wrapped_avframe, yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn (default)
Metadata:
creation_time   : 1970-01-01T00:00:00.000000Z
handler_name    : VideoHandler
vendor_id       : [0][0][0][0]
encoder         : Lavc59.60.100 wrapped_avframe
Stream #0:1(und): Audio: pcm_s16le, 48000 Hz, 5.1, s16, 4608 kb/s (default)
Metadata:
creation_time   : 1970-01-01T00:00:00.000000Z
handler_name    : SoundHandler
vendor_id       : [0][0][0][0]
encoder         : Lavc59.60.100 pcm_s16le
frame= 4271 fps=222 q=-0.0 Lsize=N/A time=00:02:50.83 bitrate=N/A speed=8.87x
video:2002kB audio:96108kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=67.061s stime=2.796s rtime=19.272s
bench: maxrss=40720kB
root@myd-jx8mma7:~#

对比在PC上的测试结果

bench: utime=8.169s

bench: maxrss=107384kB

开板上大概是PC上2.5分之一的效率。这相对对于2th Gen Intel(R) Core(TM) i5-12500H   2.50 GHz处理器切实固态硬盘的电脑来说,嵌入式开发板的性能已经算不错了,单纯针对这一点几乎可以媲美PC使用了。

03.网络视频点播终端

./ffmpeg -re -i test.mp4 -an -vcodec copy -f rtp rtp://192.168.2.100:5004

打印如下

root@myd-jx8mma7:~# ./ffmpeg -re -i test.mp4 -an -vcodec copy -f rtp rtp://192.168.2.100:5004
ffmpeg version N-109734-g806ecace91 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --cross-prefix=aarch64-linux-gnu- --enable-cross-compile --target-os=linux --cc=aarch64-linux-gnu-gcc --arch=arm64 --prefix=/home/lhj/opt/ffmpeg/board --enable-ffmpeg --disable-armv5te --disable-armv6 --disable-armv6t2
libavutil      57. 44.100 / 57. 44.100
libavcodec     59. 60.100 / 59. 60.100
libavformat    59. 37.100 / 59. 37.100
libavdevice    59.  8.101 / 59.  8.101
libavfilter     8. 56.100 /  8. 56.100
libswscale      6.  8.112 /  6.  8.112
libswresample   4.  9.100 /  4.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
Metadata:
major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
creation_time   : 1970-01-01T00:00:00.000000Z
encoder         : Lavf53.24.2
Duration: 00:02:50.86, start: 0.000000, bitrate: 1474 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1086 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
Metadata:
creation_time   : 1970-01-01T00:00:00.000000Z
handler_name    : VideoHandler
vendor_id       : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
Metadata:
creation_time   : 1970-01-01T00:00:00.000000Z
handler_name    : SoundHandler
vendor_id       : [0][0][0][0]
Output #0, rtp, to 'rtp://192.168.2.100:5004':
Metadata:
major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder         : Lavf59.37.100
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1086 kb/s, 25 fps, 25 tbr, 90k tbn (default)
Metadata:
creation_time   : 1970-01-01T00:00:00.000000Z
handler_name    : VideoHandler
vendor_id       : [0][0][0][0]
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 192.168.2.100
t=0 0
a=tool:libavformat 59.37.100
m=video 5004 RTP/AVP 96
b=AS:1086
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z01AH9oBQBbsBEAAAAMAQAAADIPGDKg=,aO88gA==; profile-level-id=4D401F

Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  683 fps= 25 q=-1.0 size=    3102kB time=00:00:27.28 bitrate= 931.5kbits/s speed=   1x

复制如下部分:

在PC端新建demo.sdp文件,粘体上述内容,然后使用VLC打开该sdp文件(VLC的安装网上搜索即可)。

可以看到视频开始播放:

04.总结

本文进行了ARM+fpga开发板的ffmpeg开发环境的搭建,并在ARM+fpga开发板上测试了ffmpeg的解码性能,以及实现了网络视频播放的Demo。综上可以看出米尔这块ARM+fpga开发板开发板的多媒体性能是非常不错的,完全满足多媒体终端的应用场景。

 

推荐器件

更多器件
器件型号 数量 器件厂商 器件描述 数据手册 ECAD模型 风险等级 参考价格 更多信息
74HC00D 1 Nexperia NAND Gate

ECAD模型

下载ECAD模型
$0.81 查看
ECS-2520S18-384-EN-TR 1 ECS International Inc HCMOS Output Clock Oscillator,

ECAD模型

下载ECAD模型
$1.86 查看
ACPL-247-500E 1 Avago Technologies 4 CHANNEL TRANSISTOR OUTPUT OPTOCOUPLER, ROHS COMPLIANT, SOP-16

ECAD模型

下载ECAD模型
$3.23 查看
米尔科技

米尔科技

米尔电子,是一家专注于嵌入式处理器模组设计、研发、生产和销售于一体的国家级高新技术企业,也被评为专精特新企业。米尔电子深耕嵌入式领域10多年,致力于为企业级客户提供基于ARM、FPGA、RISC-V和AI等各种架构,稳定可靠的处理器模组,满足客户大批量产品应用部署的需求,同时为客户提供产品定制设计、行业应用解决方案和OEM的一站式服务。

米尔电子,是一家专注于嵌入式处理器模组设计、研发、生产和销售于一体的国家级高新技术企业,也被评为专精特新企业。米尔电子深耕嵌入式领域10多年,致力于为企业级客户提供基于ARM、FPGA、RISC-V和AI等各种架构,稳定可靠的处理器模组,满足客户大批量产品应用部署的需求,同时为客户提供产品定制设计、行业应用解决方案和OEM的一站式服务。 收起

查看更多

相关推荐

电子产业图谱

米尔电子,是一家专注于嵌入式处理器模组设计、研发、生产和销售于一体的国家级高新技术企业,也被评为专精特新企业。米尔电子深耕嵌入式领域10多年,致力于为企业级客户提供基于ARM、FPGA、RISC-V和AI等各种架构,稳定可靠的处理器模组,满足客户大批量产品应用部署的需求,同时为客户提供产品定制设计、行业应用解决方案和OEM的一站式服务。 米尔英文简称“MYIR”,是“Make Your Idea Real”第一个大写字母的缩写。我们的理念是“专业服务助力客户成功”,目前米尔已通过专业高效的服务,帮助全球数万家企业的产品成功上市。