hbiyik / ffmpeg Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ffmpeg/ffmpeg
PLEASE USE https://github.com/nyanmisaka/ffmpeg-rockchip REPO INSTEAD.
Home Page: https://github.com/nyanmisaka/ffmpeg-rockchip
License: Other
This project forked from ffmpeg/ffmpeg
PLEASE USE https://github.com/nyanmisaka/ffmpeg-rockchip REPO INSTEAD.
Home Page: https://github.com/nyanmisaka/ffmpeg-rockchip
License: Other
I followed the instructions to compile ffmpeg with rockchip libarary.
But when tried transcode a video such as
sudo ffmpeg -i 428cut.mp4 -c:v h264 out.mp4
the process is hanging up, I did not see any cpu loading for this process. It seems to wait for
a key input, but when I press any key, it did not have any reaction, enven for q.
what is the problem?
ffmpeg version e243e8d Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --enable-rkmpp --enable-version3 --enable-libdrm --logfile=log
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5562f15330] st: 0 edit list: 1 Missing key frame while searching for timestamp: 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '428cut.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.16.100
Duration: 00:01:20.00, start: 0.000000, bitrate: 575 kb/s
Stream #0:00x1: Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, 573 kb/s, 25.03 fps, 25 tbr, 90k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
File 'out.mp4' already exists. Overwrite? [y/N] y
[h264_rkmpp_decoder @ 0x5562f1a720] Picture format is nv12.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_rkmpp_decoder) -> h264 (h264_rkmpp_encoder))
Press [q] to stop, [?] for help
to use p010/yuv420p10 10bit formats you need this fix in the vendor kernel and this fix in rgamulti
compile with --enable-shared
additional to the description in wiki
manipulate the LD_LIBRARY_PATH
to point the .so files from the build folder
ie:
export PATH="/home/alarm/extusb/ffmpeg:$PATH"
export LD_LIBRARY_PATH="/home/alarm/extusb/ffmpeg/libavcodec:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/alarm/extusb/ffmpeg/libavdevice:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/alarm/extusb/ffmpeg/libavfilter:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/alarm/extusb/ffmpeg/libavformat:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/alarm/extusb/ffmpeg/libavutil:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/alarm/extusb/ffmpeg/libpostproc:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/alarm/extusb/ffmpeg/libswresample:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/alarm/extusb/ffmpeg/libswscale:$LD_LIBRARY_PATH"
use a sscript like above where it points to your build/install folder, save it to setpath.sh
, then execute source setpath.sh
. Now your which is spawned from this environment (cli), will use the new ffmpeg
run kodi with:
kodi.bin --windowing=gbm --audio-backend=alsa
make sure you select
settings->player->videos->render method
Allow using DRM PRIME Decoder=enable
Allow Hardware Acceleation with DRM PRIME=enable
Prime Render Method=EGL
IMPORTANT: Make sure your audio is working, otherwise playback will stop after several seconds due to unsynchronized picture and sound.
mpv --hwdec=rkmpp pathtofile
From 504b2de386bffc0746c243b5f937fb0c5b7c4447 Mon Sep 17 00:00:00 2001
From: hbiyik <[email protected]>
Date: Thu, 28 Sep 2023 22:25:25 +0200
Subject: [PATCH 1/2] hwdec_drmprime: add nv16 support
NV16 is the half subsampled version of NV12 format. Decoders which
support High 4:2:2 of h264 provide the frame in NV16 format to establish
richer colorspace. Similar profiles are also available in HEVC and other
popular codecs. This commit allows NV16 frames to be displayed over
drmprime layers.
Signed-off-by: hbiyik <[email protected]>
---
video/out/hwdec/dmabuf_interop_gl.c | 1 +
video/out/hwdec/hwdec_drmprime.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/video/out/hwdec/dmabuf_interop_gl.c b/video/out/hwdec/dmabuf_interop_gl.c
index bd33474289..e7fb1031a0 100644
--- a/video/out/hwdec/dmabuf_interop_gl.c
+++ b/video/out/hwdec/dmabuf_interop_gl.c
@@ -176,6 +176,7 @@ static bool vaapi_gl_map(struct ra_hwdec_mapper *mapper,
if (p_mapper->desc.layers[i].nb_planes > 1) {
switch (p_mapper->desc.layers[i].format) {
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV16:
format[0] = DRM_FORMAT_R8;
format[1] = DRM_FORMAT_GR88;
break;
diff --git a/video/out/hwdec/hwdec_drmprime.c b/video/out/hwdec/hwdec_drmprime.c
index 5051207413..290f11c535 100644
--- a/video/out/hwdec/hwdec_drmprime.c
+++ b/video/out/hwdec/hwdec_drmprime.c
@@ -29,6 +29,7 @@
#include "libmpv/render_gl.h"
#include "options/m_config.h"
+#include "video/fmt-conversion.h"
#include "video/out/drm_common.h"
#include "video/out/gpu/hwdec.h"
#include "video/out/hwdec/dmabuf_interop.h"
@@ -117,6 +118,7 @@ static int init(struct ra_hwdec *hw)
int num_formats = 0;
MP_TARRAY_APPEND(p, p->formats, num_formats, IMGFMT_NV12);
MP_TARRAY_APPEND(p, p->formats, num_formats, IMGFMT_420P);
+ MP_TARRAY_APPEND(p, p->formats, num_formats, pixfmt2imgfmt(AV_PIX_FMT_NV16));
MP_TARRAY_APPEND(p, p->formats, num_formats, 0); // terminate it
p->hwctx.hw_imgfmt = IMGFMT_DRMPRIME;
--
2.42.0
From 76a34a8f31fd69094adef09c4b2146da7a842a10 Mon Sep 17 00:00:00 2001
From: boogie <[email protected]>
Date: Wed, 1 Nov 2023 20:35:19 +0100
Subject: [PATCH 2/2] hwdec_drmprime: add p010 support
Removes the limitation that P010 DRMPrime Avframes were filtered out
Signed-off-by: hbiyik <[email protected]>
---
video/out/hwdec/hwdec_drmprime.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/video/out/hwdec/hwdec_drmprime.c b/video/out/hwdec/hwdec_drmprime.c
index 290f11c535..9c63ab49ff 100644
--- a/video/out/hwdec/hwdec_drmprime.c
+++ b/video/out/hwdec/hwdec_drmprime.c
@@ -119,6 +119,7 @@ static int init(struct ra_hwdec *hw)
MP_TARRAY_APPEND(p, p->formats, num_formats, IMGFMT_NV12);
MP_TARRAY_APPEND(p, p->formats, num_formats, IMGFMT_420P);
MP_TARRAY_APPEND(p, p->formats, num_formats, pixfmt2imgfmt(AV_PIX_FMT_NV16));
+ MP_TARRAY_APPEND(p, p->formats, num_formats, pixfmt2imgfmt(AV_PIX_FMT_P010));
MP_TARRAY_APPEND(p, p->formats, num_formats, 0); // terminate it
p->hwctx.hw_imgfmt = IMGFMT_DRMPRIME;
--
2.42.0
Hello thanks for your work
my system is ubuntu 20.04 with rockchip rk3588
and the main purpose is that decode or encode video with ffmpeg use hardwave
i clone your project and the branch is mpp-rga-ffmpeg-6
after that i run configure with parameters are list below
./configure --prefix=/usr/local/ --enable-shared --enable-version3 --enable-rkmpp --enable-libx264 --enable-gpl --enable-libdrm --enable-opencl --enable-nonfree
it's seems that code into deathloop and can not run out
can u please help me deal with that
My device is orangepi5 ,soc is rk3588s.
When I play some videos by mpv using --drm-drmprime-video-plane,it maybe display green. If don't use --drm-drmprime-video-plane,it display normal."I don't know what is causing it, can you explain or solve it?"
The test video website is:
https://www.bilibili.com/video/BV1nz4y1172Q?p=1
for encoder to reduce latency
could be some division rounding problem somewhere. needs inverstigation
easy to implement,
Hello,
Now I can transcode a video stream and save to a mkv file. The debug output shows it is using mpp decoder and encoder, and the cpu load is very low, everyting sounds good.
Howerver, when I change to use pipe, strange thing happened. The cpu load is 500%, and the output often remind me delays happened.
Here is the command I use to test
ffmpeg -loglevel info -i rtsp_url -pix_fmt bgr24 -f rawvideo pipe: > /dev/null
Here, I did not specify hevc codec, ffmpeg chose to use mpp hevc decoder, as can be seen in the debug output.
Howerver, if I used -codec hevc option, it chose to use cpu decoder, no mpp decoder shown in the debug output.
When the cpu decoder is used, the cpu load is only 300%, and no delay complains. What is wrong? Should not
mpp decoder be much faster than cpu decoder and the cpu load be very low?
happens with only yuv420p, yuv422p, bgr24 pixfmts, and when the decoder in used feeds in the soft avframes to rkmpp encoders
For a width 704 -> 784 pixel with 16 aligned hor stride, misaligns on the multipliers of 44,45,46,47,48 of 16.
Below is the visual output of an example
to reproduce
ffmpeg -t 1 -f lavfi -i testsrc=s=720x480,format=yuv420p -c:v h264_rkmpp_encoder -y out.mp4
or
to fix rgb24 cases, increasing the MPP hor or ver stride alignment from 16
to 64
fixes the issues, but this does not work for yuv420p and yuv422p.
Line 27 in d30c8c6
The interleaved or semiplanar or 4 plane rgbA/0 formats are not impacted by the issue
My guess is that MPP is handling all plane buffer as a continuous plane with common stride size, if there are planes multiples of 2 ie: 1,2,4 then, accessing the sub planes are also aligned, but if it is 3 then the size of the planes maz not be aligned (?). Internally, mpp or ffmpeg should be handling those cases differently, since ffmpeg holds a seperate buffer for each plane.
This is most likely related to plane calculation here:
Line 277 in d30c8c6
Line 391 in d30c8c6
a special case of dimensions of 705x480 crashes the encoder driver, this seems to be another problem with mpp.
see: rockchip-linux/mpp#424
Hi @hbiyik
Following discussion in https://aur.archlinux.org/packages/ffmpeg-mpp.
I have Orange Pi 5 Plus 8 Gb model. I've installed the following packages:
mesa-panfork-git
libva-mesa-driver-panfork-git
mesa-vdpau-panfork-git
mpp-git
I've also grabbed mali_csffw.bin
from elsewhere (debian package) and put it in /lib/firmware
.
My user is in video
group.
Now, I've built ffmpeg-mpp 2:6.0-7
and trying to watch some video on youtube. I'm running firefox like this:
MOZ_DISABLE_RDD_SANDBOX=1 firefox
I'm using wayland
and sway
. Xorg
is not even installed into the system. I'm running linux-aarch64-orangepi5
kernel (also from AUR).
The video plays, but there are the following errors in journalctl:
mpp[5232]: mpp_info: mpp version: e34f0dd1 author: Herman Chen 2023-07-17 [hal_vp8e]: Fix crash on unsupport input format
kernel: rga_mm: RGA_MMU unsupported Memory larger than 4G!
kernel: rga_mm: scheduler core[4] unsupported mm_flag[0x0]!
kernel: rga_mm: rga_mm_map_buffer iommu_map virtual address error!
kernel: rga_mm: job buffer map failed! kernel: rga_mm: dst channel map job buffer failed!
kernel: rga_mm: failed to map buffer
kernel: rga_job: rga_job_commit: failed to map job info
kernel: rga_job: request[6] task[0] job_commit failed.
kernel: rga_job: rga request commit failed!
kernel: rga: request[6] submit failed!
Attached is the output of pacman -Qsq
for your reference of packages I have installed. Observe that I have kodi-rpi
installed, which works fine overall - except that I'm looking forward to using kodi-matrix-mpp-git
- but that's not before I figure out the ffmpeg/firefox issue.
One more note. When starting, Firefox complains it can't enable VA-API because vaapitest fails (I can provide exact error message if needed). I tried running vainfo
and vdpauinfo
, but they seem to work only in X11 sessions (complain about missing DISPLAY etc).
Line 34 in e243e8d
ffplay -vcodec h264_rkmpp_decoder ~/VID_20230227_163234.mp4
ffplay version n6.0 Copyright (c) 2003-2023 the FFmpeg developers
built with gcc 12.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-librist --disable-vulkan --enable-rkmpp --host-cflags='"-fPIC"'
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
libpostproc 57. 1.100 / 57. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '~/VID_20230227_163234.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2023-02-27T08:32:43.000000Z
com.android.version: 12
com.android.manufacturer: Xiaomi
com.android.model: M2012K11AC
Duration: 00:00:07.47, start: 0.000000, bitrate: 49993 kb/s
Stream #0:0[0x1](eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/bt470bg/smpte170m, progressive), 3840x2160, 50412 kb/s, 30.03 fps, 30.03 tbr, 90k tbn (default)
Metadata:
creation_time : 2023-02-27T08:32:43.000000Z
handler_name : VideoHandle
vendor_id : [0][0][0][0]
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s (default)
Metadata:
creation_time : 2023-02-27T08:32:43.000000Z
handler_name : SoundHandle
vendor_id : [0][0][0][0]
[h264_rkmpp_decoder @ 0xffff60064750] Picture format is yuv420p.
[h264_rkmpp_decoder @ 0xffff60064750] Failed to initialize MPP context (code = -1).
[h264_rkmpp_decoder @ 0xffff60064750] Failed to initialize RKMPP Codec.
3.35 M-A: -0.000 fd= 0 aq= 39KB vq= 0KB sq= 0B f=0/0
10月 21 10:16:24 ARM mpp[38830]: vcodec_service: open vcodec_service (null) failed
10月 21 10:16:24 ARM mpp[38830]: hal_h264d_api: mpp_dev_init failed ret: -1
10月 21 10:16:24 ARM mpp[38830]: mpp_hal: mpp_hal_init hal h264d_rkdec init failed ret -1
10月 21 10:16:24 ARM mpp[38830]: mpp_hal: mpp_hal_init could not found coding type 7
10月 21 10:16:24 ARM mpp[38830]: mpp_dec: mpp_dec_init could not init hal
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp_time: mpp_clock_put invalid clock (nil)
10月 21 10:16:24 ARM mpp[38830]: mpp: error found on mpp initialization
10月 21 10:16:28 ARM ffplay[38830]: mpp_mem_pool: put_pool found 4 used buffer size 224
v4l2-ctl --list-devices
rockchip,rk3399-vpu-enc (platform:ff650000.video-codec):
/dev/video1
/dev/video2
/dev/media0
rockchip-rga (platform:rga):
/dev/video0
rkvdec (platform:rkvdec):
/dev/video3
/dev/media1
I followed the instructions,
1, compiled and installed mpp from git
2, compiled and installed libyuv from git
3, compiled and installed ffmpeg
but when I try to transcode a video, it showed error message :
[h264_rkmpp_decoder @ 0x55d029d760] Picture format is nv12. [h264_rkmpp_decoder @ 0x55d029d760] Failed to initialize MPP context (code = -1). [h264_rkmpp_decoder @ 0x55d029d760] Failed to initialize RKMPP Codec.
I tried mpp_info_test binary compiled from MPP source, it shows nothing. What is the problem?
Device: range pi5
Kernel: 5.10.160 legacy rk35xx
Rootfs: Armbian 23.8.3 bookworm
Refer to the wiki tutorial, but libyuv
compiles ffmpeg
using libyuv-dev
.
My program uses the ffmpeg API, OpenCV API, pulls RTSP streams, and AVFrame is converted to cv:: Mat for display using cv:: imshow(). After about half a minute of normal display, the screen begins to blur, and the terminal prompts an error: [rtsp @ xxxxx] RTP: PT=60: bad cseq xxxx
.
Supplement: If I compile the official ffmpeg repository, the above issue will not occur, but I need the hardware decoding capability of RK35xx. There is no problem with the RTSP stream. I played it using the VLC player and everything was fine.
Need help: Can you give me some advice on how to fix the splash screen issue
details:
#14 (comment)
deadlock somehwere, but where?
not happening with every player
同一份业务代码,(ffmpeg库不同) 在ubuntu-x64平台下运行正常. 可正确获得pts. 均无此类情况.
av_frame_get_best_effort_timestamp(&player->vframe);
player->vcodec_context->delay = 0; // 禁止内部缓冲
avcodec_decode_video2(player->vcodec_context, &player->vframe, &gotvideo, packet);
The reason is, avctx->extradata is not holding the pps/vps values because it crashes the decoder due to redundant pps nals. This is most likely an FFMpeg bug trigerred by mpp issues.
[out#0/matroska @ 0x55816039d0] [error] Could not write header (incorrect codec parameters ?): Invalid data found when processing input
[vost#0:0/hevc_rkmpp_encoder @ 0x5581622fb0] [error] Error initializing output stream:
mp4 works though. use mp4 for now until there is a better solution.
Is it possible to use an RK3399 SBC for hardware decoding in Jellyfin?
I am curious if i am understanding it wrong.
But first thank your for your amazing work.
I am using your respository on my orangepi5 so far working from command line and also working for motion project nvr system for motion detection.
I am just curious because I am using hevc, h264 decoders on motion and on the logs I am getting log messages that mention mpp. Are those decoders not software only implementations? Why mpp is being used? Also for 3 cameras rtsp (6 rtsp streams) I am getting as low is 20% of cpu in use. Are those codecs somewhate using cpu but still using mpp for some part of the deconding?
Also if possible would be too difficult to implement DR1 Direct Rendering 1 (DR1) for those decoders h264_rkmpp_decoder
and hevc_rkmpp_decoder
?
Thanks a lot for any answer
Line 269 in cf6e176
no need to reinvent the wheel, both ffmpeg and drm_fourcc gives enough interface to get format details. This needs some refactoring
root@scensmart:~ ffmpeg -i source1.mp4 -an -v trace out.mp4
ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
configuration: --prefix=/usr/local --enable-version3 --enable-libdrm --enable-rkmpp --enable-libx264 --enable-libx265 --enable-nonfree --enable-gpl --enable-shared
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
libpostproc 57. 1.100 / 57. 1.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'source1.mp4'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'trace'.
Reading option 'out.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument trace.
Successfully parsed a group of options.
Parsing a group of options: input url source1.mp4.
Successfully parsed a group of options.
Opening an input file: source1.mp4.
[NULL @ 0x5589640820] Opening 'source1.mp4' for reading
[file @ 0x5589640e10] Setting default whitelist 'file,crypto,data'
Probing mov,mp4,m4a,3gp,3g2,mj2 score:100 size:2048
Successfully opened the file.
Parsing a group of options: output url out.mp4.
Applying option an (disable audio) with argument 1.
Successfully parsed a group of options.
Opening an output file: out.mp4.
File 'out.mp4' already exists. Overwrite? [y/N] y
[file @ 0x5589645090] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
[h264_rkmpp_decoder @ 0x5589648a10] Initializing RKMPP Codec.
[h264_rkmpp_decoder @ 0x5589648a10] Format nv12 chosen by get_format().
[h264_rkmpp_decoder @ 0x5589648a10] Picture format is nv12.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_rkmpp_decoder) -> h264 (h264_rkmpp_encoder))
Press [q] to stop, [?] for help
[vost#0:0/h264_rkmpp_encoder @ 0x55896be940] cur_dts is invalid [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[h264_rkmpp_decoder @ 0x5589648a10] ff_decode_get_packet return (code = 0)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 0, sample 1, dts 40000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 1, sample 1, dts 64000
[h264_rkmpp_decoder @ 0x5589648a10] Wrote 82631 bytes to decoder
[h264_rkmpp_decoder @ 0x5589648a10] ff_decode_get_packet return (code = -11)
[h264_rkmpp_decoder @ 0x5589648a10] Decoder Can't get packet retrying.
[vost#0:0/h264_rkmpp_encoder @ 0x55896be940] cur_dts is invalid [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 0, sample 2, dts 80000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 1, sample 1, dts 64000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 0, sample 2, dts 80000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 1, sample 2, dts 128000
[h264_rkmpp_decoder @ 0x5589648a10] ff_decode_get_packet return (code = 0)
[h264_rkmpp_decoder @ 0x5589648a10] Wrote 27568 bytes to decoder
[h264_rkmpp_decoder @ 0x5589648a10] ff_decode_get_packet return (code = -11)
[h264_rkmpp_decoder @ 0x5589648a10] Decoder Can't get packet retrying.
[vost#0:0/h264_rkmpp_encoder @ 0x55896be940] cur_dts is invalid [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 0, sample 3, dts 120000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 1, sample 2, dts 128000
[h264_rkmpp_decoder @ 0x5589648a10] ff_decode_get_packet return (code = 0)
[h264_rkmpp_decoder @ 0x5589648a10] Wrote 25821 bytes to decoder
[h264_rkmpp_decoder @ 0x5589648a10] ff_decode_get_packet return (code = -11)
[h264_rkmpp_decoder @ 0x5589648a10] Decoder Can't get packet retrying.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 0, sample 4, dts 160000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 1, sample 2, dts 128000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 0, sample 4, dts 160000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 1, sample 3, dts 192000
[vost#0:0/h264_rkmpp_encoder @ 0x55896be940] cur_dts is invalid [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[h264_rkmpp_decoder @ 0x5589648a10] ff_decode_get_packet return (code = 0)
[h264_rkmpp_decoder @ 0x5589648a10] Wrote 25423 bytes to decoder
[h264_rkmpp_decoder @ 0x5589648a10] ff_decode_get_packet return (code = -11)
[h264_rkmpp_decoder @ 0x5589648a10] Decoder Can't get packet retrying.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 0, sample 5, dts 200000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 1, sample 3, dts 192000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 0, sample 5, dts 200000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 1, sample 4, dts 256000
[vost#0:0/h264_rkmpp_encoder @ 0x55896be940] cur_dts is invalid [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[h264_rkmpp_decoder @ 0x5589648a10] ff_decode_get_packet return (code = 0)
[h264_rkmpp_decoder @ 0x5589648a10] Decoder buffer full
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 0, sample 6, dts 240000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5589640820] stream 1, sample 4, dts 256000
[h264_rkmpp_decoder @ 0x5589648a10] Decoder noticed an info change
[h264_rkmpp_decoder @ 0x5589648a10] Bus error (core dumped)
I wish to have an ffmpeg which can transcode h264 or hevc source to h264 with lower fps/resolution/bitrate by hardware acceleration on RK3568B2. Can any of your repository be a good choice?
Note: I tried with https://github.com/jjm2473/ffmpeg-rk, but it segfaults constantly, and repository owner is not responding to my questions.
I have a RK3568 CPU (nanopi r5c), with this os: rk3568-eflasher-debian-bullseye-core-5.10-arm64-YYYYMMDD.img.gz
How shall I (from which repos) build or (from which packages) install the dependencies?
What are the dependencies? Librga and mpp?
What is the recommended configure command?
Thank you very much.
Multi-layer HEVC coding is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
getting this sometimes
test with:
./FFmpeg-encoder/ffmpeg -loglevel debug -device /dev/dri/card0 -framerate 30 -f kmsgrab -i - -vf 'hwdownload,format=bgr0' -c:v hevc_rkmpp_encoder -b:v 2000K screencast_30fps_4.mkv
most likely a sync issue
Hi!! Can i build this project on armhf linux?
My Soc is RK3229.. thx!!
I built ffmpeg out but cannot decode correctly. maybe hardware not working well?
chipset: rk3566
os: Armbian 23.11.0-trunk Lunar
[h264_rkmpp @ 0x55969d1fe0] Failed to initialize MPP context (code = -1).
[h264_rkmpp @ 0x55969d1fe0] Failed to initialize RKMPP decoder.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_rkmpp) -> h264 (h264_rkmpp))
Error while opening decoder for input stream #0:0 : Unknown error occurred
Was anyone able to have faster porcessing with FFMPEG?
I have a bunch of GPU but it is using very little, and it is being VERY SLOW at making a video out of frames I collected.
Any insignt would be appreciated.
thanks
Got this build error:
HTML doc/ffmpeg.html
makeinfo: error parsing ./doc/t2h.pm: Undefined subroutine &Texinfo::Config::set_from_init_file called at ./doc/t2h.pm line 24.
make: *** [doc/Makefile:70: doc/ffmpeg.html] Error 1
Is there a way to compile this source code into a static binary?
I need a static one because i want to use it with frigate, which requieres a static binary.
Hi,
I have got ffmpeg-mpp running successfully with ffmpeg command line, decoding, transcoding, it is working.
Now I am trying to use a c++ wrapper on ffmpeg to develop my own application. It is not working even for
the basic decoding test.
I have tried to compile a vanilla ffmpeg based on this repo, i,e, just remove dependency on rockchp-mpp on configure.
The c++ wrapper is working well on this vanilla version. The c++ wrapper I used is this repo:
avcpp-a c++ wrapper for ffmpeg
Take the decode test an example, it will get return value -11 when decode a package after several frames. Some other guys
suggest me to do a while loop on -11 return value, but it is not working neither. If a -11 retuen is got, the return value will
always be -11 on calling decoding interface.
The wrapper code is not complicated and easy to compile.
I am getting "[hevc_rkmpp_decoder @ 0x...] Can not get out frame"
Is this an mpp bug or the exp_refactor_all branch?
The rkmpp_xxx_encoders allow to pass -width and -height to scale the frames using hardware acceleration.
Is it possible to use those options when only decoding? This would be useful for an application like frigate that only decodes and scales frames but does not transcode.
However, great project. Thank you really much!
See: #7 (comment)
If you have a MIPI camera you can try to encode NV12 1920x1080 and you get the wrong FPS and the encoded result cannot be played.
command line:
ffmpeg -f v4l2 -pixel_format nv12 -framerate 30 -video_size 1920x1080 -i /dev/video11 out3.h264
you get:
[video4linux2,v4l2 @ 0x5568763b90] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
[video4linux2,v4l2 @ 0x5568763b90] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device, using framerate 30/1
Input #0, video4linux2,v4l2, from '/dev/video11':
Duration: N/A, start: 235171.186780, bitrate: 829 kb/s
Stream #0:0: Video: rawvideo (NV12 / 0x3231564E), nv12, 1920x1080, 829 kb/s, 0.03 fps, 0.03 tbr, 1000k tbn
the result cannot be played:
Input #0, h264, from 'out3.h264': 0KB vq= 0KB sq= 0B f=0/0
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 0.03 fps, 0.03 tbr, 1200k tbn
[h264_rkmpp_decoder @ 0x7f6c8b5140] Picture format is yuv420p.
[h264_rkmpp_decoder @ 0x7f6c8b5140] Decoder noticed an info change
rga_api version 1.8.1_[5]
If you let ffmpeg calculate the FPS and bitrate for 1920x1080 it gets weird values but gets it right for 640x480.
`
With sync mode rga3 will limit itself to 8k@45fp with single core. To use both cores of rga3, async mode must be implemented.
Details: JeffyCN#18 (comment)
JeffyCN#18 (comment)
espcially when buffer group is full
dont know why, gotta look at it.
A lot has been added specially hevc and vp8 encoders with scaling support:
https://github.com/hbiyik/FFmpeg/wiki
should be stable to test if you are interested.
Good morning, I hope that is the right place to make this question (if it isn't, please help me on other channel or tell me where post). My goal is use vlc media player on my rockchip device RK3228 (I don't know if it's a RK3228A or a RK3228B) to play blu-ray (both encrypted that decrypted) using hardware acceleration. So after made some research I have found this article https://www.omgubuntu.co.uk/2022/08/watch-bluray-discs-in-vlc-on-ubuntu-with-makemkv that have redirect here https://forum.makemkv.com/forum/viewtopic.php?f=3&t=224 and here https://forum.makemkv.com/forum/viewtopic.php?f=3&t=7009 . After follow their instruction and tried to play a blu-ray image not decrypted (https://durian.blender.org/download/ ) vlc seems not working but it was working very slow (have just showed a frame with some squares) because it don't was using hardware decoding. So I have made a new search founding this post https://forum.odroid.com/viewtopic.php?p=349030&sid=a3a43262cde743666ca2581a6b1db4a7#p349030 and downloading rkmpp framework https://github.com/rockchip-linux/mpp .
The first question is: can I apply the same steps listed to your repository (obviously branch mpp-rga-ffmpeg-6)?
Go on in my search I have found also this post https://forum.pine64.org/showthread.php?tid=6373&pid=39854#pid39854 where is written "video player must request "h264_rkmpp", "hevc_rkmpp", "vp8_rkmpp" or "vp9_rkmpp" decoder from ffmpeg" . So the second question is: can I edit renaming (and in what file) h264_rkmpp constant ecc inside ffmpeg source so VLC use h264 hw accelerated decoding ?
I'm newbie on linux, but hope that somebody it's interested to use vlc as blu-ray player such me and/or motivated to help me .
Best regards
After 4-5 seconds decoders stops decoding assuing the file has ended and play back stops.
Seeking once again triggers playback again, but stops after several seconds as well.
Happens in both Nexus & Matrix branches.
Does not happen with each file, but definetely happends with the below
Same file plays with normal X11 display only happens when DRM is selected with gbm windowing
http://movietrailers.apple.com/movies/lionsgate/hell-fest/hell-fest-trailer-1_h1080p.mov
First of all, thanks for this wonderful piece of software.
The branch I used is exp_m2m.
I found that the decoder would hang on certain media files when used with scaling parameters, here are my commands:
ffmpeg -c:v h264_rkmpp_decoder -width 1280 -height 720 -i input.mp4 -c:v libx264 output.mkv
Often times it would output something like these and hang.
[h264_rkmpp_decoder @ 0x55a7ef9360] Can not get out frame
[h264_rkmpp_decoder @ 0x557ffc8920] RGA timed out for out fifo frame 4186. Dropped
Error while decoding stream #0:0: Unknown error occurred
[h264_rkmpp_decoder @ 0x55bcb0f930] Decoder Failed to decode frame (code = -1313558101)=5.33x
Error while decoding stream #0:0: Unknown error occurred
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.