首頁(yè) 資訊 > 創(chuàng)新 > 正文

全球熱議:ARM+FPGA開發(fā)板基于ffmpeg的網(wǎng)絡(luò)視頻播放終端——米爾NXP i.MX 8M Mini+Artix-7處理器開發(fā)板

本篇測(cè)評(píng)由優(yōu)秀測(cè)評(píng)者“qinyunti”提供。


(資料圖片僅供參考)

01.前言

米爾這款A(yù)RM+fpga開發(fā)板具備高性能的ARM MPU+多媒體能力,采用i.MX 8M Mini+Artix-7處理器,特別適合多媒體終端開發(fā)。本篇就體驗(yàn)搭建ffmpeg開發(fā)環(huán)境,并進(jìn)行性能測(cè)試,進(jìn)行視頻播放,演示網(wǎng)絡(luò)視頻播放器等。

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.319 directories, 234 files lhj@lhj:~/FFmpeg$

開發(fā)板上部署

將bin文件復(fù)制到windows下

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

將lib文件復(fù)制到windows下

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

再將上述lib文件*.a導(dǎo)入到開發(fā)板的/usr/lib目錄下

將ffmpeg和ffprobe導(dǎo)入到~目錄下

測(cè)試

chmod +x ffmpeg ffprobe

root@myd-jx8mma7:~# ./ffmpegffmpeg 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-armv6t2libavutil????? 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:~#

性能測(cè)試

https://www.sample-videos.com/index.php#sample-mp4-video下下載測(cè)試視頻改名為test.mp4

導(dǎo)入到開發(fā)板。

./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:~#

對(duì)比在PC上的測(cè)試結(jié)果

bench: utime=8.169s

bench: maxrss=107384kB

開板上大概是PC上2.5分之一的效率。這相對(duì)對(duì)于2th Gen Intel(R) Core(TM) i5-12500H ? 2.50 GHz處理器切實(shí)固態(tài)硬盤的電腦來說,嵌入式開發(fā)板的性能已經(jīng)算不錯(cuò)了,單純針對(duì)這一點(diǎn)幾乎可以媲美PC使用了。

03.網(wǎng)絡(luò)視頻點(diǎn)播終端

./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

復(fù)制如下部分:

在PC端新建demo.sdp文件,粘體上述內(nèi)容,然后使用VLC打開該sdp文件(VLC的安裝網(wǎng)上搜索即可)。

可以看到視頻開始播放:

04.總結(jié)

本文進(jìn)行了ARM+fpga開發(fā)板的ffmpeg開發(fā)環(huán)境的搭建,并在ARM+fpga開發(fā)板上測(cè)試了ffmpeg的解碼性能,以及實(shí)現(xiàn)了網(wǎng)絡(luò)視頻播放的Demo。綜上可以看出米爾這塊ARM+fpga開發(fā)板開發(fā)板的多媒體性能是非常不錯(cuò)的,完全滿足多媒體終端的應(yīng)用場(chǎng)景。

關(guān)鍵詞:

最近更新

關(guān)于本站 管理團(tuán)隊(duì) 版權(quán)申明 網(wǎng)站地圖 聯(lián)系合作 招聘信息

Copyright © 2005-2018 創(chuàng)投網(wǎng) - www.mallikadua.com All rights reserved
聯(lián)系我們:39 60 29 14 2@qq.com
皖I(lǐng)CP備2022009963號(hào)-3