mazarei Posted February 6, 2017 Posted February 6, 2017 Hi everybody I'm using Orange PI One with OS Armbian Debian GNU/Linux 8 (jessie) 3.4.112-sun8i (Server) I need to convert some videos for make video stream(H264) but it works so slowy(3~10 fps) when I use ffmpeg. I think ffmpeg works slowly because it doesn't use HW Codec so how can I enable it in H3 CPU and use it in ffmpeg?
Magnets Posted February 6, 2017 Posted February 6, 2017 https://github.com/uboborov/ffmpeg_h264_H3 To give you some idea, I get ~24FPS encoding 1080p h264 into 1080p h264 using cedrus. I doubt you will get much improved performance because SW decode h265 will be very slow I think a raspberry pi is better for video because the openmax platform has more support and allows hw decode too. 1
tkaiser Posted February 6, 2017 Posted February 6, 2017 I think a raspberry pi is better for video because the openmax platform has more support and allows hw decode too. Pardon? RPi's outdated VideoCore IV does h.264 decoding HW accelerated but not h.265. While more recent Allwinner SoCs can do that at least with 8 bit (no 10 bit support): http://linux-sunxi.org/Cedrus#Supported_codec_matrix (you can add H5 here too -- progress with this SoC is mostly missing in linux-sunxi wiki yet) Instead of recommending those boring and outdated Raspberries it would help if people would start contributing support for better platforms. 1
Magnets Posted February 6, 2017 Posted February 6, 2017 Pardon? RPi's outdated VideoCore IV does h.264 decoding HW accelerated but not h.265. While more recent Allwinner SoCs can do that at least with 8 bit (no 10 bit support): http://linux-sunxi.org/Cedrus#Supported_codec_matrix (you can add H5 here too -- progress with this SoC is mostly missing in linux-sunxi wiki yet) Instead of recommending those boring and outdated Raspberries it would help if people would start contributing support for better platforms. You're right, I edited my post.
mazarei Posted February 7, 2017 Author Posted February 7, 2017 thank you for reply I got FFmpeg Cedrus from it's originally Source and added this patch (ffmpeg_h264_H3) and make configured it with below Command ./configure --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libx264 --enable-libmp3lame --enable-libpulse --enable-libv4l2 when it compiled and installed I got this version: $ ffmpeg -version ffmpeg version git-2015-01-22-f86a076 Copyright (c) 2000-2014 the FFmpeg developers built on Feb 7 2017 10:05:28 with gcc 4.9.2 (Debian 4.9.2-10) configuration: --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libx264 --enable-libmp3lame --enable-libpulse --enable-libv4l2 libavutil 54. 6.100 / 54. 6.100 libavcodec 56. 0.101 / 56. 0.101 libavformat 56. 2.100 / 56. 2.100 libavdevice 56. 0.100 / 56. 0.100 libavfilter 5. 0.102 / 5. 0.102 libswscale 3. 0.100 / 3. 0.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 0.100 / 53. 0.100 but when I try encode video I get this error: [cedrus264 @ 0x12a1760] VE Open error. agape@orangepione:~/ffmpegtest$ ffmpeg -i jellyfish-5-mbps-hd-h264.mkv -pix_fmt nv12 -c:v cedrus264 -f null /dev/null ffmpeg version git-2015-01-22-f86a076 Copyright (c) 2000-2014 the FFmpeg developers built on Feb 7 2017 10:05:28 with gcc 4.9.2 (Debian 4.9.2-10) configuration: --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libx264 --enable-libmp3lame --enable-libpulse --enable-libv4l2 libavutil 54. 6.100 / 54. 6.100 libavcodec 56. 0.101 / 56. 0.101 libavformat 56. 2.100 / 56. 2.100 libavdevice 56. 0.100 / 56. 0.100 libavfilter 5. 0.102 / 5. 0.102 libswscale 3. 0.100 / 3. 0.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 0.100 / 53. 0.100 Input #0, matroska,webm, from 'jellyfish-5-mbps-hd-h264.mkv': Metadata: encoder : libebml v1.2.0 + libmatroska v1.1.0 creation_time : 2016-02-06 04:00:51 Duration: 00:00:30.03, start: 0.000000, bitrate: 4976 kb/s Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default) [cedrus264 @ 0x12a1760] VE Open error. Output #0, null, to '/dev/null': Metadata: encoder : libebml v1.2.0 + libmatroska v1.1.0 Stream #0:0(eng): Video: h264, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 29.97 fps (default) Metadata: encoder : Lavc56.0.101 cedrus264 Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (cedrus264)) Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height 1
Magnets Posted February 7, 2017 Posted February 7, 2017 You need to run it as root. Not sure if there's a better way around it though 1
senia Posted February 10, 2017 Posted February 10, 2017 Hello everybody! I use NanoPi Neo Air with Allwinner H3 I've installed cedrus264 encoder and tried to use it for webcam streaming with ffmpeg. I used htop to control cpu load and found, that ffmpeg uses too much memory! Is it normal for hardware encoding? oron@nanopiair:~/FFmpeg-Cedrus-master$ sudo ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -pix_fmt nv12 -r 25 -c:v cedrus264 -f mpegts udp://192.168.10.236:1234 ffmpeg version 2.3.git Copyright (c) 2000-2014 the FFmpeg developers built on Feb 9 2017 11:10:38 with gcc 5.4.0 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 20160609 configuration: --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libx264 --enable-libmp3lame --enable-libpulse --enable-libv4l2 libavutil 54. 6.100 / 54. 6.100 libavcodec 56. 0.101 / 56. 0.101 libavformat 56. 2.100 / 56. 2.100 libavdevice 56. 0.100 / 56. 0.100 libavfilter 5. 0.102 / 5. 0.102 libswscale 3. 0.100 / 3. 0.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 0.100 / 53. 0.100 Input #0, video4linux2,v4l2, from '/dev/video0': Duration: N/A, start: 7107.486161, bitrate: 147456 kb/s Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc [VDPAU SUNXI] VE version 0x1680 opened. Output #0, mpegts, to 'udp://192.168.10.236:1234': Metadata: encoder : Lavf56.2.100 Stream #0:0: Video: h264 (cedrus264), nv12, 640x480, q=2-31, 200 kb/s, 25 fps, 90k tbn, 25 tbc Metadata: encoder : Lavc56.0.101 cedrus264 Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (cedrus264)) Press [q] to stop, [?] for help frame= 5698 fps= 25 q=30.0 Lsize= 46445kB time=00:03:47.92 bitrate=1669.3kbits/s dup=5 drop=123 Htop results:
azamat Posted June 9, 2017 Posted June 9, 2017 Hi everybody I encoded stream to h264 with success, but I have troubles with streaming it using ffserver. I'm using orange pi zero with Debian GNU/Linux 8 (jessie) 3.4.113-sun8i. Any suggestions?
Recommended Posts