Jump to content

Compile FFmpeg aml for S905w


martos

Recommended Posts

32 minutes ago, martos said:

I have a S09W 1G , so i need a gxl_p281_1g.dtb  to meson-glxp281_1g.dtb ? ( no find in the new img Armbian_5.44_S9xxx_Ubuntu_bionic_4.18.0-rc5_server_20180719.img.xz )

Wait awhile. Recently I was sent a test sample with S905w (x96), soon I plan to create and check dtb file for s905w.

Link to comment
Share on other sites

I post the howto compile but don't ffmpeg aml don"t with with this version

 

mkdir -p ~/ffmpeg_sources ~/bin

sudo apt-get update -qq && sudo apt-get -y install \
  autoconf \
  automake \
  build-essential \
  cmake \
  git-core \
  libass-dev \
  libfreetype6-dev \
  libsdl2-dev \
  libtool \
  libva-dev \
  libvdpau-dev \
  libvorbis-dev \
  libxcb1-dev \
  libxcb-shm0-dev \
  libxcb-xfixes0-dev \
  pkg-config \
  texinfo \
  wget \
  zlib1g-dev

sudo apt-get -y install \
  libsdl2-dev \
  libva-dev \
  libvdpau-dev \
  libxcb1-dev \
  libxcb-shm0-dev \
  libxcb-xfixes0-dev


apt-get install libsdl1.2-dev

apt install locate


cd ~/ffmpeg_sources && \
wget https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.bz2 && \
tar xjvf nasm-2.13.03.tar.bz2 && \
cd nasm-2.13.03 && \
./autogen.sh && \
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
make -j5 && \
make install

sudo apt-get install yasm
sudo apt-get install libx264-dev
sudo apt-get install libx265-dev libnuma-dev
sudo apt-get install libfdk-aac-dev
sudo apt-get install libmp3lame-dev
sudo apt-get install libopus-dev


In your pc ( my is a windows)

https://yadi.sk/d/pHxaRAs-tZiei/5.41/deb

download aml-amremote, aml-codec aml-mali


pscp aml-amremote-905_5.41_arm64.deb root@192.168.1.200:aml-remote.deb
pscp aml-codec_5.41_arm64.deb root@192.168.1.200:aml-codec.deb
pscp aml-mali6_5.41_arm64.deb root@192.168.1.200:aml-mali6.deb

 

come back on your box tv :

cd /root/
dpkg -i aml-remote.deb
dpkg -i aml-mali6.deb
dpkg -i aml-codec.deb

cd ~/ffmpeg_sources

git clone https://github.com/roman-rybalko/FFmpeg-aml


mc -e /root/ffmpeg_sources/FFmpeg-aml/libavcodec/amltools.h

#include "/usr/include/amports/vformat.h"


cd ~/ffmpeg_sources/FFmpeg-aml


PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
  --prefix="$HOME/ffmpeg_build" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --extra-libs="-lpthread -lm" \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libass \
  --enable-libfdk-aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-ffplay \
  --enable-aml \
  --enable-decoder=h264_aml \
  --enable-decoder=hevc_aml \
  --enable-decoder=mpeg2_aml \
  --enable-decoder=mpeg4_aml \
  --enable-decoder=mpeg4v1_aml \
  --enable-decoder=mpeg4v2_aml \
  --enable-decoder=mpeg4v3_aml \
  --enable-decoder=vc1_aml \
  --enable-libx264 \
  --enable-libx265 \
  --enable-nonfree && \
PATH="$HOME/bin:$PATH" make -j3 && \
make install && \
hash -r

 

 

Link to comment
Share on other sites

The reason is not dtb. To build FFMPEG for kernel 4.18 (using v4l-m2m), you need to use the sources and patches of FFMPEG that are part of the Libreelec build.

 

Mali7 packages are not needed, they are only for kernel 3.14

Link to comment
Share on other sites

yes i but i need to boot on kernel 4.18 and at this moment i can only boot in 3.14.29 ,

when i try Armbian_5.44_S9xxx_Ubuntu_bionic_4.18.0-rc5_server_20180719.img.xz the box don't start. ( i suppose dtb of S905W not present )

Link to comment
Share on other sites

1 hour ago, martos said:

yes i but i need to boot on kernel 4.18 and at this moment i can only boot in 3.14.29 ,

when i try Armbian_5.44_S9xxx_Ubuntu_bionic_4.18.0-rc5_server_20180719.img.xz the box don't start. ( i suppose dtb of S905W not present )

What model of TV box do you have ?

Link to comment
Share on other sites

I was sent this model 2\16 for tests. I have on this model, the image (from the kernel-4.18 directory), works with the dtb file for Khadas VIM1 (test video works with sound). But there is a nuance to run versions with DE Mate\Xfce. After the initial setup, when the system automatically reboots, wait at least 5-7 minutes, at this time the screen will be black, then use the combination Ctrl+Alt+F1 to switch to the first (text) console, and then switch back to the graphical console Ctrl+Alt+F7 and wait 2-3 minutes. After such manipulation should earn DE. Write me in PM your email address, I will send you a link to the image LE kernel 4.18, which is already partially working ffmpeg with HW via v4l-m2m. This image works for me on X96mini as well. It is possible to take the files you need to port to Armbian.

Link to comment
Share on other sites

2 hours ago, balbes150 said:

I was sent this model 2\16 for tests. I have on this model, the image (from the kernel-4.18 directory), works with the dtb file for Khadas VIM1 (test video works with sound). But there is a nuance to run versions with DE Mate\Xfce. After the initial setup, when the system automatically reboots, wait at least 5-7 minutes, at this time the screen will be black, then use the combination Ctrl+Alt+F1 to switch to the first (text) console, and then switch back to the graphical console Ctrl+Alt+F7 and wait 2-3 minutes. After such manipulation should earn DE. Write me in PM your email address, I will send you a link to the image LE kernel 4.18, which is already partially working ffmpeg with HW via v4l-m2m. This image works for me on X96mini as well. It is possible to take the files you need to port to Armbian.

than you @balbes150  

 

plz send me link downlaod  LE with kernel 4.18

 

i need test with wetek play 2 

 

my email     belaidboukhezna@gmail.com

Link to comment
Share on other sites

27 minutes ago, belaid38 said:

plz send me link downlaod  LE with kernel 4.18

 

i need test with wetek play 2 

 

my email     belaidboukhezna@gmail.com

If I'm not confused, does the WP2 use the s905 chip ? For this chip images LE with the kernel 4 collects Chewitt and other developers in the community LE (I have no model WP2 for test build) .

Link to comment
Share on other sites

 

and i am going to test with your explain

i send you mp with my email for the img included ffmpeg with v4l2m2m aml

 

Nothing with this img, but i use ffmpeg with ffmpeg v4l2m2m for my Odroid  Xu4 :

h264_v4l2m2m @ 0x54f910] driver 's5p-mfc' on card 's5p-mfc-enc'
[h264_v4l2m2m @ 0x54f910] driver 's5p-mfc' on card 's5p-mfc-dec'
[h264_v4l2m2m @ 0x54f910] Using device /dev/video10

 

mfc :

https://www.kernel.org/doc/Documentation/devicetree/bindings/media/s5p-mfc.txt

 

I think it's the same use but with another 'drivers' ...

 

Link to comment
Share on other sites

On 7/27/2018 at 12:26 PM, balbes150 said:

If I'm not confused, does the WP2 use the s905 chip ? For this chip images LE with the kernel 4 collects Chewitt and other developers in the community LE (I have no model WP2 for test build) .

wp2 is s905

Link to comment
Share on other sites

so with : Armbian_5.44_S9xxx_Ubuntu_bionic_4.18.0-rc5_server_20180727.img.xz

dtb.img with p281 dtb

 

OK to compile i add some time -j4 and some time -j3

because the swap don't work and the system freeze -j3 use less memory ( ihave only 1GB )

if you have a trouble (freeze) to compile something :

in th rep of the compil
mc -e C.sh
put the compil
chmod 755 C.sh
in console (not ssh, not in telnet ) lanch
./C.sh &

 

i add "--enable-hardcoded-table" to have some cpu gain

 

i don't put x265 (i must have an eyes on the errors after if you want it , add --enable-libx265 at the ffmpeg compile at the end )

 

sudo apt-get update -qq && sudo apt-get -y install \
  autoconf \
  automake \
  build-essential \
  cmake \
  git-core \
  libass-dev \
  libfreetype6-dev \
  libsdl2-dev \
  libtool \
  libva-dev \
  libvdpau-dev \
  libvorbis-dev \
  libxcb1-dev \
  libxcb-shm0-dev \
  libxcb-xfixes0-dev \
  pkg-config \
  texinfo \
  wget \
  zlib1g-dev

 

mkdir -p ~/ffmpeg_sources ~/bin

 

cd ~/ffmpeg_sources && \
wget https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.bz2 && \
tar xjvf nasm-2.13.03.tar.bz2 && \
cd nasm-2.13.03 && \
./autogen.sh && \
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
make -j4 && \
make install

apt-get install mc
apt-get install locate

 

cd ~/ffmpeg_sources && \
wget -O yasm-1.3.0.tar.gz https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
tar xzvf yasm-1.3.0.tar.gz && \
cd yasm-1.3.0 && \
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
make -j4 && \
make install

 

cd ~/ffmpeg_sources && \
git -C x264 pull 2> /dev/null || git clone --depth 1 https://git.videolan.org/git/x264 && \
cd x264 && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --enable-pic && \
PATH="$HOME/bin:$PATH" make -j4 && \
make install

 

sudo apt-get install libx265-dev libnuma-dev

 

cd ~/ffmpeg_sources && \
git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
cd libvpx && \
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && \
PATH="$HOME/bin:$PATH" make -j4 && \
make install

 

 

cd ~/ffmpeg_sources && \
git -C fdk-aac pull 2> /dev/null || git clone --depth 1 https://github.com/mstorsjo/fdk-aac && \
cd fdk-aac && \
autoreconf -fiv && \
./configure --prefix="$HOME/ffmpeg_build" --disable-shared && \
make -j4 && \
make install

 

cd ~/ffmpeg_sources && \
wget -O lame-3.100.tar.gz https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz && \
tar xzvf lame-3.100.tar.gz && \
cd lame-3.100 && \
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm && \
PATH="$HOME/bin:$PATH" make -j4 && \
make install

 

sudo apt-get install libopus-dev

 

cd ~/ffmpeg_sources && \
git -C aom pull 2> /dev/null || git clone --depth 1 https://aomedia.googlesource.com/aom && \
mkdir aom_build && \
cd aom_build && \
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off -DENABLE_NASM=on ../aom && \
PATH="$HOME/bin:$PATH" make -j2 && \
make install


cd ~/ffmpeg_sources && \
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
tar xjvf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--bindir="$HOME/bin" \
--enable-hardcoded-tables \
--enable-v4l2_m2m \
--enable-gpl \
--enable-libaom \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--disable-libaom \
--enable-nonfree && \
PATH="$HOME/bin:$PATH" make -j3 && \
make install && \
hash -r

 

i am waitind the end of the ffmpeg compile ...

(  all compile take one hour )

Link to comment
Share on other sites

for the moment when i try :

ffmpeg -vcodec h264_v4l2m2m -i http://192.168.1.50:8001/+1:0:19:401:4:20FA:EEEE0000:0:0:0: -s 320x240 /tmp/test.mp4

i have :

[h264_v4l2m2m @ 0xaaaaf7fa4c30] Could not find a valid device
[h264_v4l2m2m @ 0xaaaaf7fa4c30] can't configure decoder

 

I have check for what v4l2m2m don't find aml device and i come back

Link to comment
Share on other sites

Same error with other compile

[h264_v4l2m2m @ 0xaaab1c00f9d0] Could not find a valid device
[h264_v4l2m2m @ 0xaaab1c00f9d0] can't configure decoder
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_v4l2m2m) -> h264 (libx264))
  Stream #0:1 -> #0:1 (eac3 (native) -> aac (native))
Error while opening decoder for input stream #0:0 : Invalid argument
[AVIOContext @ 0xaaab1c02d110] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0xaaab1bff4b60] Statistics: 3277048 bytes read, 0 seeks

 

How i can check if the kernel have the good change ?

Link to comment
Share on other sites

ok i try libreelec 9.XX but no ffmpeg included.

i try to ibstall but i have message :

os.libreelec.tv Unavailable

i continue the install and restart

i try again

[h264_v4l2m2m @ 0x1d65760] Could not find a valid device
[h264_v4l2m2m @ 0x1d65760] can't configure decoder
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_v4l2m2m) -> mpeg4 (native))
  Stream #0:1 -> #0:1 (eac3 (native) -> aac (native))
Error while opening decoder for input stream #0:0 : Invalid argument

 

So librelec don't use the v4l2m2m aml drivers too ...

 

i put the ffmpeg of libreelec option ( very optimized !)

ffmpeg version 1.0.1-20993-g4140b80 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.1.0 (GCC)
  configuration: --enable-ffmpeg --disable-ffplay --enable-ffprobe --enable-static --disable-shared --enable-gpl --enable-nonfree --disable-doc --enable-avresample --disable-lzma --disable-alsa --arch=arm --cpu=cortex-a53 --cross-prefix=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi- --enable-cross-compile --sysroot=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/armv8a-libreelec-linux-gnueabi/sysroot --sysinclude=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/armv8a-libreelec-linux-gnueabi/sysroot/usr/include --target-os=linux --nm=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi-nm --ar=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi-ar --as=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc --cc=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc --ld=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc --pkg-config=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/pkg-config --host-cc=/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/bin/host-gcc --host-cflags='-O2 -Wall -pipe -I/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/include -Wno-format-security' --host-ldflags='-Wl,-rpath,/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/lib -L/home/chewitt/LibreELEC.amlgx/build.LibreELEC-Odroid_C2.arm-9.0-devel/toolchain/lib' --host-extralibs=-lm --extra-cflags='-march=armv8-a+crc -mtune=cortex-a53 -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -fomit-frame-pointer -Wall -pipe -Os ' --extra-ldflags='-march=armv8-a+crc -mtune=cortex-a53 -Wl,--as-needed' --extra-libs= --enable-pic --enable-openssl --enable-hardcoded-tables

kernel :

Linux version 4.18.0-rc5 (user@user-VirtualBox) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05)) #1 SMP PREEMPT Wed Jul 25 10:34:48 MSK 2018
 

Link to comment
Share on other sites

little chat with some vip :

https://irclog.whitequark.org/linux-amlogic/2018-04-03

 

so kernel need

V4L2 Video Support

         Amlogic v4l video device support = M

         Amlogic v4l video2 device support = yes

 

but is not enough ...

 

look for more info ...

 

the main source is here :

 

https://github.com/Elyotna/linux

Hacking in a V4L2 M2M decoder for AMLogic SoCs

 

Link to comment
Share on other sites

I think i find

in the precompiled kernel of the test :

http://s000.tinyupload.com/?file_id=14478364111643420975

we have :

firmware\meson\gxbb

with files :

h263_mc

vh264_mc

vmpeg4_mc_5

vmpeg12_mc

so im shure we need it.

 

AND

i find it here :

 

https://github.com/150balbes/Amlogic_s905-kernel/blob/master/vmpeg4_mc_5
https://github.com/150balbes/Amlogic_s905-kernel/blob/master/h263_mc
https://github.com/150balbes/Amlogic_s905-kernel/blob/master/vh264_mc
https://github.com/150balbes/Amlogic_s905-kernel/blob/master/vmpeg12_mc

 

but not in my sd car , i try to put it directly and make the test ...

 

i come back with more info.

Link to comment
Share on other sites

so downlaod firmware from :
https://github.com/150balbes/Amlogic_s905-kernel/blob/master/vmpeg4_mc_5
https://github.com/150balbes/Amlogic_s905-kernel/blob/master/h263_mc
https://github.com/150balbes/Amlogic_s905-kernel/blob/master/vh264_mc
https://github.com/150balbes/Amlogic_s905-kernel/blob/master/vmpeg12_mc

copy from windows to armbian
pscp vmpeg12_mc root@192.168.1.200:/root/vmpeg12_mc
pscp vh264_mc root@192.168.1.200:/root/vh264_mc
pscp vmpeg4_mc_5 root@192.168.1.200:/root/vmpeg4_mc_5
pscp h263_mc root@192.168.1.200:/root/h263_mc

what i found for the dest rep:
drivers/media/platform/meson/vdec/vdec_platform.c

meson/gx/vmpeg4_mc_5
meson/gx/h263_mc
meson/gxl/vh264_mc
meson/gxbb/vh264_mc
meson/gx/vmpeg12_mc

so create dir :
mkdir /lib/firmware/meson
mkdir /lib/firmware/meson/gxbb/
mkdir /lib/firmware/meson/gx/
mkdir /lib/firmware/meson/gxl/

not shure of this :
chmod -R 765 /lib/firmware/meson

copy file
cp /root/vmpeg4_mc_5 /lib/firmware/meson/gx/
cp /root/h263_mc /lib/firmware/meson/gx/
cp /root/vh264_mc /lib/firmware/meson/gxl/
cp /root/vh264_mc /lib/firmware/meson/gxbb/
cp /root/vmpeg12_mc /lib/firmware/meson/gx/

 

oupps forget

https://github.com/150balbes/Amlogic_s905-kernel/blob/master/vh265_mc
pscp vh265_mc root@192.168.1.200:/root/vh265_mc
cp /root/vh265_mc /lib/firmware/meson/gx/

 

 

But it don't work ( it don't call the firmware )

 

 

Link to comment
Share on other sites

@balbes150

i think

https://github.com/Elyotna/linux/tree/4.18/amlogic-v4l2-m2m/drivers/media/platform/meson

and

https://github.com/150balbes/Amlogic_s905-kernel/tree/master/drivers/media/platform/meson

have some minor change if i don't find it, could i try to compil only meson ?

if yes could gou give a way ?

Link to comment
Share on other sites

or i can compile the kernel :

https://github.com/Elyotna/linux

 

But could you help me ? ( it's my firts kernel compil )

 

i try :

sudo apt-get -y install bc curl gcc git libssl-dev libncurses5-dev lzop make u-boot-tools

make menuconfig

make -j3 ( in console)


sortextable.c:(.text+0x408): undefined reference to `get_unaligned_le32'
collect2: error: ld returned 1 exit status
scripts/Makefile.host:90: recipe for target 'scripts/sortextable' failed
make[1]: *** [scripts/sortextable] Error 1
Makefile:1045: recipe for target 'scripts' failed
make: *** [scripts] Error 2

Link to comment
Share on other sites

On 7/28/2018 at 3:06 PM, martos said:

dtb.img with p281 dtb

Use khadas_vim dtb.

On behalf of which user do you run the tests ? By default, only "root" has access to devices.

22 hours ago, martos said:

But could you help me ? ( it's my firts kernel compil )

On the PC you need to use cross-compilation, it is easier to run the build on the TV box itself using the configuration from the /boot directory.

Link to comment
Share on other sites

ok for Khadas_vim.dtb, i try it now

 

I make all test on root ( for devices )

 

For cross compilation i must find an how to make it ( i think use a vm with 10 cpu and 20 Go ram it could be enough for start )

 

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines