jetson-ffmpeg icon indicating copy to clipboard operation
jetson-ffmpeg copied to clipboard

Assertion failed when decoding+encoding h265

Open rhpk opened this issue 4 years ago • 3 comments

Hi, I'm trying to decode/encode with ffmpeg, here is my command line:

ffmpeg/jetson-ffmpeg/ffmpeg/ffmpeg -c:v hevc_nvmpi -i swiv.mkv -preset slow -c:v hevc_nvmpi -b:v 9000k -c:a copy swiv_enctest2.mp4

I get:

Assertion ((src_linesize) >= 0 ? (src_linesize) : (-(src_linesize))) >= bytewidth failed at libavutil/imgutils.c:314

Using software decoding, it works fine, thought CPU is 100% and I can only encode at 8.5 fps:

ffmpeg/jetson-ffmpeg/ffmpeg/ffmpeg -i swiv.mkv -preset slow -c:v hevc_nvmpi -b:v 9000k -c:a copy swiv_enctest2.mp4

Thanks for your help.

rhpk avatar Dec 12 '20 16:12 rhpk

I tried to play a bit with patched ffmpeg and here's what I get. Basically, src_linesize < bytewidth which makes the assertion fail. This is, of course ffmpeg 4.2.

image_copy_plane ------------------------------------------------------------------------------------- src_linesize = 3840 dst_linesize = 7680 bytewidth = 7680

rhpk avatar Dec 14 '20 08:12 rhpk

I did a bit of debugging with gdb and the issue boils down to nvmpi_decode() function. When nvmpi_decoder_get_frame() is called, the _nvframe.linesize[0] gets filled with 3840 instead of 7680. Maybe I'm doing something wrong with ffmpeg command line which is fooling the hardware decoder around.

rhpk avatar Dec 22 '20 10:12 rhpk

-c:v hevc_nvmpi should be to the right of the source file...

syadnom avatar Jan 05 '21 17:01 syadnom