Git Product home page Git Product logo

hbiyik / ffmpeg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ffmpeg/ffmpeg

90.0 90.0 7.0 333.71 MB

PLEASE USE https://github.com/nyanmisaka/ffmpeg-rockchip REPO INSTEAD.

Home Page: https://github.com/nyanmisaka/ffmpeg-rockchip

License: Other

Shell 0.08% Ruby 0.01% C++ 0.17% Python 0.05% Perl 0.04% C 91.48% Objective-C 0.16% Verilog 0.01% Assembly 6.58% Awk 0.01% Cuda 0.11% Makefile 1.31% HTML 0.01% Metal 0.01% Roff 0.01%

ffmpeg's People

Contributors

aconverse avatar aurelj avatar bcoudurier avatar btbn avatar cehoyos avatar cus avatar cyanreg avatar dondiego avatar dwbuiten avatar elenril avatar fhvwy avatar jamrial avatar justinruggles avatar kodawah avatar lance-lmwang avatar lu-zero avatar mansr avatar michaelni avatar mkver avatar mstorsjo avatar mypopydev avatar nevcairiel avatar ramiropolla avatar rbultje avatar rdoeffinger avatar richardpl avatar rouseabout avatar saste avatar ubitux avatar yuvi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ffmpeg's Issues

ffmpeg transcode hang up

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

how to test exp_refactor_all branch

  1. to use p010/yuv420p10 10bit formats you need this fix in the vendor kernel and this fix in rgamulti

  2. compile with --enable-shared additional to the description in wiki

  3. 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

  1. to test with kodi, build kodi with external ffmpeg usage. You can refer to this PKGBUILD on how to do this.

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.

  1. To test with mpv run with below commandline args.
    mpv --hwdec=rkmpp pathtofile
    IMPORTANT: to decode drm_prime NV16 frames you either need latest git version of mpv or below patch
    IMPORTANT: to decode drm_prime P010 below patch
    IMPORTANT: if you receive an error like `Mapped surface with format 'nv12' has unexpected number of planes. (0 layers and 0 planes, but expected 2 planes),``build mpv from git, this is an issue with mpv and fixed in the latest.
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

Hi! I got some situation when i run configure script

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

and the output log is that
1685517524400

it's seems that code into deathloop and can not run out

can u please help me deal with that

display green

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

High cpu load when ffmpeg decodes a rtsp stream and output rawvideo to pipe

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?

3 plane pixel formats are losing the alignment when copied from AVframe

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

image

or

image

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.

#define RKMPP_STRIDE_ALIGN 16

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:

case AV_PIX_FMT_YUV420P:
or AVframe copy routine here
if(frame){

a special case of dimensions of 705x480 crashes the encoder driver, this seems to be another problem with mpp.
see: rockchip-linux/mpp#424

Orange Pi 5 Plus issues with firefox and youtube

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).

packages.txt

It seems that hardware decoding does not work for RK3399.

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

decoder error

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?

RTSP streaming playback, the playback screen will repeatedly skip horizontally between normal and blurred screens

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

decoder cant decode the encoded files

it plays fine when used ie: h264 soft decoder, but the encoded files are not always plaed when decoded with rkmpp.

god knows why...

here is the output of hevc file, h264 does not even play..
image

rkmppdec 解码异常的问题

测试背景1

  1. 在麒麟aarch64 系统上使用ffmpeg 播放 mp4视频文件
  2. ffmpeg版本为4.2.2的版本
  3. RK3399

异常情况

  1. 获取解码后的av_frame_get_best_effort_timestamp 异常为负值. frame->pts 间歇性的为0. packet->pts完全正常

同一份业务代码,(ffmpeg库不同) 在ubuntu-x64平台下运行正常. 可正确获得pts. 均无此类情况.

av_frame_get_best_effort_timestamp(&player->vframe);  

  1. 接受视频源为仅有I帧和P帧的数据. 设置解码器内部禁止缓冲, 输入packet pts和输出vframe的pts 总是间隔一帧. 实际解码器内部缓冲1帧.导致端到端时延增加约40ms
player->vcodec_context->delay = 0;          // 禁止内部缓冲
avcodec_decode_video2(player->vcodec_context, &player->vframe, &gotvideo, packet);

hevc can not transcode to matroska

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.

Questions decoders direct rendering and mpp

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

FFmpeg transcoding error on RK3588

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)

Hardware acceleration on RK3568B2

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

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

Hi!

Hi!! Can i build this project on armhf linux?

My Soc is RK3229.. thx!!

how to check os hardware is working?

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

increase performance?

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

ffmpeg build error with texinfo>=7.1

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

Static binary

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.

ffmpeg command line working but down stream application does not

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.

hevc_rkmpp_decoder

I am getting "[hevc_rkmpp_decoder @ 0x...] Can not get out frame"
Is this an mpp bug or the exp_refactor_all branch?

Hardware scaling for decoder

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!

Encoding raw NV12 from MIPI camera

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.

`

build FFmpeg with rkmmp for VLC

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

KODI with DRM plane sends EOS prematurely

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

Decoder hang when used with scaling

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.