发布时间:2024-04-08 13:30:42
本篇测评由优秀测评者“qinyunti”提供。 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开发板开发板的多媒体性能是非常不错的,完全满足多媒体终端的应用场景。