Compile ffmpeg with hardware decoding for Odroid C2

Post Reply
fretzke
Posts: 38
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Compile ffmpeg with hardware decoding for Odroid C2

Unread post by fretzke » Mon Jul 10, 2017 11:21 pm

Hi everyone,

so I was trying to build ffmpeg with enabled hardware decoder for the C2 based on serveral posts scattered around the web. In the beginning everything looked quite promising, but now I keep running into one problem that I cannot seem to solve.

Hence two questions to you all:
    • Did anyone succeed in compiling ffmpeg for the C2?
  • Any ideas how to get over this error?
Here's what I did so far:

Install serveral a/v libraries required by ffmpeg

Code: Select all

apt-get install mercurial libfaac-dev libmp3lame-dev libopus-dev libtheora-dev libvorbis-dev libfreetype6-dev libx264-dev libasound2-dev
Build the AML libs

Code: Select all

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

Code: Select all

hg clone https://bitbucket.org/multicoreware/x265
cd x265/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/temp/ffmpeg_build"  -DENABLE_SHARED:bool=off ../../source
make -j4
make install
cd ../..
Build ffmpeg branch for AML VPU

Code: Select all

git clone git://github.com/LongChair/FFmpeg
cd FFmpeg
CFLAGS='-L/temp/c2_aml_libs/amcodec:-I/temp/c2_aml_libs/amcodec/include' PKG_CONFIG_PATH="/temp/ffmpeg_build/lib/pkgconfig" ./configure --pkg-config-flags="--static" --enable-gpl --enable-libass --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-nonfree --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
make -j4
This throws:

Code: Select all

ERROR : amcodec not found.
If I remove the --enable-aml flag configure runs with no error, but of course without the hardware decoders. I don't understand, why the aml libs are not found even when they are installed to the standard lib directory AND I explicitly point to the directory containing the original build. At least one of the libs should be found. Also leaving out the "make install" or the CFLAGS doesn't work either.
Any suggestion is welcome!

I'm compiling natively on the C2 running Debian (DietPi distro).

User avatar
meveric
Posts: 10179
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1, N1, Go, N2
Has thanked: 10 times
Been thanked: 81 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by meveric » Mon Jul 10, 2017 11:30 pm

you should just install aml-libs-odroid instead of trying to build it yourself, since the "make install" command probably won't work correctly to put the headers you need for building into the right place.
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.

fretzke
Posts: 38
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by fretzke » Tue Jul 11, 2017 12:38 am

Sure, but install from where? This is no standard Debian lib, I can simply apt-get install, or is it?

mscdex
Posts: 74
Joined: Sun Jan 04, 2015 11:09 am
languages_spoken: english
ODROIDs: ODROID C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by mscdex » Tue Jul 11, 2017 3:58 am

fretzke wrote:Sure, but install from where? This is no standard Debian lib, I can simply apt-get install, or is it?
It's available in the odroid c2 (xenial) repo.

User avatar
meveric
Posts: 10179
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1, N1, Go, N2
Has thanked: 10 times
Been thanked: 81 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by meveric » Tue Jul 11, 2017 5:41 am

fretzke wrote:Sure, but install from where? This is no standard Debian lib, I can simply apt-get install, or is it?
DietPi is based on my Debian Jessie images and uses my repositories.
My repository has the named package, that's why I said so.
Simply using apt-get install aml-libs-odroid is all you need to do.
mscdex wrote:
fretzke wrote:Sure, but install from where? This is no standard Debian lib, I can simply apt-get install, or is it?
It's available in the odroid c2 (xenial) repo.
Don't use this package! Don't mix packages from different distros!
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.

crashoverride
Posts: 4439
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 44 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by crashoverride » Tue Jul 11, 2017 8:15 am

fretzke wrote:ERROR : amcodec not found.
That error comes from here:
https://github.com/LongChair/FFmpeg/com ... 3a39dR5723

Code: Select all

+enabled aml               && { check_lib amcodec/codec.h codec_init "-lamcodec" || die "ERROR : amcodec not found."; }
You should verify that amcodec is stalled to the expected location or correct the FFMpeg source code.

fretzke
Posts: 38
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by fretzke » Thu Jul 13, 2017 9:00 pm

You guys are pure gold! :)

I'm not quite there, but it feels like good progress. apt-get install aml-libs-odroid collided with the parts of the self compiled aml libs, what I think is a good sign. They were in the right place after all, so what I tried before seems to not have been completely wrong.

I flushed the system and started from scratch. aml-libs-odroid install without problem. codec.h is automatically placed in /usr/local/include/amcodec/ , the related libs in /usr/local/lib/amcodec/. But when running configure I still get ERROR : amcodec not found. In a desperate atempt I also copied all related files to ./amcodec/ in the ffmpeg folder, but to no surprise that wasn't successful either.

So risking to look like a complete noob here: How should the line in configure look like to search in the standard header and library folders? check_lib amcodec/codec.h codec_init "-lamcodec" obviously won't do the trick.

crashoverride
Posts: 4439
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 44 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by crashoverride » Thu Jul 13, 2017 9:52 pm

I would recommend just removing the check altogether. Then when you compile, "real" error messages (that are from gcc) will provide additional clues to the actual issue.

fretzke
Posts: 38
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by fretzke » Fri Jul 14, 2017 7:10 pm

Line removed, configure finishes without further errors. An odd side note: with the configure flags I posted above, the mpeg2 decoder is reported missing. I looked it up in the aml libs and indeed, only mpeg4, h264, hevc and vc1 are defined. Shoulde't the C2 be capable of decoding mpeg2 in hw???

Then trying to compile, I receive an error equal to the previous problem with configure.
The step LD ffmpeg_g throws

Code: Select all

libavcodec/libavcodec.a(amldec.o): In function `ffaml_flush':
/temp/FFmpeg/libavcodec/amldec.c:433: undefined reference to `codec_reset'
Looking at the file amldec.c, the function in question looks as follows:

Code: Select all

[…]
#40 #include "amldec.h"
[…]
#423 static void ffaml_flush(AVCodecContext *avctx)
#424 {
#425   int ret;
[…]
#433   ret = codec_reset(&aml_context->codec);
The referenced amldec.h starts with:

Code: Select all

#1 #ifndef _AMLDEC_H_
#2 #define _AMLDEC_H_
#3 
#4 #include "amlqueue.h"
#5 #include "amlion.h"
#6 #include <amcodec/codec.h>
#7 #include <amcodec/codec.h>
[…]
No, that's no typo, codec.h is included twice. But removing one of the lines doesn't change a thing.

Also looking at the codec.h file, line 23 contains: int codec_reset(codec_para_t *);. Everything is there, so why won't it build? I'm really lost here. :?

crashoverride
Posts: 4439
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 44 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by crashoverride » Fri Jul 14, 2017 8:06 pm

fretzke wrote:The step LD ffmpeg_g throws
That indicates the link phase. It means the library is not being linked. The "verbose" output will tell you the command line used and whether there is even an attempt to link it. The output of "sudo ldconfig -v" will show all libraries the linker is aware of. The amcodec library should be in the list.

[edit]
Since its an error in the linker, the issue has nothing to do with header (.h) files.

fretzke
Posts: 38
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by fretzke » Sat Jul 15, 2017 7:29 am

crashoverride wrote:The amcodec library should be in the list.
And indeed there it is. The path /usr/local/lib is listed and therein libamcodec.so -> libamcodec.so.
crashoverride wrote:Since its an error in the linker, the issue has nothing to do with header (.h) files.
I was only referring to all the .h files because the error was reported in amldec.c which explicitly references to amldec.h which references to codec.h . And the function reported as „undefined reference“ is actually defined there.

The more I search for the reason why ffmpeg won't build, the less I understand what's the problem... :?: :?: :cry:

crashoverride
Posts: 4439
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 44 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by crashoverride » Sat Jul 15, 2017 9:31 am

fretzke wrote:the less I understand what's the problem
There are two stages to making a C/C++ program: 1) compiling and 2) linking.

Compiling turns each .c file into CPU instructions (.o). Linking puts all the the .o (and .so) together into a single program. The failure is in the latter stage. The compiler can not find, or is not told about, libamcodec.so. Therefore, it can not put the program together since there is a piece missing.

A verbose build will tell you whether or not the linker is being informed about the existance of libamcodec.so. You will see "-lamcodec" on the command line. If its missing, you need to modify the Makefile. If its present, you need to modify the library search path ("-L/usr/local/lib") to let the linker know where it can be found.

fretzke
Posts: 38
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by fretzke » Sun Jul 16, 2017 1:33 am

@crashoverride: Thanks for that very well understandable explanation! :)

It turned out, it was actually a combination of both. The command was missing "-lamcodec", plus "-lamadec" and "-lamavutils" were also required.

And the library path also had to be added.

So now ffmpeg builds, but the next error appears. Trying to decode an h264 file with aml gives:

Code: Select all

root@odroid:/temp/FFmpeg# ./ffmpeg -c:v "h264_aml" -i /tmp/testh264.mkv -c:v rawvideo -c:a copy "/tmp/testfile.mkv"
ffmpeg version N-80072-g2cd945c Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian/Linaro 4.9.2-10)
  configuration: --prefix=/temp/ffmpeg_port --pkg-config-flags=--static --enable-static --enable-gpl --enable-libass --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-nonfree --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
[…]
[h264_aml @ 0x191e250] Failed to open /dev/ion
[h264_aml @ 0x191e250] failed to init ion driver
[matroska,webm @ 0x191b3a0] Failed to open codec in av_find_stream_info
[h264_aml @ 0x191e250] Failed to open /dev/ion
[h264_aml @ 0x191e250] failed to init ion driver
Also the question remains, if the C2 can decode mpeg2 in hardware. In this branch of ffmpeg this option is definately missing.

Who had thought this seemingly simple task turns out to be such an impossible endavour... Is this even possible at all???

crashoverride
Posts: 4439
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 44 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by crashoverride » Sun Jul 16, 2017 10:40 am

fretzke wrote:[h264_aml @ 0x191e250] Failed to open /dev/ion
You should check the permissions on /dev/ion. By default, only root can open it. You can change that with "sudo chmod a+rw /dev/ion".
fretzke wrote:Also the question remains, if the C2 can decode mpeg2 in hardware.
Yes, C2 can decode MPEG2 in hardware. I have verified this in c2play. Support is likely missing in the ffmpeg source code.

fretzke
Posts: 38
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by fretzke » Sun Jul 16, 2017 10:57 am

/dev/ion isn't even present.

Also the dietpi distro runs everything as root (I can already hear the security guys howling from afar...), so missing permissions is in general rather unlikely.

crashoverride
Posts: 4439
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 44 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by crashoverride » Sun Jul 16, 2017 1:48 pm

/dev/ion is present in the official Ubuntu image. If you are using a 3rd party image/kernel, you will need to enable it and recompile the kernel:
https://github.com/hardkernel/linux/blo ... nfig#L3921
CONFIG_ION=y

fretzke
Posts: 38
Joined: Mon Feb 13, 2017 7:13 pm
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by fretzke » Mon Jul 17, 2017 1:48 am

Oh my, compile the kernel?! :lol:

I do really very much appreciate your profound advice! But this is so out of proportion for what I intended.

Actually I had planned to compile a package of ffmpeg with the capability to decode in hardware to move it onto a libreelec install. Other software (mainly Comskip) rely on ffmpeg and would greatly profit from hw accelleration. Unfortunately libreelec uses the Odroid's hardware for playback in Kodi, but does not include that in it's ffmpeg implementation.

Now compiling a custom kernel and rebuild libreelec with that, is clearly way to much for my very limited spare time.

Maybe I need a completely other approach.

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Tue Jul 17, 2018 2:40 am

Escume me to comeback with this old post :
I have armbian with /dev/ion at Y for the kernel
I have compiled the ffmpeg aml :

NASM
cd ~/ffmpeg_sources && \
wget https://www.nasm.us/pub/nasm/releasebui ... 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

lib-aml
sudo apt-get install libopus-dev

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

cd FFmpeg-aml
mc -e libavcodec/amltools.h
#include "amcodec/amports/vformat.h"
to
#include "/usr/include/amports/vformat.h"

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

I have a new ffmpeg aml :
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-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
Hyper fast Audio and Video encoder

The /dev/ion is ok
/root/bin/ffmpeg -vcodec h264_aml -i /root/Sintel.2010.1080p.mkv -vcodec copy /tmp/test.mp4

Works ( but with copy i have a doubt it use the aml codec)

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.

I have a look on the error : Unable to parse option value "-1" as pixel format

Someone have an idea ?

User avatar
odroid
Site Admin
Posts: 31017
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 26 times
Been thanked: 142 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by odroid » Tue Jul 17, 2018 8:31 am

Try "ffplay" command to check whether the aml decoder works or not.
You might need a Mali enabled SDL2 library to see the video.
It was included in our latest Ubuntu 18.04 Mate image.

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Tue Jul 17, 2018 6:00 pm

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 ?

User avatar
odroid
Site Admin
Posts: 31017
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 26 times
Been thanked: 142 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by odroid » Wed Jul 18, 2018 8:44 am

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

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Wed Jul 18, 2018 10:20 pm

i have it :
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

It's enough ? i need source ( devel ) of this package ?
ffmplay is not compiled i must see the logs

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Thu Jul 19, 2018 1:16 am

compile again but same result :
/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!

And no ffplay bin ...

If you have some idea ...

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Thu Jul 19, 2018 1:21 am

works with software decoder h264 ( so it's not the test dile Sintel ...)

/root/bin/ffmpeg -vcodec h264 -i /root/Sintel.2010.720p.mkv /tmp/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
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), yuv420p(tv, bt709/unknown/unknown), 1280x544, SAR 1:1 DAR 40:17, 24 fps, 24 tbr, 1k tbn, 48 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
File '/tmp/test9.avi' already exists. Overwrite ? [y/N] y
[avi @ 0x559d3d4250] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, avi, to '/tmp/test9.avi':
Metadata:
ISFT : Lavf57.48.102
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: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x544 [SAR 1:1 DAR 40:17], q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc
Metadata:
encoder : Lavc57.54.102 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp
Metadata:
title : AC3 5.1 @ 640 Kbps
encoder : Lavc57.54.102 libmp3lame
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native))
Stream #0:1 -> #0:1 (ac3 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
frame= 351 fps= 26 q=31.0 Lsize= 1488kB time=00:00:15.00 bitrate= 812.7kbits/s speed=1.09x
video:1220kB audio:235kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.261577%
...

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Thu Jul 19, 2018 6:14 pm

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

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Thu Jul 19, 2018 6:16 pm

Restart compile ...

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Thu Jul 19, 2018 8:03 pm

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 ...

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Thu Jul 19, 2018 8:05 pm

result with h264 who works :
[ffplay_buffer @ 0x7f8c086570] Setting 'video_size' to value '1920x818'
[ffplay_buffer @ 0x7f8c086570] Setting 'pix_fmt' to value '0'
[ffplay_buffer @ 0x7f8c086570] Setting 'time_base' to value '1/1000'
[ffplay_buffer @ 0x7f8c086570] Setting 'pixel_aspect' to value '0/1'
[ffplay_buffer @ 0x7f8c086570] Setting 'frame_rate' to value '24/1'
[ffplay_buffer @ 0x7f8c086570] w:1920 h:818 pixfmt:yuv420p tb:1/1000 fr:24/1 sar:0/1 sws_param:
[ffplay_crop @ 0x7f8c219dc0] Setting 'out_w' to value 'floor(in_w/2)*2'
[ffplay_crop @ 0x7f8c219dc0] Setting 'out_h' to value 'floor(in_h/2)*2'
[AVFilterGraph @ 0x7f8c000ab0] query_formats: 3 queried, 2 merged, 0 already done, 0 delayed
[ffplay_crop @ 0x7f8c219dc0] w:1920 h:818 sar:0/1 -> w:1920 h:818 sar:0/1
[ffplay_crop @ 0x7f8c219dc0] n:0 t:0.000000 pos:6750.000000 x:0 y:0 x+w:1920 y+h:818

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Thu Jul 19, 2018 8:18 pm

it could be an error in libavcodec/amldec.c
ack 'pix_fmt' | grep aml
libavcodec/amldec.c:530: .pix_fmt = AV_PIX_FMT_AML,\
libavcodec/amldec.c:555: .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P /*AV_PIX_FMT_AML*/, \

i am a beginner, coud you think i can force the pix_fmt value here ? or if the value is "-1" i change to a default value ?

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Thu Jul 19, 2018 8:42 pm

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?)

martos
Posts: 85
Joined: Fri Jun 29, 2018 12:42 am
languages_spoken: english
ODROIDs: MC1
Has thanked: 0
Been thanked: 0
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by martos » Thu Jul 19, 2018 10:51 pm

i find a post with a similar a bug in ffmpeg

https://ffmpeg.org/pipermail/ffmpeg-use ... 33420.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 ... 83e91dbc3c

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 ...

User avatar
odroid
Site Admin
Posts: 31017
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 26 times
Been thanked: 142 times
Contact:

Re: Compile ffmpeg with hardware decoding for Odroid C2

Unread post by odroid » Fri Jul 20, 2018 9:32 am

Becuase I've never tried to use ffmpeg on C2, I can't help you directly.

Which OS image and kernel version do you use?
I tested some 4K/H.265 video files with "c2play" on our official Ubuntu 18.04 + Kernel 3.16 LTS image. It worked well.
viewtopic.php?f=136&t=23143&start=250#p226478

Post Reply

Return to “Other OS”

Who is online

Users browsing this forum: No registered users and 1 guest