nyanmisaka / ffmpeg-rockchip

FFmpeg with async and zero-copy Rockchip MPP & RGA support
Other
325 stars 47 forks source link

segfault with h,264 encode #65

Closed david3a closed 2 months ago

david3a commented 2 months ago

tried the following, logging turned on after seeing seg fault

./ffmpeg -loglevel debug -f lavfi -i testsrc2=s=1920x1080,format=nv12 -c:v h264_rkmpp -b:v 4M -profile:v high -level 4.1 -g:v 100 -vframes 5000 -y tmp.mp4

gets this, any ideas?

ffmpeg version a3239ac0c2 Copyright (c) 2000-2024 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) configuration: --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga libavutil 59. 8.100 / 59. 8.100 libavcodec 61. 3.100 / 61. 3.100 libavformat 61. 1.100 / 61. 1.100 libavdevice 61. 1.100 / 61. 1.100 libavfilter 10. 1.100 / 10. 1.100 libswscale 8. 1.100 / 8. 1.100 libswresample 5. 1.100 / 5. 1.100 libpostproc 58. 1.100 / 58. 1.100 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-f' ... matched as option 'f' (force container format (auto-detected otherwise)) with argument 'lavfi'. Reading option '-i' ... matched as input url with argument 'testsrc2=s=1920x1080,format=nv12'. Reading option '-c:v' ... matched as option 'c' (select encoder/decoder ('copy' to copy stream without reencoding)) with argument 'h264_rkmpp'. Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '4M'. Reading option '-profile:v' ... matched as option 'profile' (set profile) with argument 'high'. Reading option '-level' ... matched as AVOption 'level' with argument '4.1'. Reading option '-g:v' ... matched as AVOption 'g:v' with argument '100'. Reading option '-vframes' ... matched as option 'vframes' (set the number of video frames to output) with argument '5000'. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option 'tmp.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument debug. Applying option y (overwrite output files) with argument 1. Successfully parsed a group of options. Parsing a group of options: input url testsrc2=s=1920x1080,format=nv12. Applying option f (force container format (auto-detected otherwise)) with argument lavfi. Successfully parsed a group of options. Opening an input file: testsrc2=s=1920x1080,format=nv12. [AVFilterGraph @ 0x55977eda60] Setting 's' to value '1920x1080' [AVFilterGraph @ 0x55977eda60] Setting 'pix_fmts' to value 'nv12' detected 8 logical cores [Parsed_testsrc2_0 @ 0x55977eec20] size:1920x1080 rate:25/1 duration:-1.000000 sar:1/1 [AVFilterGraph @ 0x55977eda60] query_formats: 3 queried, 6 merged, 0 already done, 0 delayed [lavfi @ 0x55977ed4a0] All info found Input #0, lavfi, from 'testsrc2=s=1920x1080,format=nv12': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0, 1, 1/25: Video: wrapped_avframe, 1 reference frame, nv12, 1920x1080 [SAR 1:1 DAR 16:9], 0/1, 25 fps, 25 tbr, 25 tbn Successfully opened the file. Parsing a group of options: output url tmp.mp4. Applying option c:v (select encoder/decoder ('copy' to copy stream without reencoding)) with argument h264_rkmpp. Applying option b:v (video bitrate (please use -b:v)) with argument 4M. Applying option profile:v (set profile) with argument high. Applying option vframes (set the number of video frames to output) with argument 5000. Successfully parsed a group of options. Opening an output file: tmp.mp4. [out#0/mp4 @ 0x55977f1810] No explicit maps, mapping streams automatically... [vost#0:0/h264_rkmpp @ 0x55977f2110] Created video stream from input stream 0:0 [file @ 0x55977f4cc0] Setting default whitelist 'file,crypto,data' Successfully opened the file. Stream mapping: Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (h264_rkmpp)) [vost#0:0/h264_rkmpp @ 0x55977f2110] Starting thread... [vf#0:0 @ 0x55977f2900] Starting thread... [vist#0:0/wrapped_avframe @ 0x55977f1620] [dec:wrapped_avframe @ 0x55977f36b0] Starting thread... [in#0/lavfi @ 0x55977cb8e0] Starting thread... Press [q] to stop, [?] for help [graph 0 input from stream 0:0 @ 0x7fa40023b0] Setting 'video_size' to value '1920x1080' [graph 0 input from stream 0:0 @ 0x7fa40023b0] Setting 'pix_fmt' to value '23' [graph 0 input from stream 0:0 @ 0x7fa40023b0] Setting 'time_base' to value '1/25' [graph 0 input from stream 0:0 @ 0x7fa40023b0] Setting 'pixel_aspect' to value '1/1' [graph 0 input from stream 0:0 @ 0x7fa40023b0] Setting 'colorspace' to value '2' [graph 0 input from stream 0:0 @ 0x7fa40023b0] Setting 'range' to value '0' [graph 0 input from stream 0:0 @ 0x7fa40023b0] Setting 'frame_rate' to value '25/1' [graph 0 input from stream 0:0 @ 0x7fa40023b0] w:1920 h:1080 pixfmt:nv12 tb:1/25 fr:25/1 sar:1/1 csp:unknown range:unknown [format @ 0x7fa4002d90] Setting 'pix_fmts' to value 'gray|yuv420p|yuv422p|yuv444p|nv12|nv21|nv16|nv24|yuyv422|yvyu422|uyvy422|rgb24|bgr24|rgba|rgb0|bgra|bgr0|argb|0rgb|abgr|0bgr|drm_prime' [AVFilterGraph @ 0x7fa4000f90] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed [graph 0 input from stream 0:0 @ 0x7fa40023b0] video frame properties congruent with link at pts_time: 0 [h264_rkmpp @ 0x55977ef720] Rate Control mode is set to CBR [h264_rkmpp @ 0x55977ef720] Bitrate Target/Min/Max is set to 4000000/3750000/4250000 [h264_rkmpp @ 0x55977ef720] QP Init/Max/Min/Max_I/Min_I is set to 26/48/0/48/0 [h264_rkmpp @ 0x55977ef720] Profile is set to HIGH [h264_rkmpp @ 0x55977ef720] 8x8 Transform is enabled [h264_rkmpp @ 0x55977ef720] Level is set to 41 [h264_rkmpp @ 0x55977ef720] Coder is set to CABAC [h264_rkmpp @ 0x55977ef720] Created a RKMPP hardware device ./test-rk-h264-encode.sh: line 1: 104812 Segmentation fault (core dumped) ./ffmpeg_g -loglevel debug -f lavfi -i testsrc2=s=1920x1080,format=nv12 -c:v h264_rkmpp -b:v 4M -profile:v high -level 4.1 -g:v 100 -vframes 5000 -y tmp.mp4

nyanmisaka commented 2 months ago

@david3a Please build install the latest MPP runtime and try again.

https://github.com/nyanmisaka/ffmpeg-rockchip/wiki/Compilation#important

Important

Make sure you have built and installed the latest MPP runtime and headers. Otherwise undefined behavior may occur, such as segmentation fault. Be careful if you use MPP deb packages from a vendor/BSP image, these packages are likely to be out of date.

david3a commented 2 months ago

looks better, though I had done that, is had to change

make install

to

sudo make install

nyanmisaka commented 2 months ago

Any other issues after running with sudo?

david3a commented 2 months ago

Not yet!

From: Nyanmisaka @.> Sent: Tuesday, April 30, 2024 8:28 AM To: nyanmisaka/ffmpeg-rockchip @.> Cc: david Atkins @.>; Mention @.> Subject: Re: [nyanmisaka/ffmpeg-rockchip] segfault with h,264 encode (Issue #65)

Any other issues after running with sudo?

— Reply to this email directly, view it on GitHubhttps://github.com/nyanmisaka/ffmpeg-rockchip/issues/65#issuecomment-2084584413, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALXYWDAUFSTBK3Y4GQERFGDY75BYDAVCNFSM6AAAAABG7UNTJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBUGU4DINBRGM. You are receiving this because you were mentioned.Message ID: @.**@.>>