Preface
We have built the development environment and performed performance testing for ffmpeg. Now we can start developing specific applications.
This article uses a network video playback demo to demonstrate the fast and efficient multimedia application development based on the Mir MYD-YG2LX development board.
process
https://www.sample-videos.com/index.php#sample-mp4-videoDownload the test mp4 video
The download here is big_buck_bunny_720p_10mb.mp4.
Import the video file into the ~ directory of the development board.
Set the IP address of the development board and PC to the same network segment
My computer is at 192.168.137.1, so I set the development board to 192.168.137.2
ifconfig eth0 192.168.37.2
root@myir-yg2lx:/usr/lib# ifconfig eth0
eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC> mtu 1500 metric 1
inet 192.168.137.2 netmask 255.255.255.0 broadcast 192.168.137.255
inet6 fe80::ca9:54ff:fe57:8ed4 prefixlen 64 scopeid 0x20<link>
ether 0e:a9:54:57:8e:d4 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
Confirm that the development board and PC network port communicate OK.
Download and install VLC from the following address
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
Print as follows
root@myir-yg2lx:~# ffmpeg -re -i big_buck_bunny_720p_10mb.mp4 -an -vcodec copy -f rtp rtp://192.168.137.1:5004
ffmpeg 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-01T00:00:00.000000Z
encoder: Lavf53.24.2
Duration: 00:01:02.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-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
Output #0, rtp, to 'rtp://192.168.137.1:5004':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder: Lavf58.29.100
Stream #0:0(und): 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-01T00:00:00.000000Z
handler_name : VideoHandler
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 192.168.137.1
t = 0 0
a=tool:libavformat 58.29.100
m=video 5004 RTP/AVP 96
b=AS:959
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= 1068 fps= 25 q=-1.0 Lsize= 5315kB time=00:00:42.68 bitrate=1020.2kbits/s speed= 1x
video:5262kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.001308%
Copy the following part
Create a new demo.sdp file on the PC and paste the above content
Then right click on the sdp file and open it with VLC.
See start playing
Fixed frame rate 25 fps
frame= 496 fps= 25 q=-1.0 size= 2187kB time=00:00:19.80 bitrate= 905.0kbits/s speed= 1x
Summarize
As can be seen above, thanks to the excellent performance and complete operating environment of the development board, the development of multimedia applications is very fast. Therefore, this board is a very good choice for secondary development.