我们基于WIN11+WSL2+UBUNTU的方式搭建开发环境,搭建过程可以网上搜索,这里不再赘述。需要安装必要的工具,比如sudo apt-get install gcc-aarch64-linux-gnu等。
就可以使用ffmpeg,ffplay,ffprobe三个工具了。
PC端wget https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_10mb.mp4
ffmpeg -benchmark -i big_buck_bunny_720p_10mb.mp4 -f null -
lhj@lhj:~$ ffmpeg -benchmark -i big_buck_bunny_720p_10mb.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: --disable-x86asm
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 'big_buck_bunny_720p_10mb.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:01:02.31, start: 0.000000, bitrate: 1347 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 959 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= 1557 fps=0.0 q=-0.0 Lsize=N/A time=00:01:02.29 bitrate=N/A speed=64.1x
video:730kB audio:35052kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=5.487s stime=0.943s rtime=1.000s
bench: maxrss=94516kB
开发板端
wget https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_10mb.mp4ffmpeg -benchmark -i big_buck_bunny_720p_10mb.mp4 -f null - root@ok3588:~# ffmpeg -benchmark -i big_buck_bunny_720p_10mb.mp4 -f null -
ffmpeg version N-109968-gcc76e8340d Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/root/opt/ffmpeg
libavutil 58. 3.100 / 58. 3.100
libavcodec 60. 6.100 / 60. 6.100
libavformat 60. 4.100 / 60. 4.100
libavdevice 60. 2.100 / 60. 2.100
libavfilter 9. 4.100 / 9. 4.100
libswscale 7. 2.100 / 7. 2.100
libswresample 4. 11.100 / 4. 11.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'big_buck_bunny_720p_10mb.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:01:02.31, start: 0.000000, bitrate: 1347 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 959 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 : Lavf60.4.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 : Lavc60.6.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 : Lavc60.6.100 pcm_s16le
frame= 1557 fps=749 q=-0.0 Lsize=N/A time=00:01:02.29 bitrate=N/A speed=29.9x
video:730kB audio:35052kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=10.268s stime=0.513s rtime=2.106s
bench: maxrss=55708kB
root@ok3588:~#
Ffprobe使用
root@ok3588:~# ffprobe big_buck_bunny_720p_10mb.mp4
ffprobe version N-109968-gcc76e8340d Copyright (c) 2007-2023 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/root/opt/ffmpeg
libavutil 58. 3.100 / 58. 3.100
libavcodec 60. 6.100 / 60. 6.100
libavformat 60. 4.100 / 60. 4.100
libavdevice 60. 2.100 / 60. 2.100
libavfilter 9. 4.100 / 9. 4.100
libswscale 7. 2.100 / 7. 2.100
libswresample 4. 11.100 / 4. 11.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'big_buck_bunny_720p_10mb.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:01:02.31, start: 0.000000, bitrate: 1347 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 959 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]
root@ok3588:~#

总结
以上实现了ffmpeg开发环境的搭建,得益于开发板强劲的性能,运行了Ubuntu20系统,且支持apt安装包,所以可以直接在开发板上构建,避免了繁琐的交叉编译,构建速度也和PC上差不太多。和PC端对比性能测试看到基本是PC端性能的一半,可以看到是非常强悍的,基本可以作为开发PC来使用了。
我要赚赏金
