转自公众号,欢迎关注
公众号
前言
本开发板具备非常强的多媒体能力,特别适合多媒体终端,广告机,室外播放器等应用场合。本篇就全方面的进行多媒体相关的开发体验。
.安装ffmpeg
sudo apt-get install ffmpeg
图片1.png
查看版本ffmpeg
root@IMX8-Tronlong:~# ffmpeg -v
  • ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  •   built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  •   configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  •   libavutil      56. 31.100 / 56. 31.100
  •   libavcodec     58. 54.100 / 58. 54.100
  •   libavformat    58. 29.100 / 58. 29.100
  •   libavdevice    58.  8.100 / 58.  8.100
  •   libavfilter     7. 57.100 /  7. 57.100
  •   libavresample   4.  0.  0 /  4.  0.  0
  •   libswscale      5.  5.100 /  5.  5.100
  •   libswresample   3.  5.100 /  3.  5.100
  •   libpostproc    55.  5.100 / 55.  5.100
  • Missing argument for option 'v'.
  • Error splitting the argument list: Invalid argument
  • root@IMX8-Tronlong:~#
  • 复制代码
    ffplay
    root@IMX8-Tronlong:~# ffplay
  • ffplay version 4.2.7-0ubuntu0.1 Copyright (c) 2003-2022 the FFmpeg developers
  •   built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  •   configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  •   libavutil      56. 31.100 / 56. 31.100
  •   libavcodec     58. 54.100 / 58. 54.100
  •   libavformat    58. 29.100 / 58. 29.100
  •   libavdevice    58.  8.100 / 58.  8.100
  •   libavfilter     7. 57.100 /  7. 57.100
  •   libavresample   4.  0.  0 /  4.  0.  0
  •   libswscale      5.  5.100 /  5.  5.100
  •   libswresample   3.  5.100 /  3.  5.100
  •   libpostproc    55.  5.100 / 55.  5.100
  • Simple media player
  • usage: ffplay [options] input_file
  • An input file must be specified
  • Use -h to get full help or, even better, run 'man ffplay'
  • root@IMX8-Tronlong:~#
  • 复制代码
    ffprobe
    root@IMX8-Tronlong:~# ffprobe
  • ffprobe version 4.2.7-0ubuntu0.1 Copyright (c) 2007-2022 the FFmpeg developers
  •   built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  •   configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  •   libavutil      56. 31.100 / 56. 31.100
  •   libavcodec     58. 54.100 / 58. 54.100
  •   libavformat    58. 29.100 / 58. 29.100
  •   libavdevice    58.  8.100 / 58.  8.100
  •   libavfilter     7. 57.100 /  7. 57.100
  •   libavresample   4.  0.  0 /  4.  0.  0
  •   libswscale      5.  5.100 /  5.  5.100
  •   libswresample   3.  5.100 /  3.  5.100
  •   libpostproc    55.  5.100 / 55.  5.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@IMX8-Tronlong:~#
  • 复制代码

    .下载开发库
    wget https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl-shared.tar.xz
  • sudo apt-get install xz-utils
  • xz -d ffmpeg-master-latest-linuxarm64-gpl-shared.tar.xz
  • tar -xvf ffmpeg-master-latest-linuxarm64-gpl-shared.tar
  • 复制代码
    .性能测试3.1PC机上
    下载测试文件
    wget https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4 --no-check-certificate
  • mv big_buck_bunny_720p_20mb.mp4 test.mp4
  •   ffmpeg -benchmark -i test.mp4 -f null -
  • 复制代码
    lhj@lhj:~$ 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: --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 '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:01:57.31, start: 0.000000, bitrate: 1436 kb/s
  •   Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1048 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= 2932 fps=1873 q=-0.0 Lsize=N/A time=00:01:57.29 bitrate=N/A speed=74.9x
  • video:1374kB audio:65988kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
  • bench: utime=9.655s stime=1.482s rtime=1.573s
  • bench: maxrss=95948kB
  • lhj@lhj:~$
  • 复制代码
    3.2开发板上
    下载测试文件
    wget https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4 --no-check-certificate
  • mv big_buck_bunny_720p_20mb.mp4 test.mp4
  • ffmpeg -benchmark -i test.mp4 -f null -
  • 复制代码
    root@IMX8-Tronlong:~# ffmpeg -benchmark -i test.mp4 -f null -
  • ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  •   built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  •   configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  •   libavutil      56. 31.100 / 56. 31.100
  •   libavcodec     58. 54.100 / 58. 54.100
  •   libavformat    58. 29.100 / 58. 29.100
  •   libavdevice    58.  8.100 / 58.  8.100
  •   libavfilter     7. 57.100 /  7. 57.100
  •   libavresample   4.  0.  0 /  4.  0.  0
  •   libswscale      5.  5.100 /  5.  5.100
  •   libswresample   3.  5.100 /  3.  5.100
  •   libpostproc    55.  5.100 / 55.  5.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:01:57.31, start: 0.000000, bitrate: 1436 kb/s
  •     Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1048 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
  •     Metadata:
  •       creation_time   : 1970-01-01T00:00:00.000000Z
  •       handler_name    : VideoHandler
  •     Stream #0:1(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
  • 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         : Lavf58.29.100
  •     Stream #0:0(und): Video: wrapped_avframe, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
  •     Metadata:
  •       creation_time   : 1970-01-01T00:00:00.000000Z
  •       handler_name    : VideoHandler
  •       encoder         : Lavc58.54.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
  •       encoder         : Lavc58.54.100 pcm_s16le
  • frame= 2932 fps=214 q=-0.0 Lsize=N/A time=00:01:57.31 bitrate=N/A speed=8.55x   
  • video:1535kB audio:65988kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
  • bench: utime=49.453s stime=1.131s rtime=13.728s
  • bench: maxrss=68924kB
  • root@IMX8-Tronlong:~#
  • 复制代码
    3.3对比
    PC上是fps=1873
    开发板上是fps=214
    大概是8.6倍数
    PC是固态硬盘,开发板是SD,
    PC12th Gen Intel(R) Core(TM) i5-12500H   2.50 GHz
    所以开发板的性能已经非常不错了。
    .编解码测试4.1编码测试4.1.1代码
    vi encode_video.c
    复制代码
    encode_video.c.txt (6.48 KB, 下载次数: 0)
    交流单片机MCU、处理器、ARM技术、DSP,以及嵌入式系统硬件与软件的平台
    • 帖子 5175
    • 回复 5696
    举报
    内容系网友发布,其中涉及到安全隐患的内容系网友个人行为,不代表面包板社区观点
    请点击举报理由
    关闭 站长推荐上一条 /3 下一条
    • 返回顶部