Jump to content

Recommended Posts

Posted

I was not aware of that option. My bad.

I only had to left out --enable-libopencv because even if installed it cannot be seen. Don't know why.

Anyway, after ffmpeg and mpv rebuilt anything changed.

> ffmpeg
ffmpeg version n4.0.4-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-v4l2-request --enable-libudev
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

The reason is here:

[vd] Trying hardware decoding via h264_v4l2m2m-v4l2m2m-copy.
[vd] Using underlying hw-decoder 'h264_v4l2m2m'
[ffmpeg] h264_v4l2m2m: Could not find a valid device
[ffmpeg] h264_v4l2m2m: can't configure decoder
[vd] Could not open codec.
[vd] Falling back to software decoding.

Please check the attached log for details

 

mpv_log_201909251312Fetching info...

Posted

I'm not sure what to say, most likely your installation of customized ffmpeg didn't replace all ffmpeg libraries installed from repository (likely, because mpv doesn't complain about wrong version). This procedure worked well for me with ALARM rootfs.

Posted

After a fresh new complete rebuild and reinstall following a clean procedure I got the same troubles.

Giving up for now until I get some grip on the issue. Currently it's just a black box for me.

@jernej Thank you for all your support and patience.

 

Posted

I've got ffmpeg working with v4l2_request api on Allwinner H3 (orange pi pc).

It achieved in a few steps:

1. Download FFmpeg https://github.com/xbmc/FFmpeg/archive/4.0.4-Leia-18.4.tar.gz

2. Patch it with https://github.com/LibreELEC/LibreELEC.tv/tree/master/packages/multimedia/ffmpeg/patches

3. Download mainline kernel 5.3.5

4. Patch it with https://github.com/LibreELEC/LibreELEC.tv/tree/master/projects/Allwinner/patches/linux

5. Copy linux headers on rootfs /usr/include after kernel built:

make headers_install ARCH=arm INSTALL_HDR_PATH=/your/path/to/headers

6. Install libdrm-dev and libudev-dev before configuring FFmpeg

7. Configure FFmpeg with:

/configure --enable-v4l2-request --enable-libudev --enable-libdrm --enable-shared --disable-static \
--disable-openssl --disable-gray --disable-vaapi --disable-vdpau --disable-rkmpp

8. Build FFmpeg on the target machine (orange pi pc in my case)

That's it )

 

ffmpeg -re -hwaccel drm -i Big_Buck_Bunny_720_10s_2MB.mp4 out.avi

FFmpeg perfectly uses HW acceleration on decoding H264.

Posted

That sounds really interesting, I have to give it a go with one of my OrangePi One.

On the download page, I see that the 5.3 kernel is not available for this board. May I hope to start with a 4.19 server version, download the 5.3 kernel sources, and start from that?
Thanks!

Posted
  On 11/18/2019 at 1:51 PM, gounthar said:

5.3 kernel is not available for this board

Expand  

linux-5.3.5 mainline kernel is actually no matter the board it is going to run on. Your OrangePi One has H3 onboard and the kernel has the device tree for your board (sun8i-h3-orangepi-one.dts). I don't really see any problem to try it out.

Posted
  On 11/18/2019 at 1:51 PM, gounthar said:

OrangePi One.

On the download page, I see that the 5.3 kernel is not available for this board

Expand  

 

It's actually listed on the page (the Buster minimal variant):

image.png.5da9273851fc9b80823e3816831ffdcd.png

 

The red X means it's not supported, but it's available.

Posted

I figured out how to compile the mentioned version of ffmpeg, but without the patches for the time being, because I have yet to understand which ones are useful.

 ffmpeg
ffmpeg version 4.0.4-Kodi Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)
  configuration: --pkg-config-flags=--static --prefix=/home/poddingue/bin --extra-cflags=-I/home/poddingue/bin/include --extra-ldflags=-L/home/poddingue/bin/lib --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --bindir=/home/poddingue/bin --enable-debug=3 --enable-vaapi --enable-libvorbis --enable-libvpx --disable-debug --enable-gpl --cpu=native --enable-opengl --enable-libfdk-aac --enable-libx264 --enable-libx265 --extra-libs=-lpthread --enable-nonfree --arch=arm
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

The board is running

Linux captation-techforum-zero-1 5.3.9-sunxi #19.11.3 SMP Mon Nov 18 18:49:43 CET 2019 armv7l armv7l armv7l GNU/Linux

So there is hope that one day I manage to compile everything correctly and get hardware acceleration for encoding h.264.

Posted
  On 11/22/2019 at 4:38 PM, gounthar said:

and get hardware acceleration for encoding h.264

Expand  

You won't get hardware acceleration for encoding h264 because v4l2_request api available for decoding only.

If you want to get hardware acceleration for encoding you should:

1. download mainline linux-4.20.17

2. clone repo https://github.com/uboborov/sunxi-cedar-mainline

3. replace or modify device tree files from folder 4.20.17 of the repo (add CMA node and VE node) in the kernel folder

4. build the kernel following instructions from 4.20.17 folder

5. build the cedrus driver from the stage 2

6. clone repo https://github.com/uboborov/ffmpeg_h264_H3 and follow the instructions in the readme file to build ffmpeg with hw h264 support or

7. clone repo https://github.com/uboborov/cedrus to build standalone h264 encoder and use it somehow like:

insmod sunxi_cedar.ko
ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -pix_fmt nv12 -r 25 -f rawvideo pipe: | ./h264enc - 640 480 test.h264

 

Posted

it's working method for boards based on h2+ and h3, even for a20.

at least i built and tested it on pi zero, pi pc, cubieboard2.

the latest modifications of the cedrus driver were made on the last week.

 

Posted
  On 11/24/2019 at 7:42 PM, ubobrov said:

If you want to get hardware acceleration for encoding you should:

1. download mainline linux-4.20.17

2. clone repo https://github.com/uboborov/sunxi-cedar-mainline

3. replace or modify device tree files from folder 4.20.17 of the repo (add CMA node and VE node) in the kernel folder

4. build the kernel following instructions from 4.20.17 folder

5. build the cedrus driver from the stage 2

 

Expand  

So, I've built the kernel and you repo on the Zero, because I don't have an Armbian build machine anymore.
Should I go the old x86 way of installing the kernel, like

make modules_install && make install

I guess it's way more subtle on an ARM SBC. :wacko:

Posted
  Reveal hidden contents

Regarding the ffmpeg build, I must have missed something, because this is what I got with gcc 8.3.0.

Posted
  On 11/25/2019 at 2:54 PM, gounthar said:

So, I've built the kernel and you repo on the Zero, because I don't have an Armbian build machine anymore.
Should I go the old x86 way of installing the kernel, like

make modules_install && make install

I guess it's way more subtle on an ARM SBC. :wacko:

Expand  

i build ffmpeg and libvdpau-sunxi on the target device.

kernel and other tools i build on the host machine.

i build kernel without modules.

all drivers are builtin

for my tests i use the armbian image on the SD card. i simply copy the kernel (zImage), device tree blob (dtb) and customized boot script (boot.scr) to the /boot folder on the SD and reboot the board

boot script (script.cmd) looks like that:

setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rootwait panic=10
load mmc 0:1 0x43000000 /boot/sun8i-h2-plus-orangepi-zero-4.20.17.dtb
load mmc 0:1 0x42000000 /boot/zImage-4.20.17
bootz 0x42000000 - 0x43000000

 

Posted
  On 11/25/2019 at 3:57 PM, gounthar said:
  Reveal hidden contents

Regarding the ffmpeg build, I must have missed something, because this is what I got with gcc 8.3.0.

Expand  

perhaps you have lost some steps on building ffmpeg or done something wrong.

on the target device:

git clone https://github.com/stulluk/FFmpeg-Cedrus.git
git clone https://github.com/uboborov/ffmpeg_h264_H3.git
cp /root/ffmpeg_h264_H3/cedrus264.c /root/FFmpeg-Cedrus/libavcodec/cedrus264.c
cp -R /root/ffmpeg_h264_H3/sunxi /root/FFmpeg-Cedrus/libavcodec/arm
apt-get install libpulse-dev libv4l-dev libmp3lame-dev libx264-dev

cd FFmpeg-Cedrus

./configure --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libx264 --enable-libmp3lame --enable-libpulse --enable-libv4l2 

make -j 4
make install

 

Posted

Thanks a lot. I am currently testing on another machine with an earlier version of gcc (7.x). Here is the list of commands I used:

sudo apt-get install -y build-essential libncurses-dev bison flex libssl-dev libelf-devx libmp3lame-dev libpulse-dev libv4l-dev libx264-dev libasound2-dev
git clone https://github.com/uboborov/ffmpeg_h264_H3.git
git clone https://github.com/stulluk/FFmpeg-Cedrus.git
cp ffmpeg_h264_H3/cedrus264.c FFmpeg-Cedrus/libavcodec/cedrus264.c
cp -vraxu ffmpeg_h264_H3/sunxi/ FFmpeg-Cedrus/libavcodec/arm/
cd FFmpeg-Cedrus/
./configure --prefix=/usr --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libx264 --enable-libmp3lame --enable-libpulse --enable-libv4l2
make -j2

I got the same error with the older version of gcc:

  Reveal hidden contents

 

Posted

i have never bump into building error of the ffmpeg on armbian+orange pi pc or pi zero.

as far as i heard some errors could appear because of memory lack on the building host.

i recommend you to try configure ffmpeg with

--disable-static --enable-shared 

options to reduce memory usage during linkage.

Posted
  On 11/26/2019 at 7:37 AM, visitoid said:

Which OS version should I use Ubuntu or Debian? What kernel? I just want to watch a movie? The steps are the same?

Expand  

i don't know what you should use. i can only tell you what i use. everything except ffmpeg and libvdpau-sunxi i build on

Linux  4.15.0-70-generic #79~16.04.1-Ubuntu SMP Tue Nov 12 14:01:10 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.7-2013.04-20130415 - Linaro GCC 2013.04) 4.7.3 20130328 (prerelease) 4.3.3

ffmpeg and libvdpau-sunxi i build on the target device (orange pi zero or pc in my case)
 

Linux gateway 4.20.17 #3 SMP Tue Nov 12 17:19:54 MSK 2019 armv7l GNU/Linux
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
BOARD=orangepizero
BOARD_NAME="Orange Pi Zero"
BOARDFAMILY=sun8i
BUILD_REPOSITORY_URL=https://github.com/armbian/rkbin
BUILD_REPOSITORY_COMMIT=51d55a4
VERSION=5.90
LINUXFAMILY=sunxi
BRANCH=next
ARCH=arm
IMAGE_TYPE=stable
BOARD_TYPE=conf
INITRD_ARCH=arm
KERNEL_IMAGE_TYPE=zImage

if you want to watch a movie on your target board you have to build more tools than just ffmpeg. i don't know what exactly tools you do need.

Posted

Here the step-by-step instruction how to build and test the encoder from scratch on Orange PI zero board

it has been written and tested today.

  Reveal hidden contents

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines