alexheretic / ab-av1

AV1 re-encoding using ffmpeg, svt-av1 & vmaf.
MIT License
429 stars 29 forks source link

Issues with Auto-encode but encode working. #198

Closed nefty1029 closed 3 months ago

nefty1029 commented 5 months ago

Hello, when using Ffmpeg version 6.1.1, auto-encode works flawlessly, However, using the latest compiled Ffmpeg Master patched with SVT-AV1-PSY, I receive the following error:

PS C:\Users\Nefty\Downloads\ab-av1> .\ab-av1.exe auto-encode --pix-format yuv420p10le -i Drive.mp4 --preset 6
Encoding Drive.av1.mp4                                                                                                 )
  Searching 00:00:00 ##################################################################### (crf 55, VMAF 95.28, size 2%)
Error: ffmpeg encode exit code -1073741819
---stderr---
ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20240323
  libavutil      59.  4.100 / 59.  4.100
  libavcodec     61.  2.100 / 61.  2.100
  libavformat    61.  0.100 / 61.  0.100
  libavdevice    61.  0.100 / 61.  0.100
  libavfilter    10.  0.100 / 10.  0.100
  libswscale      8.  0.100 /  8.  0.100
  libswresample   5.  0.100 /  5.  0.100
  libpostproc    58.  0.100 / 58.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Drive.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2020-11-18T06:37:58.000000Z
  Duration: 00:23:01.46, start: 0.000000, bitrate: 27919 kb/s
  Stream #0:0[0x1](eng): Video: hevc (Main 10) (hvc1 / 0x31637668), yuv420p10le(tv), 2880x2160 [SAR 1:1 DAR 4:3], 27535 kb/s, 24 fps, 24 tbr, 24k tbn (default)
      Metadata:
        creation_time   : 2020-11-18T06:38:02.000000Z
        handler_name    : Mainconcept MP4 Video Media Handler
        vendor_id       : [0][0][0][0]
        encoder         : HEVC Coding
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 381 kb/s (default)
      Metadata:
        creation_time   : 2020-11-18T06:38:02.000000Z
        handler_name    : Mainconcept MP4 Sound Media Handler
        vendor_id       : [0][0][0][0]
Multiple -codec/-c/-acodec/-vcodec/-scodec/-dcodec options specified for stream 0, only the last option '-codec:v:0 libsvtav1' will be used.
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> av1 (libsvtav1))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:       SVT-AV1-PSY Encoder Lib v2.0.0-1-g9eaa28af
Svt[info]: SVT [build]  :       GCC 13.2.0       64 bit
Svt[info]: LIB Build date: Mar 23 2024 04:46:48
Svt[info]: -------------------------------------------
Svt[warn]: SVT-AV1 has an integrated mode decision mechanism to handle scene changes and will not insert a key frame at scene changes
Svt[info]: Number of logical cores available: 16
Svt[info]: Number of PPCS 76
Svt[info]: [asm level on system : up to avx2]
Svt[info]: [asm level selected : up to avx2]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile   tier (auto)     level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator               : 2880 / 2160 / 24 / 1
Svt[info]: SVT [config]: bit-depth / color format                                       : 10 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct                                    : 6 / SSIM / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type                      : 240 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor                                         : CRF / 55
Svt[info]: SVT [config]: AQ mode / variance boost strength / octile / curve             : 2 / 2 / 6 / regular
Svt[info]: -------------------------------------------
Output #0, mp4, to 'Drive.av1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf61.0.100
  Stream #0:0(eng): Video: av1 (av01 / 0x31307661), yuv420p10le(tv, progressive), 2880x2160 [SAR 1:1 DAR 4:3], q=2-31, 24 fps, 12288 tbn (default)
      Metadata:
        creation_time   : 2020-11-18T06:38:02.000000Z
        handler_name    : Mainconcept MP4 Video Media Handler
        vendor_id       : [0][0][0][0]
        encoder         : Lavc61.2.100 libsvtav1
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 381 kb/s (default)
      Metadata:
        creation_time   : 2020-11-18T06:38:02.000000Z
        handler_name    : Mainconcept MP4 Sound Media Handler
        vendor_id       : [0][0][0][0]
[hevc @ 000001e5fef8fd80] get_buffer() failed
[hevc @ 000001e5fef8fd80] thread_get_buffer() failed
[hevc @ 000001e5fef8fd80] Error parsing NAL unit #0.
SvtMalloc[fatal]: allocate memory failed, at /50-svtav1/Source/Lib/Encoder/Codec/EbSequenceControlSet.c:210
[hevc @ 000001e5ff5330c0] Error parsing NAL unit #0.

This also happens when using crf-search (the cached crf value above came from the previous auto-encode with ffmpeg 6.1.1), but not with encode, which works without any problem. From what I can gather from Discord, there seems to be an API change with the latest Ffmpeg master.

Is there anyway to fix this?

nefty1029 commented 3 months ago

Just an update, I just replaced the previous ffmpeg executable with the latest stable version (7.0) and the issue disappeared. Closing this now.