Jump to content

Compile FFmpeg aml for S905w


martos

Recommended Posts

Hello,

 

My OS : Armbian_5.44_S9xxx_Debian_stretch_3.14.29_server_20180601

My Devise: X96 mini ( 1 G Ram 8 flash + SD 16 G sdcard )

 

I want to use hw codec of the aml  with ffmpeg

So i find

https://github.com/roman-rybalko/FFlmpeg-aml/

 

so i try to compil :


AML_LIBS
git clone https://github.com/Owersun/c2_aml_libs.git
cd c2_aml_libs
make all -j4
make install
cd ..

copy all files from /usr/lib/aml_libs/   to /usr/local/lib (or change the path of the install )

 

cp /usr/lib/aml_libs/ld.so.conf /usr/local/lib/ld.so.conf
cp /usr/lib/aml_libs/libamadec.so /usr/local/lib/libamadec.so
cp /usr/lib/aml_libs/libamavutils.so /usr/local/lib/libamavutils.so
cp /usr/lib/aml_libs/libamcodec.so /usr/local/lib/libamcodec.so

 

NASM
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 && \
make install

Yasm
sudo apt-get install yasm

libx264
sudo apt-get install libx264-dev

libx265
sudo apt-get install libx265-dev libnuma-dev

libvpx
sudo apt-get install libvpx-dev

libfdk-aac
sudo apt-get install libfdk-aac-dev

libmp3lame
sudo apt-get install libmp3lame-dev

libopus
sudo apt-get install libopus-dev

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

rename directory FFmpeg-aml to ffmpeg

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-gpl \
  --enable-libass \
  --enable-libfdk-aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libvorbis \
  --enable-libvpx \
  --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 && \
make install && \
hash -r

 

the compil run at this moment.

 

Do you know if the kernel of Armbian_5.44_S9xxx_Debian_stretch_3.14.29_server_20180601 have the kernel option at :

CONFIG_ION=y

 

If not can i compile with it ?

Link to comment
Share on other sites

some errors so

 

mc -e ffmpeg/libavcodec/amltools.h

#include "amcodec/amports/vformat.h"
to
#include "/root/ffmpeg_sources/c2_aml_libs/amcodec/include/amports/vformat.h"

 

And restart compil but :


CC      libavcodec/amltools.o
libavcodec/amltools.c: In function ‘aml_get_vdec_type’:
libavcodec/amltools.c:194:10: error: ‘CODEC_TAG_VC_1’ undeclared (first use in this function)
     case CODEC_TAG_VC_1:
          ^~~~~~~~~~~~~~
libavcodec/amltools.c:194:10: note: each undeclared identifier is reported only once for each function it appears in
common.mak:60: recipe for target 'libavcodec/amltools.o' failed
make: *** [libavcodec/amltools.o] Error 1

Link to comment
Share on other sites

Another error :


libavcodec/libavcodec.a(amldec.o): In function `ffaml_write_codec_data':
/root/ffmpeg_sources/FFmpeg-amlvideo/libavcodec/amldec.c:132: undefined reference to `codec_write'
libavcodec/libavcodec.a(amldec.o): In function `ffaml_checkin_packet_pts':
/root/ffmpeg_sources/FFmpeg-amlvideo/libavcodec/amldec.c:174: undefined reference to `codec_checkin_pts'
libavcodec/libavcodec.a(amldec.o): In function `ffaml_decode':
/root/ffmpeg_sources/FFmpeg-amlvideo/libavcodec/amldec.c:343: undefined reference to `codec_get_vbuf_state'
libavcodec/libavcodec.a(amldec.o): In function `ffaml_close_decoder':
/root/ffmpeg_sources/FFmpeg-amlvideo/libavcodec/amldec.c:273: undefined reference to `codec_close'
libavcodec/libavcodec.a(amldec.o): In function `ffaml_init_decoder':
/root/ffmpeg_sources/FFmpeg-amlvideo/libavcodec/amldec.c:237: undefined reference to `codec_init'
/root/ffmpeg_sources/FFmpeg-amlvideo/libavcodec/amldec.c:244: undefined reference to `codec_resume'
collect2: error: ld returned 1 exit status
Makefile:131: recipe for target 'ffmpeg_g' failed
make: *** [ffmpeg_g] Error 1

Link to comment
Share on other sites

On 7/13/2018 at 12:42 AM, martos said:

copy all files from /usr/lib/aml_libs/   to /usr/local/lib (or change the path of the install )

After moving the libraries to a new location, have you created settings and run "ldconfig" ?

Link to comment
Share on other sites

Thank's a lot ... but it's my fault :

 

I see your .deb package

https://yadi.sk/d/pHxaRAs-tZiei/5.44/KODI-18.0_mali7

aml-codec_5.41.1_arm64.deb

 

i install it :

 

LOL , all it's include

 

only change

 

mc -e libavcodec/amltools.h

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

 

Make the compil and finsih without error !!!

 

Now i can test if the jernel is ok with the hw codec .

 

Link to comment
Share on other sites

33 minutes ago, martos said:

 

Now i can test if the jernel is ok with the hw codec .

After checking the write result. If this works, there is a chance that it can be used on all s9xxx (including s912). This opens up the possibility to collect MPV or KODI with hardware acceleration and without libMali.

Link to comment
Share on other sites

with this command :

/root/bin/ffmpeg -vcodec h264_aml -i /root/Sintel.2010.1080p.mkv -vcodec copy /tmp/test.mp4

Works

But to transcode :

/root/bin/ffmpeg -vcodec h264_aml -i /root/Sintel.2010.1080p.mkv -vcodec h264 /tmp/test.mp4 -loglevel trace

Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 0:0 @ 0x558ccb3e80] Setting 'video_size' to value '1920x818'
[graph 0 input from stream 0:0 @ 0x558ccb3e80] Setting 'pix_fmt' to value '-1'
[buffer @ 0x558d12f620] Unable to parse option value "-1" as pixel format
[graph 0 input from stream 0:0 @ 0x558ccb3e80] Setting 'time_base' to value '1/1000'
[graph 0 input from stream 0:0 @ 0x558ccb3e80] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x558ccb3e80] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x558ccb3e80] Setting 'frame_rate' to value '24/1'
[buffer @ 0x558d12f620] Unable to parse option value "-1" as pixel format
[buffer @ 0x558d12f620] Error setting option pix_fmt to value -1.
[graph 0 input from stream 0:0 @ 0x558ccb3e80] Error applying options to the filter.

 

look for solution ( but i have a doubt on this old ffmpeg )

Link to comment
Share on other sites

OK i have the same wit all hardware codec when it's not work.

So i ask to odroid forum

 

odroid

Try "ffplay" command to check whether the aml decoder works or not.
You might need a Mali enabled SDL2 library to see the video.

 

martos

oh ffplay is not compiled ... i look for ...
for SDL2 i have :
libsdl2-2.0-0/stable,now 2.0.5+dfsg1-2 arm64 [installed,automatic]
libsdl2-dev/stable,now 2.0.5+dfsg1-2 arm64 [installed]
It's enought or i need a specific SDL2 with mali includ ?

 

odroid
It was included in our latest Ubuntu 18.04 Mate image.

Do you use our Ubuntu 18.04 image or meveric's Debian image?
If yes, both of them have the EGL powered SDL2 library by default.

Otherwise, you have to build it. Refer this link.
viewtopic.php?f=146&t=28899#p205856

 

So ffplay is not compiled when i make the compil, i have no error but i think we need something to use the hw codec.

 

https://www.libsdl.org/hg.php

 

Could this library must have the ref of arm-libs ? i don't know i must find .... if you have some idea ...

 

 

Link to comment
Share on other sites

i think i have already install it :

root@amlogic:~# cat /var/lib/dpkg/info/aml-mali7.list
/.
/usr
/usr/include
/usr/include/umplock
/usr/include/umplock/umplock_ioctl.h
/usr/include/ump
/usr/include/ump/ump_debug.h
/usr/include/ump/ump.h
/usr/include/ump/ump_uk_types.h
/usr/include/ump/ump_ref_drv.h
/usr/include/ump/ump_osu.h
/usr/include/ump/ump_platform.h
/usr/lib
/usr/lib/udev
/usr/lib/udev/rules.d
/usr/lib/udev/rules.d/99-mali.rules
/usr/lib/libMali.so
/usr/lib/libEGL.so.1
/usr/lib/libGLESv2.so.2.0
/usr/lib/libEGL.so
/usr/lib/libGLESv2.so
/usr/lib/libEGL.so.1.4
/usr/lib/libGLESv1_CM.so.1
/usr/lib/libGLESv1_CM.so.1.1
/usr/lib/libGLESv1_CM.so
/usr/lib/libGLESv2.so.2

 

But i want to have an eyes on the olf ffmpeg , do it use the version 2 or old version 1 ( isee some post on this )

Link to comment
Share on other sites

Try again but same error :

 /root/bin/ffmpeg -vcodec h264_aml -i /root/Sintel.2010.720p.mkv  /temp.test9.avi
ffmpeg version N-81550-g2349883fa1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --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-ffplay --enable-libx265 --enable-nonfree
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 54.102 / 57. 54.102
  libavformat    57. 48.102 / 57. 48.102
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 60.100 /  6. 60.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[h264_aml @ 0x5583d69320] Unknown Codec Tag 0x0, trying to override vdec type
OPEN es DEVICE
codec_init amstream version : 2.0
[codec_resume]p->has_audio=0
video_resume!
[matroska,webm @ 0x5583d62700] decoding for stream 0 failed
[codec_close_cntl]video codec close return=0!
[matroska,webm @ 0x5583d62700] Could not find codec parameters for stream 0 (Video: h264 (High), none, 1280x544): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, matroska,webm, from '/root/Sintel.2010.720p.mkv':
  Metadata:
    encoder         : libebml v1.0.0 + libmatroska v1.0.0
    creation_time   : 2011-04-03T10:24:20.000000Z
  Duration: 00:14:48.03, start: 0.000000, bitrate: 6137 kb/s
    Chapter #0:0: start 0.000000, end 103.125000
    Metadata:
      title           : Chapter 01
    Chapter #0:1: start 103.125000, end 148.667000
    Metadata:
      title           : Chapter 02
    Chapter #0:2: start 148.667000, end 349.792000
    Metadata:
      title           : Chapter 03
    Chapter #0:3: start 349.792000, end 437.208000
    Metadata:
      title           : Chapter 04
    Chapter #0:4: start 437.208000, end 472.075000
    Metadata:
      title           : Chapter 05
    Chapter #0:5: start 472.075000, end 678.833000
    Metadata:
      title           : Chapter 06
    Chapter #0:6: start 678.833000, end 744.083000
    Metadata:
      title           : Chapter 07
    Chapter #0:7: start 744.083000, end 888.032000
    Metadata:
      title           : Chapter 08
    Stream #0:0(eng): Video: h264 (High), none, 1280x544, SAR 1:1 DAR 40:17, 24 fps, 24 tbr, 1k tbn, 1k tbc
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s
    Metadata:
      title           : AC3 5.1 @ 640 Kbps
    Stream #0:2(ger): Subtitle: subrip
    Stream #0:3(eng): Subtitle: subrip
    Stream #0:4(spa): Subtitle: subrip
    Stream #0:5(fre): Subtitle: subrip
    Stream #0:6(ita): Subtitle: subrip
    Stream #0:7(dut): Subtitle: subrip
    Stream #0:8(pol): Subtitle: subrip
    Stream #0:9(por): Subtitle: subrip
    Stream #0:10(rus): Subtitle: subrip
    Stream #0:11(vie): Subtitle: subrip
[buffer @ 0x5583d9ce40] Unable to parse option value "-1" as pixel format
    Last message repeated 1 times
[buffer @ 0x5583d9ce40] Error setting option pix_fmt to value -1.
[graph 0 input from stream 0:0 @ 0x5583d9d5f0] Error applying options to the filter.
Error opening filters!

Link to comment
Share on other sites

i think i find
no sdl-config !!!

ack 'sdl-config'
configure
5843:    SDL_CONFIG="${cross_prefix}sdl-config"

apt-file search "sdl-config"
libsdl1.2-dev: /usr/bin/sdl-config
so
apt-get install libsdl1.2-dev

BETTER :
locate sdl-config
/usr/bin/sdl-config

 

Restart compil now

Link to comment
Share on other sites

now ffplay is compiled ... but alway the error with ffmpeg :

Unable to parse option value "-1" as pixel format

 

i look for this error

 

when i launch ffplay with h264_aml :

 

[ffplay_buffer @ 0x7f7c0014f0] Setting 'video_size' to value '1920x818'
[ffplay_buffer @ 0x7f7c0014f0] Setting 'pix_fmt' to value '128'
[ffplay_buffer @ 0x7f7c0014f0] Setting 'time_base' to value '1/1000'
[ffplay_buffer @ 0x7f7c0014f0] Setting 'pixel_aspect' to value '0/1'
[ffplay_buffer @ 0x7f7c0014f0] Setting 'frame_rate' to value '24/1'
[ffplay_buffer @ 0x7f7c0014f0] w:1920 h:818 pixfmt:aml tb:1/1000 fr:24/1 sar:0/1 sws_param:
[ffplay_crop @ 0x7f7c001fb0] Setting 'out_w' to value 'floor(in_w/2)*2'
[ffplay_crop @ 0x7f7c001fb0] Setting 'out_h' to value 'floor(in_h/2)*2'
[auto-inserted scaler 0 @ 0x7f7c0024b0] Setting 'flags' to value 'bicubic'
[auto-inserted scaler 0 @ 0x7f7c0024b0] w:iw h:ih flags:'bicubic' interl:0
[ffplay_crop @ 0x7f7c001fb0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'ffplay_buffer' and the filter 'ffplay_crop'
Impossible to convert between the formats supported by the filter 'ffplay_buffer' and the filter 'auto-inserted scaler 0'
[codec_close_cntl]video codec close return=0!
[h264_aml @ 0x7f8c0d2c70] closed device /dev/video10 with fd=7
[h264_aml @ 0x7f8c0d2c70] amcodec closed successfully
[AVIOContext @ 0x7f8c0091e0] Statistics: 15739945 bytes read, 0 seeks

 

ffplay works with h264 codec ...

 

Link to comment
Share on other sites

i try
/root/bin/ffplay -vcodec h264_aml /root/Sintel.2010.1080p.mkv
works 2 secondes after i have on error
Impossible to convert between the formats supported by the filter 'ffplay_buffer' and the filter 'auto-inserted scaler 0'

But if i use :
/root/bin/ffplay -vcodec mpeg4_aml /root/Sintel.2010.1080p.mkv
its works

So Hw aml codecs works with ffplay but not in ffmpeg (pix_fmt value?)

Link to comment
Share on other sites

in fact i test a lot of file with the same error :

Source my receiver :

/root/bin/ffmpeg -vcodec mpeg4_aml -i http://192.168.1.50:8001/+1:0:19:416:4:20FA:EEEE0000:0:0:0: /tmp/test.mp4

same error

[buffer @ 0x55ae04db90] Unable to parse option value "0x0" as image size
[buffer @ 0x55ae04db90] Unable to parse option value "-1" as pixel format
[buffer @ 0x55ae04db90] Unable to parse option value "0x0" as image size
[buffer @ 0x55ae04db90] Error setting option video_size to value 0x0.
[graph 0 input from stream 0:0 @ 0x55adb90170] Error applying options to the filter.

 

and works with h264.

 

My check say it the amlcodec don't send good value of pix_fmt to ffmpeg ( it could be an integer variable ) so it's stop.

Link to comment
Share on other sites

i find a post with a similar a bug in ffmpeg

https://ffmpeg.org/pipermail/ffmpeg-user/2016-September/033420.html

buffer @ 0x2873e00] Unable to parse option value "0x0" as image size

[buffer@ 0x2873e00] Unable to parse option value "-1" as pixel format

[buffer @ 0x2873e00] Unable to parse option value "0x0" as image size

[buffer @ 0x2873e00] Error setting option video_size to value 0x0.

 

resolution

http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=cef5bc0e6e2320d3903cf063d59cef83e91dbc3c

 

i must find the same in aml ... so diifcult for me .... and i can't ask to ffmpeg because it's a aml fork ...

And i am not a dev ...

Link to comment
Share on other sites

Bad news i wrote to one dev and i replt ( thank's a lot again to him )

Hi,

Bad news for you: Amlogic provides a very very bad support. The only way IMO to bring that board up is to find an old working binaries together with an old working kernel.

Actually I have compiled ffmpeg for ordoird 16.x but the dirver in that kernel did not work, the decoded frames was like this one https://github.com/roman-rybalko/gst-aml-plugins/blob/master/cam.png.

I would recommend to you give the ffmpeg up and try to enable Amlogic v4l2 driver. Look at this: https://magazine.odroid.com/article/enable-hardware-decoding-odroid-c2/
They added kernel options:

V4L2 Video Support

         Amlogic v4l video device support = M

         Amlogic v4l video2 device support = yes

If you manage to build & run that you then run hardware decoding via v4l using gstreamer or via ffmpeg with --enable-libv4l2 support (prebuilt binaries already have that).

IMO running hardware decoding via V4L2 is the most proper way.

Good luck!

Two way :

i find old kernel who works with or i retry since the start and try this with v4l2 ...

Link to comment
Share on other sites

8 hours ago, martos said:

an you help me  to make this special kernel ? ( make a patch for this distrib could be possible ? )

or do you have in archive old version who it can works ?

The developer community LibreELEC now working to support v4l-m2m is mainly the core for AML. There is already some progress. I invite you to join this work. You agree ?

Link to comment
Share on other sites

OK i can check but my trouble is easy : i can't modify the system easily ...

apt-get

 There is no working 'apt-get'.

 'apt-get' is a command to install, update and remove software which
 is stored in a non local repo. 'apt-get' does nothing then connecting to such
 repo, downloads the software, unpacks the software, updates a big
 local database with all filepaths and other informations about the
 installed software or removes or updates installed Software.

 With LibreELEC it is not possible to change the system for security and
 stability reasons so even 'apt-get' would not be able to do this.
 We also dont have and want to maintain such a repo for various other
 great reasons.

 Also Ubuntu or Debian packages are often outdated and not compatible
 with LibreELEC

 TIP: use XBMC's addon browser to enhance your LibreELEC system

 

ffmpeg
-sh: ffmpeg: not found

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