SVT-VP9
SVT-VP9 copied to clipboard
Cannot convert AV1 to VP9 by FFMPEG with Segmentation fault (core dumped) error
Hi there,
I'm trying to experiment with 8K AV1 to VP9 conversion by using FFMPEG + SVT-VP9 but got the error Segmentation fault (core dumped) after running ffmpeg command short time. This is how I did:
- Build ffmpeg with
./configure --enable-libsvtvp9 --enable-libopus --enable-libaom --enable-libvpx - Run AV1 to VP9 conversion with
./ffmpeg -i av1_video.mp4 -c:v libsvt_vp9 -c:a libopus vp9output.webm:
ubuntu1804:~/svt$ ./ffmpeg -i av1_video.mp4 -c:v libsvt_vp9 -c:a libopus vp9output.webm
ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --enable-libsvtvp9 --enable-libopus --enable-libaom --enable-libvpx
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
[libaom-av1 @ 0x557b89b094c0] 2.0.2-1423-gb53a4d710
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'av1_20210205_Jy1N3jyFV6c.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.45.100
Duration: 00:29:13.29, start: 0.000000, bitrate: 22559 kb/s
Stream #0:0(und): Video: av1 (Main) (av01 / 0x31307661), yuv420p(tv, bt709), 7680x3840, 22424 kb/s, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
[libaom-av1 @ 0x557b89c33300] 2.0.2-1423-gb53a4d710
Stream mapping:
Stream #0:0 -> #0:0 (av1 (libaom-av1) -> vp9 (libsvt_vp9))
Stream #0:1 -> #0:1 (aac (native) -> opus (libopus))
Press [q] to stop, [?] for help
-------------------------------------------
SVT [version] : SVT-VP9 Encoder Lib v0.3.0
SVT [build] : GCC 7.5.0 64 bit
LIB Build date: Mar 22 2021 17:52:28
-------------------------------------------
[WARNING] For best speed performance, run with sudo privileges !
Number of logical cores available: 16
Number of PPCS 37
-------------------------------------------
SVT [config]: Profile [0] Level (auto)
SVT [config]: EncoderMode / Tune : 9 / 0
SVT [config]: EncoderBitDepth : 8
SVT [config]: SourceWidth / SourceHeight : 7680 / 3840
SVT [config]: Fps_Numerator / Fps_Denominator / Gop Size : 30 / 1 / 12
SVT [config]: HierarchicalLevels / BaseLayerSwitchMode / PredStructure : 3 / 0 / 2
SVT [config]: BRC Mode / QP : CQP / 32
-------------------------------------------
[libopus @ 0x557b89c365c0] No bit rate set. Defaulting to 96000 bps.
Output #0, webm, to 'test1.webm':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.45.100
Stream #0:0(und): Video: vp9 (libsvt_vp9), yuv420p(progressive), 7680x3840, q=10-48, 7000 kb/s, 30 fps, 1k tbn, 30 tbc (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
encoder : Lavc58.91.100 libsvt_vp9
Stream #0:1(eng): Audio: opus (libopus), 48000 Hz, stereo, flt, 96 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
encoder : Lavc58.91.100 libopus
Segmentation fault (core dumped) 1kB time=00:00:01.97 bitrate= 3.8kbits/s speed=0.156x
EC2 c5 server was used for this test with specs:
- Intel(R) Xeon(R) Platinum 8275CL CPU
- 16 CPU, 30 GB RAM
After around 60 frames, the error Segmentation fault (core dumped) appears and command exit. Could you please help on this issue? Thanks in advance!
Hi @hugo53 , could you provide more information:
- let's not complicate the problem by involving transcode. You can decode av1_video.mp4 to y4m first. Then run a svt-vp9 encode with it.
- If it still crash, could you try other 8k input? Does it crash also?
- Check memory consumption, is there a OOM(out of memory) error?
@tianjunwork Thanks for your help. I tried to decode another AV1 to y4m then encode that raw file to VP9 but still got the segmentation fault error.
# Convert to raw video
./ffmpeg -y -i av1_short_video.mp4 -pix_fmt yuv420p temp_raw_video.y4m
#Convert raw video to vp9
./ffmpeg -i temp_raw_video.y4m -c:v libsvt_vp9 -c:a libopus test1.webm
$ dmesg -e | less
[Mar23 06:45] ffmpeg[11430]: segfault at f ip 00007f2b613bf816 sp 00007f28ddc99c40 error 6 in libSvtVp9Enc.so.1[7f2b613a9000+13f000]
[ +0.000007] Code: 00 48 8b 34 f7 01 ca 49 8b 8e e0 02 00 00 48 63 d2 48 8b 14 d1 49 63 8e f4 02 00 00 48 8d 0c 49 48 c1 e1 02 44 0f b6 4c 0e 10 <44> 88 4c 0a 10 44 8b 58 2c 45 85 db 74 3e 0f b6 06 88 02 0f b6 46
Memory consumption increased much from 300 MB to 8 GB at frame 51 then crashed.
I also made a screen record video, I hope it may help something https://drive.google.com/file/d/1gMxouos4OWL039xs12e4K_9uXc5_gzo7/view?usp=sharing.
Hi @hugo53 , thanks for the info. I will look into the crash.
@tianjunwork I also tried to convert raw YUV (from here http://ultravideo.fi/#testsequences) to VP9 but got error Too many invisible frames. Should I create another issue for this?
$ ./ffmpeg -s 3840x2160 -f rawvideo -i Bosphorus_3840x2160_120fps_420_10bit_YUV.yuv -rc 0 -c:v libsvt_vp9 -vframes 250 -g 32 -tune 1 -qp 45 -y rc0.ivf
ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --enable-libsvtvp9 --enable-libopus --enable-libaom --enable-libvpx
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
[rawvideo @ 0x55597aed8980] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'Bosphorus_3840x2160_120fps_420_10bit_YUV.yuv':
Duration: 00:00:48.00, start: 0.000000, bitrate: 2488320 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 3840x2160, 2488320 kb/s, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> vp9 (libsvt_vp9))
Press [q] to stop, [?] for help
-------------------------------------------
SVT [version] : SVT-VP9 Encoder Lib v0.3.0
SVT [build] : GCC 7.5.0 64 bit
LIB Build date: Mar 22 2021 17:52:28
-------------------------------------------
[WARNING] For best speed performance, run with sudo privileges !
Number of logical cores available: 16
Number of PPCS 31
-------------------------------------------
SVT [config]: Profile [0] Level (auto)
SVT [config]: EncoderMode / Tune : 9 / 1
SVT [config]: EncoderBitDepth : 8
SVT [config]: SourceWidth / SourceHeight : 3840 / 2160
SVT [config]: Fps_Numerator / Fps_Denominator / Gop Size : 25 / 1 / 32
SVT [config]: HierarchicalLevels / BaseLayerSwitchMode / PredStructure : 4 / 0 / 2
SVT [config]: BRC Mode / QP : CQP / 45
-------------------------------------------
Output #0, ivf, to 'rc0.ivf':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: vp9 (libsvt_vp9) (VP90 / 0x30395056), yuv420p, 3840x2160, q=10-48, 7000 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc58.91.100 libsvt_vp9
[vp9_superframe @ 0x5559be003500] Too many invisible frames6 bitrate=N/A speed=N/A
[ivf @ 0x55597aee4d00] Error applying bitstream filters to an output packet for stream #0: Invalid data found when processing input
av_interleaved_write_frame(): Invalid data found when processing input
frame= 96 fps=6.6 q=-0.0 Lsize= 2930kB time=-00:00:00.56 bitrate=N/A speed=N/A
video:20256kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
munmap_chunk(): invalid pointer
Aborted (core dumped)
Hi @hugo53 , could you use other output format? This issue is fixed in https://github.com/OpenVisualCloud/SVT-VP9/issues/84.
Hi @hugo53 , do you mind if you could try running sample app with your parameters? E.g. ./Bin/Debug/SvtVp9EncApp -w 7680 -h 3840 -i ../../../../yuv/7680x3840_420_5.yuv -fps 30 -n 100 -tune 0 -q 32 -b 8k.bin. I saw different behavior on my side. There is no seg fault but number of memory allocation exceeding the max(https://github.com/OpenVisualCloud/SVT-VP9/blob/master/Source/Lib/Codec/EbDefinitions.h#L497). The encoder fails to init.
@tianjunwork Yes I got the same with SvtVp9EncApp. Please check log below.
SVT-VP9/Bin/Release$ ./SvtVp9EncApp -w 3840 -h 2160 -i ~/svt/Bosphorus_3840x2160_120fps_420_10bit_YUV.yuv -fps 30 -n 100 -tune 0 -q 32 -b 4k.bin
-------------------------------------------
SVT [version] : SVT-VP9 Encoder Lib v0.3.0
SVT [build] : GCC 7.5.0 64 bit
LIB Build date: Mar 22 2021 17:52:28
-------------------------------------------
[WARNING] For best speed performance, run with sudo privileges !
Number of logical cores available: 16
Number of PPCS 37
-------------------------------------------
SVT [config]: Profile [0] Level (auto)
SVT [config]: EncoderMode / Tune : 9 / 0
SVT [config]: EncoderBitDepth : 8
SVT [config]: SourceWidth / SourceHeight : 3840 / 2160
SVT [config]: FrameRate / Gop Size : 30 / 33
SVT [config]: HierarchicalLevels / BaseLayerSwitchMode / PredStructure : 3 / 0 / 2
SVT [config]: BRC Mode / QP : CQP / 32
-------------------------------------------
Encoding 100
SUMMARY --------------------------------- Channel 1 --------------------------------
Total Frames Frame Rate Byte Count Bitrate
100 30.00 fps 269681716 647236.12 kbps
Channel 1
Average Speed: 4.91 fps
Total Encoding Time: 20351 ms
Total Execution Time: 21161 ms
Average Latency: 9402 ms
Max Latency: 13674 ms
munmap_chunk(): invalid pointer
Aborted (core dumped)
hi @hugo53 , though I also saw munmap_chunk(): invalid pointer in 4k encoding, I think you were reporting 8k encoding issue?? Please try 8k also on your side.
Hi @hugo53 , I recorded the crash of 4k at https://github.com/OpenVisualCloud/SVT-VP9/issues/143. Thanks.
@tianjunwork I did again with 8K video, but I got Segmentation fault again. Please check below log.
~/svt$ sudo ./SvtVp9EncApp -w 7680 -h 3840 -i ~/svt/h264-8k-10sec-yuv.yuv -fps 30 -n 100 -tune 0 -q 32 -b 8k.bin
-------------------------------------------
SVT [version] : SVT-VP9 Encoder Lib v0.3.0
SVT [build] : GCC 7.5.0 64 bit
LIB Build date: Mar 22 2021 16:09:59
-------------------------------------------
Number of logical cores available: 16
Number of PPCS 37
-------------------------------------------
SVT [config]: Profile [0] Level (auto)
SVT [config]: EncoderMode / Tune : 9 / 0
SVT [config]: EncoderBitDepth : 8
SVT [config]: SourceWidth / SourceHeight : 7680 / 3840
SVT [config]: FrameRate / Gop Size : 30 / 33
SVT [config]: HierarchicalLevels / BaseLayerSwitchMode / PredStructure : 3 / 0 / 2
SVT [config]: BRC Mode / QP : CQP / 32
-------------------------------------------
Encoding 1Segmentation fault
$ gdb ./SvtVp9EncApp
Encoding 1
Thread 105 "SvtVp9EncApp" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffd75561700 (LWP 2519)]
0x00005555556294eb in eb_vp9_mode_decision_sb ()
Hi @hugo53 , we could continue discuss in this page since it includes more info. Thanks providing the backtrace in #144(But I saw a different one on my side, hence needed clarification). Could you close 144? We will use this one to track this bug. In general, SVT-VP9 is in maintenance, we will only fix bugs. No new feature is supported. There is no hard limitation on input resolution. 8k should be processed. But apparently, there are bugs. We will look into it. Thanks reporting.
@tianjunwork I closed the issue #144. I tried to test with 4K, 5K and 8K video but only 4K work, both 5K and 8K produce Segmentation fault error.