Opened 3 years ago

Last modified 3 years ago

#9054 new defect

low qsv encode performance

Reported by: dandenson Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: wenbin.chen@intel.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
using this command, or variations with hevc_qsv, with or without -hwaccel qsv, video errors and segfaults and lower than expected performance.

ffmpeg -hwaccel qsv -i
http://hdhomerun:5004/auto/v2.1 -c:v hevc_qsv -c:a aac -b:a 64k
-profile:v main -global_quality 30 -g 48 -keyint_min 48 -sc_threshold
0 -hls_time 2 -hls_list_size 8 -hls_segment_type mpegts -cc_stream_map
"ccgroup:cc,instreamid:CC1,language:en" -hls_flags delete_segments
-hls_segment_filename 720p_%03d.ts 720p.m3u8

CPU is i3-10100 which is able to handle at least 14 full h.264 transcodes, likely more. I am only able to encode 2 hevc streams and those streams segfault frequently. If I introduce a 3rd stream, all 3 encoders struggle and will segfault within a few minutes. They also don't produce real-time results.

My expectation based on single file testing and other software packages is that I should be able to handle 4 hevc encodes at 30fps using qsv, I'm only getting 2 and those are having substantial issues.

Here is the output of ffmpeg when running the above script. This was cancelled after the third ts file what written:

ffmpeg version 4.3.1-4ubuntu1 Copyright (c) 2000-2020 the FFmpeg developers

built with gcc 10 (Ubuntu 10.2.0-9ubuntu2)
configuration: --prefix=/usr --extra-version=4ubuntu1

--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
--disable-stripping --enable-avresample --disable-filter=resample
--enable-gnutls --enable-ladspa --enable-libaom --enable-libass
--enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio
--enable-libcodec2 --enable-libdav1d --enable-libflite
--enable-libfontconfig --enable-libfreetype --enable-libfribidi
--enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame
--enable-libmysofa --enable-libopenjpeg --enable-libopenmpt
--enable-libopus --enable-libpulse --enable-librabbitmq
--enable-librsvg --enable-librubberband --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt
--enable-libssh --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2
--enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2
--enable-omx --enable-openal --enable-opencl --enable-opengl
--enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394
--enable-libdrm --enable-libiec61883 --enable-nvenc
--enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared

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
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100

[mpeg2video @ 0x55bd8aece580] Invalid frame dimensions 0x0.

Last message repeated 18 times

Input #0, mpegts, from 'http://10.39.40.173:5004/auto/v2.1':

Duration: N/A, start: 47689.440967, bitrate: N/A
Program 1

Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] /

0x0002), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9],
Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc

Side data:

cpb: bitrate max/min/avg: 80000000/0/0 buffer size: 9781248 vbv_delay: N/A

Stream #0:1[0x34](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,

stereo, fltp, 192 kb/s

Stream #0:2[0x35](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,

stereo, fltp, 96 kb/s
Stream mapping:

Stream #0:0 -> #0:0 (mpeg2video (native) -> hevc (hevc_qsv))
Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))

Press [q] to stop, ? for help
Output #0, hls, to '720p.m3u8':

Metadata:

encoder : Lavf58.45.100
Stream #0:0: Video: hevc (hevc_qsv), nv12, 1920x1080 [SAR 1:1 DAR

16:9], q=2-31, 1000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc

Metadata:

encoder : Lavc58.91.100 hevc_qsv

Side data:

cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A

Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp, 64 kb/s
Metadata:

encoder : Lavc58.91.100 aac

[hls @ 0x55bd8aee7940] Opening '720p_000.ts' for writingrate=N/A
dup=29 drop=0 speed=2.59x
[hls @ 0x55bd8aee7940] Opening '720p.m3u8.tmp' for writing
[hls @ 0x55bd8aee7940] Opening '720p_001.ts' for writingrate=N/A
dup=29 drop=0 speed=2.35x
[hls @ 0x55bd8aee7940] Opening '720p.m3u8.tmp' for writing
[hls @ 0x55bd8aee7940] Opening '720p_002.ts' for writingrate=N/A
dup=29 drop=0 speed=2.24x
[hls @ 0x55bd8aee7940] Opening '720p.m3u8.tmp' for writing
[hls @ 0x55bd8aee7940] Opening '720p_003.ts' for writing
[hls @ 0x55bd8aee7940] Opening '720p.m3u8.tmp' for writing
frame= 194 fps= 62 q=-0.0 Lsize=N/A time=00:00:06.30 bitrate=N/A
dup=29 drop=0 speed=2.01x
video:8928kB audio:49kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown
[aac @ 0x55bd8aef87c0] Qavg: 149.014
Exiting normally, received signal 2.

I'm also seeing numerous mpeg2 and ac3 error in ffmpeg that other players don't see. They end up showing in the output video as errors in audio and video
[mpegts @ 0x564b2a15a340] Packet corrupt (stream = 0, dts = 1078791167).drop=0 speed=1.02x
[mpeg2video @ 0x564b2a187e40] ac-tex damaged at 10 10
[mpeg2video @ 0x564b2a187e40] ac-tex damaged at 11 6
[mpeg2video @ 0x564b2a187e40] ac-tex damaged at 11 9
[mpeg2video @ 0x564b2a187e40] Invalid mb type in P-frame at 16 31
[mpeg2video @ 0x564b2a187e40] ac-tex damaged at 11 3
[mpeg2video @ 0x564b2a187e40] ac-tex damaged at 48 4
[mpeg2video @ 0x564b2a187e40] Warning MVs not available
[mpeg2video @ 0x564b2a187e40] concealing 2413 DC, 2413 AC, 2413 MV errors in P frame
[mpegts @ 0x564b2a15a340] PES packet size mismatch
[mpegts @ 0x564b2a15a340] Packet corrupt (stream = 1, dts = 1078742391).
[ac3 @ 0x564b2a1c8e40] exponent -1 is out-of-range
[ac3 @ 0x564b2a1c8e40] error decoding the audio block
Error while decoding stream #0:1: Error number -16976906 occurred

I cannot tell if this is due to support for 10th gen intel chips or library issues on this Ubuntu 20.10 system. I updated from 20.04 to 20.10 hoping for updated support for qsv, these issues exist in 20.04 and 20.10.

My goal is to have a continuously running ffmpeg instance transcoding MPEG2 to hevc/HLS but the output video is so flawed its difficult to watch and the segfaults are a show stopper.

I have this system ready and waiting to run more tests if needed.

Thank you.

Change History (2)

comment:1 by wenbin,chen, 3 years ago

Can you try to encode with "-c:v libx265" rather than hevc_qsv, because according to the log you list above, it is seems to be the problem from decoder "mpeg2video".

I don't have your source video so I cannot reproduce this error, but I tried to transcode a local video using your cmd and it works fine.

comment:2 by wenbin,chen, 3 years ago

Cc: wenbin.chen@intel.com added
Note: See TracTickets for help on using tickets.