nanoPi Duo2 use of h.264 encoding
Posted: Thu Jan 03, 2019 5:27 pm
I have connected the "NanoPi Duo2" with the Camera "OV5640" and try to stream a video over the network or simply create a video-file for testing.
(The OV5640 is the matching 5MP Camera Module for the NanoPi Duo2.)
In the Wiki I got the information to use the Linux-3.4 image to have the ability for hardware-encoding.
So I use the "nanopi-duo2_sd_friendlycore-xenial_3.4_armhf_20181218.img" Rom.
From the Wiki:
"If you use a H3 boards with Linux-3.4 based ROM you can use the ffmpeg utility to hardware-encode stream data and this can greatly release CPU's resources and speed up encoding: "
Then I have tried the command:
ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 \
-b:v 64k -c:v cedrus264 test.mp4
But this do not work, I get an error message.
I have try it without hardware acceleration, removed the "-c:v cedrus264" in the string and then I get an mpeg2 software-encoded stream with high CPU-Load and a low framerate or I use only a 640x480 Image.
Why does the example from the Wiki does not work?
(The OV5640 is the matching 5MP Camera Module for the NanoPi Duo2.)
In the Wiki I got the information to use the Linux-3.4 image to have the ability for hardware-encoding.
So I use the "nanopi-duo2_sd_friendlycore-xenial_3.4_armhf_20181218.img" Rom.
From the Wiki:
"If you use a H3 boards with Linux-3.4 based ROM you can use the ffmpeg utility to hardware-encode stream data and this can greatly release CPU's resources and speed up encoding: "
Then I have tried the command:
ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 \
-b:v 64k -c:v cedrus264 test.mp4
But this do not work, I get an error message.
pi@NanoPi-Duo2:~$ ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 -b:v 64k -c:v cedrus264 test.mp4
ffmpeg version 2.3.git Copyright (c) 2000-2014 the FFmpeg developers
built on Sep 6 2016 11:47:46 with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
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: 1455213710.221003, bitrate: 331776 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, 331776 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
[cedrus264 @ 0xf5a560] VE Open error.
Output #0, mp4, to 'test.mp4':
Stream #0:0: Video: h264, q=2-31, 128 kb/s, 30 fps
Metadata:
encoder : Lavc56.0.101 cedrus264
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (cedrus264))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
I have try it without hardware acceleration, removed the "-c:v cedrus264" in the string and then I get an mpeg2 software-encoded stream with high CPU-Load and a low framerate or I use only a 640x480 Image.

Why does the example from the Wiki does not work?