OpenVisualCloud / SVT-HEVC

SVT HEVC encoder. Scalable Video Technology (SVT) is a software-based video coding technology that is highly optimized for Intel® Xeon® processors. Using the open source SVT-HEVC encoder, it is possible to spread video encoding processing across multiple Intel® Xeon® processors to achieve a real advantage of processing efficiency.
Other
519 stars 169 forks source link

SVT-HEVC transcode with ffmpeg plugin hangs after completion of transcode #463

Closed MayuraRam closed 4 years ago

MayuraRam commented 4 years ago

This occurs on a ROME system (2S Rome - 7742 cores - 128 ). The code is being called in a container (OS - ubuntu 18.04)

Command line being used: -i /var/www/archive/CSGO_SVT-HEVC.mp4 -c:v libsvt_hevc -rc 1 -preset 4 -b:v 4.4M -maxrate 4.4M -bufsize 8.8M -r 60 -g 120 1080P.mp4

Tried again after removing the “-g 120” (set GOP size) option from your command line

(In gdb console) set args -i /var/www/archive/CSGO_SVT-HEVC.mp4 -c:v libsvt_hevc -rc 1 -preset 4 -b:v 4.4M -maxrate 4.4M -bufsize 8.8M -r 60 1080P.mp4

Here's the output:

0x00007ffff4b9e6d6 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, 
    futex_word=0x555598db4590) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
205        ../sysdeps/unix/sysv/linux/futex-internal.h: No such file or directory.
(gdb) bt
#0  0x00007ffff4b9e6d6 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, 
    futex_word=0x555598db4590) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x555598db4590, abstime=0x0) at sem_waitcommon.c:111
#2  0x00007ffff4b9e7c8 in __new_sem_wait_slow (sem=0x555598db4590, abstime=0x0)
    at sem_waitcommon.c:181
#3  0x00007ffff2211ae9 in EbBlockOnSemaphore () from /usr/lib/x86_64-linux-gnu/libSvtHevcEnc.so.1
#4  0x00007ffff22117c3 in EbGetEmptyObject () from /usr/lib/x86_64-linux-gnu/libSvtHevcEnc.so.1
#5  0x00007ffff21cf3d6 in EbDeinitEncoder () from /usr/lib/x86_64-linux-gnu/libSvtHevcEnc.so.1
#6  0x00007ffff5bb2511 in eb_enc_close () from /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#7  0x00007ffff5bd07ba in avcodec_close () from /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#8  0x00007ffff60b9a39 in avcodec_free_context () from /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#9  0x000055555557d252 in ffmpeg_cleanup ()
#10 0x000055555556ead1 in exit_program ()
#11 0x000055555555fe0d in main ()

Unable to include the input video file.

1480c1 commented 4 years ago

Please use triple backticks (```) to block off the console output

```
Thread 1 "ffmpeg" received signal SIGINT, Interrupt.
```

It prevents github from formatting the output and create links to other issues like #1

Austin-Hu commented 4 years ago

Hi @CACUser ,

Please try whether PR #475 could fix the hang issue or not. If not, could you also paste other output logs besides of the hanging stack? And please help upload CSGO_SVT-HEVC.mp4 to some public places (cloud?) where we can access to. Thanks!

tianjunwork commented 4 years ago

Hi @CACUser , I wonder if you could try out our latest code on master. Or you could share the file so that we can try to reproduce.

Austin-Hu commented 4 years ago

Hi @CACUser ,

I didn't reproduce the ffmpeg hang issue after completing transcoding, with either of the 2 commands below:

    ./ffmpeg -i CSGO_SVT-HEVC.mp4 -c:v libsvt_hevc -rc 1 -preset 4 -b:v 4.4M -maxrate 4.4M -bufsize 8.8M -r 60 -g 120 -y 1080P.mp4
    ./ffmpeg -i ToS_2160p_59.94fps_2min.mp4 -c:v libsvt_hevc -rc 1  -preset 5 -b:v 9.6M -maxrate 9.6M -bufsize 19.2M -y -r 60 -g 60 -sc_detection 0 4k.mp4

But, I reproduced another random hang issue during transcoding with the 2nd command above. We will track it as well with more symptons, and you can also double check in your side. If you still have the hang issue after completing transcoding, please help create an account so we can remotely debug on your ROME system.

BTW, I'm using the latest commit of master branch, and the v4.2 branch of ffmpeg plus SVT-HEVC plugin. Thanks!

tianjunwork commented 4 years ago

Hi @CACUser , we couldn't reproduce hang(500 runs) after completion of transcode with ffmpeg 4.2 and SVT-HEVC master. But we did observe encoding random hang which is recorded in #498. Pls help verify. If we are on the same page, could you close this issue?

MayuraRam commented 4 years ago

I have observed the same with latest from master. Will close this issue.

oviano commented 4 years ago

I am able to reliably get what I think is the same issue described in this thread i.e. the encoder hanging on EbDeinitEncoder. I achieve this by attempting a real-time encode on hardware that cannot quite cope with it, so it maxes out at 100% cpu. When I attempt to close the encoder, it hangs.

I'm linking directly to the FFmpeg libraries, and I have callstack as far as the call into EbDeinitEncoder:

avcodecd.dll!eb_enc_close(AVCodecContext * avctx) Line 451 C avcodecd.dll!avcodec_close(AVCodecContext * avctx) Line 1117 C avcodecd.dll!avcodec_free_context(AVCodecContext * * pavctx) Line 180 C emu-server.exe!ovav::VIDEO_SERVER_TRANSCODER::thread_clean_up() Line 446 C++ emu-server.exe!ovcore::THREAD_BASE::thread_func() Line 219 C++ �

This is with 1.4.3 so I guess I will try and see if this happens with the latest master code.

oviano commented 4 years ago

Ok, I think the issue I am getting might be a different one, so I've opened new issue here:

https://github.com/OpenVisualCloud/SVT-HEVC/issues/535