前面进行了ffmpeg的开发环境搭建以及性能测试,现在就可以进行具体的应用开发了。
这一篇就以一个网络视频播放的Demo来演示基于米尔MYD-YG2LX开发板快捷高效的多媒体应用开发。
过程
这里下载的是big_buck_bunny_720p_10mb.mp4。
导入视频文件到开发板的~目录下。
设置开发板和PC的IP地址在同一网段
我这里电脑是192.168.137.1,所以设置开发板为192.168.137.2
ifconfig eth0 192.168.37.2
root@myir-yg2lx:/usr/lib# ifconfig eth0eth0: flags=-28605 mtu 1500 metric 1 inet 192.168.137.2 netmask 255.255.255.0 broadcast 192.168.137.255 inet6 fe80:54ff8ed4 prefixlen 64 scopeid 0x20 ether 0e:a957d4 txqueuelen 1000 (Ethernet) RX packets 345675 bytes 422385328 (402.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 151051 bytes 11916402 (11.3 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 184
确认开发板和PC网口通讯OK。
从如下地址下载安装VLC
https://www.videolan.org/vlc/
ffmpeg -re -i big_buck_bunny_720p_10mb.mp4 -an -vcodec copy -f rtp rtp://192.168.137.1:5004
打印如下
root@myir-yg2lx:~# ffmpeg -re -i big_buck_bunny_720p_10mb.mp4 -an -vcodec copy -f rtp rtp://192.168.137.1:5004ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.3.0 (GCC) configuration: --disable-stripping --enable-pic --enable-shared --enable-pthreads --cross-prefix=aarch64-poky-linux- --ld='aarch64-poky-linux-gcc -mtune=cortex-a55 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/recipe-sysroot' --cc='aarch64-poky-linux-gcc -mtune=cortex-a55 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/recipe-sysroot' --cxx='aarch64-poky-linux-g++ -mtune=cortex-a55 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/recipe-sysroot' --arch=aarch64 --target-os=linux --enable-cross-compile --extra-cflags=' -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map==/usr/src/debug/ffmpeg/4.2.2-r0 -fdebug-prefix-map==/usr/src/debug/ffmpeg/4.2.2-r0 -fdebug-prefix-map=/recipe-sysroot= -fdebug-prefix-map=/recipe-sysroot-native= -mtune=cortex-a55 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/recipe-sysroot' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now' --sysroot=/recipe-sysroot --libdir=/usr/lib64 --shlibdir=/usr/lib64 --datadir=/usr/share/ffmpeg --disable-mipsdsp --disable-mipsdspr2 --cpu=generic --pkg-config=pkg-config --disable-static --enable-alsa --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-bzlib --disable-libfdk-aac --enable-gpl --disable-libgsm --disable-indev=jack --disable-libvorbis --enable-lzma --disable-libmfx --disable-libmp3lame --disable-openssl --enable-postproc --disable-sdl2 --disable-libspeex --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi --disable-vdpau --disable-libvpx --enable-libx264 --disable-libx265 --disable-libxcb --disable-outdev=xv --enable-zlib 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 'big_buck_bunny_720p_10mb.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01T0000.000000Z encoder : Lavf53.24.2Duration: 0002.32, start: 0.000000, bitrate: 1347 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 959 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default) Metadata: creation_time : 1970-01-01T0000.000000Z handler_name : VideoHandler Stream #0 Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default) Metadata: creation_time : 1970-01-01T0000.000000Z handler_name : SoundHandlerOutput #0, rtp, to 'rtp://192.168.137.1:5004': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.29.100Stream #0 Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 959 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc (default) Metadata: creation_time : 1970-01-01T0000.000000Z handler_name : VideoHandlerSDP:v=0o=- 0 0 IN IP4 127.0.0.1s=No Namec=IN IP4 192.168.137.1t=0 0a=tool:libavformat 58.29.100m=video 5004 RTP/AVP 96b=AS:959a=rtpmap:96 H264/90000a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z01AH9oBQBbsBEAAAAMAQAAADIPGDKg=,aO88gA==; profile-level-id=4D401FStream mapping: Stream #0:0 -> #0:0 (copy)Press [q] to stop, [?] for helpframe= 1068 fps= 25 q=-1.0 Lsize= 5315kB time=0042.68 bitrate=1020.2kbits/s speed= 1x video:5262kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.001308%
复制如下部分
在PC端新建demo.sdp文件,粘贴上述内容
然后使右键点击该sdp文件用VLC打开。
看到开始播放
固定帧率25帧
frame=496 fps=25 q=-1.0 size=2187kB time=0019.80 bitrate= 905.0kbits/s speed=1x
总结
以上可以看到,得益于开发板优异的性能和完备的运行环境,开发多媒体应用非常便捷快速。所以基于本板进行二次开发是非常不错的选择。
全部0条评论
快来发表一下你的评论吧 !