HydrogenAudio

Digital Audio/Video => General A/V => Topic started by: polemon on 2019-07-31 17:51:05

Title: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: polemon on 2019-07-31 17:51:05
I'm using uncompressed video from the Xiph test footage collection: https://media.xiph.org/video/derf/

Now, I wanted to see how the codec looks like and used FFmpeg to encode with AV1:

Code: [Select]
ffmpeg -i controlled_burn_1080p.y4m -c:v av1 -crf 30 -b:v 0 -strict experimental controlled_burn_1080p.mkv

The problem is, that FFmpeg segfaults after encoding around 50 frames.

I'd like to try out encoding the footage with aomenc, but there's next to no docs and the --help is rather confusing.
Can someone help me figure out the switched and options for aomenc, that does the same as -crf 30 -b:v 0 in FFmpeg?

I've installed aomenc from repos of my distribution, it's version 1.0.0.

When using -c:v avi it uses libaom-av1, in case you're wondering.
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: lvqcl on 2019-08-01 00:34:44
I use Windows, so I downloaded ffmpeg.exe nightly build from Zeranoe. 32-bit version crashes very fast, 64-bit version consumes about 1.4 GB RAM but works, so...

a) Try to upgrade ffmpeg and libaom to latest nightly versions
b) I hope you use 64-bit OS and have enough RAM ?
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: polemon on 2019-08-02 00:58:03
It is the latest FFmpeg available in the repos:
Code: [Select]
ffmpeg version 4.1.4 Copyright (c) 2000-2019 the FFmpeg developers
Same with libaom:
Code: [Select]
Version      : 1.0.0
Release      : 6.20180925gitd0076f5.fc30

I should have enough RAM (16GB total, not much these days, but should be adequate).
I know it's very slow. It takes hours to encode a couple frames.
There's SVT-AV1, but I haven't got it to work yet, it also segfaults, even when compiling it from source.
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: mycroft on 2019-08-02 08:05:40
FFmpeg needs to be latest master. Nobody test release.
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: polemon on 2019-08-02 17:50:49
FFmpeg needs to be latest master. Nobody test release.
I don't understand your statement.
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: saratoga on 2019-08-03 06:11:41
FFmpeg needs to be latest master. Nobody test release.
I don't understand your statement.

You're running a release of ffmpeg that was forked from master in 2018.  AV1 is a new format, so try the current git master (version), it is probably going to work a lot better.
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: polemon on 2019-08-05 03:18:00
You're running a release of ffmpeg that was forked from master in 2018.  AV1 is a new format, so try the current git master (version), it is probably going to work a lot better.

I did try that. Problem is, with libaom-av1 and ffmpeg from the latest git, it segfaults after encoding around 50 frames.

I retried using ffmpeg and libaom from repos alone, and it does work, but it's just very, VERY slow.
I also recently tried SVT-AV1 from git, but it also segfaults, when encoding.
The code itself compiles fine.

So while ffmpeg, libaom (and SVT-av1) all compile fine when cloning from git, they all segfault when encoding. And they don't segfault immediately, it takes quite a while, it gets to frame 50 and then just sits there for a while, until segfaulting.

I ended up using the stable releases available in my distro's repos, to see how encoding AV1 videos look, and how the encoder works, etc. While FFmpeg is reasonably well documented when it comes to settings of the av1 encoder, aomenc isn't. I was kinda hoping I can check out both, etc. but I have a hard time figuring out the correct option settings for aomenc, such that it is equivalent to ffmpeg's -b:v 0 -crf 30.

Hence me asking.
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: saratoga on 2019-08-05 05:20:43
If the git build is segfaulting, I would ask on the ffmpeg mailing list for help. 
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: Phanton_13 on 2019-08-05 14:31:42
Try to use a build from around march or april, for me any recent build suffers a secfaulf during the second pass in a two pass encoding.
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: polemon on 2019-08-08 00:13:55
If the git build is segfaulting, I would ask on the ffmpeg mailing list for help.
Yeah, either that, or I'll just wait for a couple merges.

Try to use a build from around march or april, for me any recent build suffers a secfaulf during the second pass in a two pass encoding.
Huh, OK, I haven't yet tried an older snapshot.

Still though, when it comes to aomenc I still can't figure out the equivalent settings...
Title: Re: FFmpeg segfaults when encoding to AV1. How to use aomenc?
Post by: Rollin on 2019-08-22 23:06:15
I tried this build (https://rwijnsma.home.xs4all.nl/files/ffmpeg/ffmpeg-4.2-dev-1811-g89b9690-win32-shared-xpmod-sse.7z) and it works even on my 32 bit Windows 7. This is special build for compatibility with Windows XP and non-SSE2 CPUs, so probably it is much slower than normal builds from Zeranoe.