--enable-libaom

Questions that occur when trying to compile FFmpeg.
hydra3333
Posts: 199
Joined: Sun Apr 28, 2013 1:03 pm
Contact:

--enable-libaom

Post by hydra3333 » Fri Mar 30, 2018 12:19 am

I see one can now add this to the ffmpeg configure command

Code: Select all

--enable-libaom
Any chance of Zeranoe adding libaom to the build ? :)

Depending on your build system, cmake options a bit like

Code: Select all

cmake ..
-G"Unix Makefiles" -DCMAKE_SYSTEM_PROCESSOR="{bitness}" 
-DENABLE_STATIC_RUNTIME=1 
-DCMAKE_SYSTEM_NAME=Windows 
-DCMAKE_RANLIB={cross_prefix_full}ranlib 
-DCMAKE_C_COMPILER={cross_prefix_full}gcc 
-DCMAKE_CXX_COMPILER={cross_prefix_full}g++ 
-DCMAKE_RC_COMPILER={cross_prefix_full}windres 
-DCMAKE_FIND_ROOT_PATH={target_prefix}"
-DCMAKE_INSTALL_PREFIX={target_prefix} 
-DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCONFIG_LOWBITDEPTH=0 -DCONFIG_HIGHBITDEPTH=1 
-DCONFIG_AV1=1 -DHAVE_PTHREAD=1 -DBUILD_SHARED_LIBS=0 -DENABLE_DOCS=0 -DCONFIG_INSTALL_DOCS=0 
-DCONFIG_INSTALL_BINS=0 -DCONFIG_INSTALL_LIBS=1 
-DCONFIG_INSTALL_SRCS=1 -DCONFIG_UNIT_TESTS=0 
-DCONFIG_AV1_DECODER=1 -DCONFIG_AV1_ENCODER=1 
-DCONFIG_MULTITHREAD=1 -DCONFIG_PIC=1 -DCONFIG_COEFFICIENT_RANGE_CHECKING=0 
-DCONFIG_RUNTIME_CPU_DETECT=1 -DCONFIG_WEBM_IO=1 
-DCONFIG_SPATIAL_RESAMPLING=1 -DENABLE_NASM=on
Speed running it ? It went downward to 10% of the stat at the bottom of this before I killed it:

Code: Select all

"C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -v verbose -threads 0 -i "T:\HDTV\autoTVS-mpg\Converted\test.aac.mp4" -threads 0 -c:a copy -sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -c:v libaom-av1 -crf 20 -stats -vstats -benchmark -strict -2 -y "T:\HDTV\autoTVS-mpg\Converted\test.aac.mp4.mkv"
Routing option strict to both codec and muxer layer
[h264 @ 000001e62dd0d1c0] Reinit context to 720x576, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'T:\HDTV\autoTVS-mpg\Converted\test.aac.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp423gp5
    creation_time   : 2018-03-29T14:23:00.000000Z
  Duration: 04:11:11.96, start: 0.000000, bitrate: 3958 kb/s
    Stream #0:0(eng): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 720x576 [SAR 16:11 DAR 20:11], 3573 kb/s, SAR 64:45 DAR 16:9, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 381 kb/s (default)
    Metadata:
      creation_time   : 2018-03-29T14:26:48.000000Z
      handler_name    : aac:lang=eng:[email protected]
    Stream #0:2(und): Data: none (mp4s / 0x7334706D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-03-29T14:27:13.000000Z
      handler_name    : GPAC MPEG-4 OD Handler
    Stream #0:3(und): Data: none (mp4s / 0x7334706D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-03-29T14:27:13.000000Z
      handler_name    : GPAC MPEG-4 Scene Description Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> av1 (libaom-av1))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264 @ 000001e62dd0e000] Reinit context to 720x576, pix_fmt: yuv420p
[graph 0 input from stream 0:0 @ 000001e630bceec0] w:720 h:576 pixfmt:yuv420p tb:1/12800 fr:25/1 sar:64/45 sws_param:flags=2
[libaom-av1 @ 000001e62e12ab00] 0.1.0-8949-g5af489166
[libaom-av1 @ 000001e62e12ab00] -G "Unix Makefiles" -DAOM_TARGET_CPU=x86_64 -DCMAKE_CXX_COMPILER=/home/u/Desktop/workdir/toolchain/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-g++ -DCMAKE_C_COMPILER=/home/u/Desktop/workdir/toolchain/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-gcc -DCMAKE_FIND_ROOT_PATH=/home/u/Desktop/workdir/toolchain/x86_64-w64-mingw32/x86_64-w64-mingw32 -DCMAKE_RC_COMPILER=/home/u/Desktop/workdir/toolchain/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-windres -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCONFIG_AV1=1 -DCONFIG_AV1_DECODER=1 -DCONFIG_AV1_ENCODER=1 -DCONFIG_COEFFICIENT_RANGE_CHECKING=0 -DCONFIG_HIGHBITDEPTH=1 -DCONFIG_INSTALL_BINS=0 -DCONFIG_INSTALL_DOCS=0 -DCONFIG_INSTALL_LIBS=1 -DCONFIG_INSTALL_SRCS=1 -DCONFIG_LOWBITDEPTH=0 -DCONFIG_MULTITHREAD=1 -DCONFIG_PIC=1 -DCONFIG_RUNTIME_CPU_DETECT=1 -DCONFIG_SPATIAL_RESAMPLING=1 -DCONFIG_UNIT_TESTS=0 -DCONFIG_WEBM_IO=1 -DENABLE_STATIC_RUNTIME=1 -DHAVE_PTHREAD=1
Output #0, matroska, to 'T:\HDTV\autoTVS-mpg\Converted\test.aac.mp4.mkv':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp423gp5
    encoder         : Lavf58.10.100
    Stream #0:0(eng): Video: av1 (libaom-av1), 1 reference frame (AV01 / 0x31305641), yuv420p(left), 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 200 kb/s, 25 fps, 1k tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.16.100 libaom-av1
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, 381 kb/s (default)
    Metadata:
      creation_time   : 2018-03-29T14:26:48.000000Z
      handler_name    : aac:lang=eng:[email protected]
frame=   24 fps=0.2 q=-0.0 size=       1kB time=00:00:01.48 bitrate=   5.9kbits/s speed=0.0148x

User avatar
Zeranoe
Site Admin
Posts: 703
Joined: Sat May 07, 2011 7:12 pm
Contact:

Re: --enable-libaom

Post by Zeranoe » Fri Mar 30, 2018 2:48 pm


hydra3333
Posts: 199
Joined: Sun Apr 28, 2013 1:03 pm
Contact:

Re: --enable-libaom

Post by hydra3333 » Sat Mar 31, 2018 3:29 am

Thank you.

Reino
Posts: 83
Joined: Thu Aug 22, 2013 5:14 pm
Contact:

Re: --enable-libaom

Post by Reino » Mon Apr 02, 2018 10:10 pm

hydra3333 wrote:
Fri Mar 30, 2018 12:19 am

Code: Select all

frame=   24 fps=0.2 q=-0.0 size=       1kB time=00:00:01.48 bitrate=   5.9kbits/s speed=0.0148x
If you think that's slow, then let me put that into perspective. I thought it to be fun to try out libaom-av1 on my ancient cpu as well. So I made a new FFmpeg build and I took a 640x480 (uncompressed,rgb32,fps25) video with a duration of just 4 seconds and encoded it with the new av1 codec. It took 42 hours!!! (speed=2.63e-005x, which is 0.0000263x) Absolutely insane!
I know my cpu is slow, but encoding the same uncompressed video with libx264 and default parameters takes just 27 seconds.

hydra3333
Posts: 199
Joined: Sun Apr 28, 2013 1:03 pm
Contact:

Re: --enable-libaom

Post by hydra3333 » Tue Apr 03, 2018 9:48 am

An idle wondering on a separate tack, based on knowing extremely little.

Graphics cards seem to encode (and decode) using a special "asic" chip, eg nvidia. On the other hand, lots of video processing is performed by large numbers of very fast gpu elements and memory onboard those cards.

I take it that graphics card hardware design is not aligned with the processing needs of an encoder like aom av1 ? eg nvidia's cuda. Otherwise manufacturers would be all over encoding for existing video cards, I suppose.

enctac
Posts: 5
Joined: Sun Aug 06, 2017 8:49 am

libaom build failure?

Post by enctac » Wed Apr 04, 2018 1:34 pm

Hi, Zeranoe.

I use media-autobuild_suite(MABS) to build my ffmpeg.

I found libaom-av1 of Zeranoe ffmpeg is much slower than MABS ffmpeg.
I think it's maybe your problem about building libaom.(nasm didn't work?)

My configuration of MABS ffmpeg

Code: Select all

--enable-libaom --disable-w32threads --enable-libvmaf --enable-avresample --disable-doc --disable-amf --disable-bzlib --disable-cuda --disable-cuvid --disable-d3d11va --disable-dxva2 --disable-iconv --disable-lzma --disable-nvenc --disable-zlib --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libmfx --enable-avisynth --enable-libfdk-aac --enable-gpl --enable-version3 --enable-nonfree --disable-debug
MABS libaom cmake log

Code: Select all

cmake .. -G Ninja -DBUILD_SHARED_LIBS=off -DCMAKE_INSTALL_PREFIX=/local64 -DUNIX=on -DCMAKE_BUILD_TYPE=Release -DENABLE_DOCS=off -DENABLE_TOOLS=off -DENABLE_NASM=on -DCONFIG_UNIT_TESTS=0
Test result

Win10 FCU, i7-4702MQ, IntelHD4600, Mem8GB

Case1. libaom-av1, 2pass -cpu-used 0, 1920x1080, 10frames of my test clip. (See table.)

Zeranoe-0402: 378.2 minutes (table)
MABS-0403 : 57.5 minutes (table)

Case2. libaom-av1, 1pass -cpu-used 4, testsrc2 1920x1080, 1/1fps, duration=10sec (10frames)

Code: Select all

ffmpeg.exe -f lavfi -i testsrc2=duration=10:size=1920x1080:rate=1/1 -an -strict -2 -c:v libaom-av1 -b:v 0 -crf 30 -cpu-used 4 -threads 8 -f matroska testsrc2.mkv"
Zeranoe-20180402-N-90578-g02ae52db87 (libaom 0.1.0-9012-ge83c6624f)
EncodeTime (sec): 00:04:25.80 (265.80sec)
Result: 10frames, 354.4kbps, 0.0fps (10/265.80=0.0376fps)

Zeranoe-20180404-N-90610-g2accdd3871 (libaom 0.1.0-9012-ge83c6624f)
EncodeTime (sec): 00:04:35.49 (275.49sec)
Result: 10frames, 354.4kbps, 0.0fps (10/275.49=0.0363fps)

MABS-20180401-N-90554-ge760c12aee (libaom 0.1.0-9011-g0ec805145)
EncodeTime (sec): 00:01:52.42 (112.42sec)
Result: 10frames, 354.3kbps, 0.1fps (10/112.42=0.0890fps)

MABS-20180403-N-90590-g197a4e8fee (libaom 0.1.0-9028-geeda6d2de)
EncodeTime (sec): 00:01:48.24 (108.24sec)
Result: 10frames, 354.3kbps, 0.1fps (10/108.24=0.0924fps)

---

rf. libx264, testsrc2 1920x1080, 24000/1001fps, duration=60sec(1439frames)

Code: Select all

ffmpeg.exe -f lavfi -i testsrc2=duration=60:size=1920x1080:rate=24000/1001 -an -c:v libx264 -preset medium -crf 23 -f matroska testsrc2-1080p.mkv
Zeranoe-20180402-N-90578-g02ae52db87
EncodeTime (sec): 00:00:22.89 (22.89sec)
Result: 5445.3kbps, 63fps

MABS-20180403-N-90590-g197a4e8fee
EncodeTime (sec): 00:00:25.04 (25.04sec)
Result: 5445.3kbps, 63fps

User avatar
Zeranoe
Site Admin
Posts: 703
Joined: Sat May 07, 2011 7:12 pm
Contact:

Re: --enable-libaom

Post by Zeranoe » Fri Apr 06, 2018 3:18 am

According to CMakeLists.txt the

Code: Select all

-DENABLE_NASM=on
flag just uses nasm instead of yasm (which they say is preferred).

The issue was actually the lack of CMAKE_SYSTEM_PROCESSOR in my cmake toolchain file.

This has been fixed, and I see the assembly code was built. Tonight's build should resolve this.

enctac
Posts: 5
Joined: Sun Aug 06, 2017 8:49 am

Re: --enable-libaom

Post by enctac » Fri Apr 06, 2018 12:30 pm

Thanks!

Code: Select all

ffmpeg.exe -f lavfi -i testsrc2=duration=10:size=1920x1080:rate=1/1 -an -strict -2 -c:v libaom-av1 -b:v 0 -crf 30 -cpu-used 4 -threads 8 -f matroska testsrc2.mkv"
Zeranoe-20180405-N-90627-ge54679b6c1 (libaom 0.1.0-9080-g55c95f8c1)

EncodeTime (sec): 00:02:50.76 (170.76sec)
Result: 10frames, 331.2kbps, 0.1fps

MABS-20180405-N-90627-ge54679b6c1 (libaom 0.1.0-9082-gab1e1db19)

EncodeTime (sec): 00:02:52.43 (172.43sec)
Result: 10frames, 331.2kbps, 0.1fps

hydra3333
Posts: 199
Joined: Sun Apr 28, 2013 1:03 pm
Contact:

Re: --enable-libaom

Post by hydra3333 » Fri Apr 06, 2018 12:36 pm

Zeranoe wrote:
Fri Apr 06, 2018 3:18 am
The issue was actually the lack of CMAKE_SYSTEM_PROCESSOR in my cmake toolchain file.

This has been fixed, and I see the assembly code was built. Tonight's build should resolve this.
Thank you.

Could you please clarify, for newbies like me, where and how you define CMAKE_SYSTEM_PROCESSOR in the toolchain so that others can avoid the issue ?

Thanks.

User avatar
Zeranoe
Site Admin
Posts: 703
Joined: Sat May 07, 2011 7:12 pm
Contact:

Re: --enable-libaom

Post by Zeranoe » Fri Apr 06, 2018 2:12 pm

hydra3333 wrote:
Fri Apr 06, 2018 12:36 pm
Could you please clarify, for newbies like me, where and how you define CMAKE_SYSTEM_PROCESSOR in the toolchain so that others can avoid the issue ?
You can use AOM's cross toolchain files in build/cmake/toolchains or you can add the CMAKE_SYSTEM_PROCESSOR flag to an existing standard toolchain file that gets included with:

Code: Select all

-DCMAKE_TOOLCHAIN_FILE=...

Post Reply
'