JeffyCN / FFmpeg

FFmpeg with rkmpp hwdec - (deprecated due to license issue, check gstreamer instead or https://github.com/nyanmisaka/ffmpeg-rockchip)
https://ffmpeg.org
Other
58 stars 18 forks source link

Referencing yuv420sp mpp output to ffmpeg frames without memcopy #18

Closed hbiyik closed 11 months ago

hbiyik commented 1 year ago

Hello

I am experimenting the approach where the mmapped mppbuffer pointer is directly referenced to AVFrame->data[0,1,2], so that i can get rid off memcopy totally. I could expect some alignment issues and without any conversion i can only get yuv420sp but current problem is i have huge mem leaks.

Do you have any suggestions what i am doing wrong? It seems that mpp frame is not releaes even though i release it explicitly.

Prototype here: https://github.com/hbiyik/FFmpeg/blob/61c629b2a6b65a319b767fafac3f01221d9c16f7/libavcodec/rkmppdec.c

JeffyCN commented 1 year ago

maybe: 1/ make sure mpp frame been deinited at the end 2/ try to locate the leak with valgrind

maybe:

+            // free old buffers
+            av_buffer_unref(&frame->buf[0]);
+            av_buffer_unref(&frame->buf[1]);
+            av_buffer_unref(&frame->buf[2]);
+
+            frame->buf[0] = // create buffer wrapper
+
+            frame->linesize[0] = hstride;
+            frame->linesize[1] = hstride / 2;
+            frame->linesize[2] = hstride / 2;
+
+            frame->data[0] = frame->buf[0]->data;
+            frame->data[1] = frame->data[0] + hstride * vstride;
+            frame->data[2] = frame->data[1] + hstride * vstride / 4;
hbiyik commented 1 year ago

Thanks, think i have done all unrefing and frame releasing, apperantly somehwere i havent, i will go with valgrind, may be this helps to fix my shit code. closing the ticket.

hbiyik commented 1 year ago

Aha, i fixed the issue, thanks. together with valgrind and your tips i realized that i have not released the old buffers.

hbiyik commented 1 year ago

@JeffyCN I am reopening this issue and i think i made some real improvements.

1) I am using the Y plane from MppBuffer without copying it back to the AvBuffer. 2) I am using the the existing Avbuffer to convert only uv planes with libuv. Libuv has fast implementation of (SIMD) of buffer interleaving.

I tested 8k 30fps 60fps with this without any frame drops with normal players (mpv, ffplay) Firefox 4k plays nice and smooth. Sometimes drops stuff but thats a huge step forward imho.

Prototype code below: https://github.com/hbiyik/FFmpeg/commit/adaeb45c16af8c0ad7ddc22ab6ec42548ab750de

Still i am not so sure about referencing MppBuffer directly, because in my theory, Releasing the mpp buffer when the actual display is finished, may cause internal VPU buffer to be full longer, may be copying it with SIMD could be still faster.

hbiyik commented 1 year ago

@avafinger

avafinger commented 1 year ago

I've missed the whole issue and your improvement. I can only test this in ffplay and report back. Maybe @JeffyCN can give some hints.

hbiyik commented 1 year ago

@avafinger ok, make sure libyuv is installed. I did not check if configure script properly tests libyuv.

Full branch is here https://github.com/hbiyik/FFmpeg/tree/dualbuffers

avafinger commented 1 year ago

Is libyuv this one? git clone https://chromium.googlesource.com/libyuv/libyuv

hbiyik commented 1 year ago

Yes

hbiyik commented 1 year ago

And my branch is dualbuffers

JeffyCN commented 1 year ago

there are some clients that might try to use their own custom get buffer hook, there might be issues in those cases

hbiyik commented 1 year ago

This branch converts the whole NV12 to yuv420p without overriding get_buffer2. Perfomance is similar to 'dual buffers'. Yet slightly wrose than dual buffers. https://github.com/hbiyik/FFmpeg/tree/libyuv

This branch, directly references NV12 frame output with get_buffer2. There is no conversion at all. https://github.com/hbiyik/FFmpeg/tree/norga The interesting part is, even this struggles with 8k videos, cpu load is very low, however some frames are dropped when played with mpv to output NV12 directly. Therefore i started to think that with FFmpeg unacceleareted decoder pipeline it is impossible to output 8k output, or either MPP or VPU is really slow when it comes to 8K. I know the VPU is dual core but dont know if mmp can really leverage that. or ffmpeg pipeline is really crappy.

I have run some further tests with dualbuffers, depending on the video it also drops even in 4k so i might have overstated the performance. Yet still a big improvement on the soft conversion. Could be a fallback where there is no rga.

JeffyCN commented 1 year ago

guessing it might related to the render flow, at least for mali GPU, there is a memcpy when importing normal texture

hbiyik commented 1 year ago

ah i think you are refering to yuv to rgb conversion at some point, but i though this was done by the players (i am no expert in video stuff at all, i might guess stupid things). Can you point out where this is hapenning? Or somefile in ffmped where this is happening?

JeffyCN commented 1 year ago

it's in the player(ffplay/mpv/chromium/firefox)

if they use gpu(egl) to render video frame, the buffer to texture(glTexImage2D) step would cause a memcpy(neon version).

the reason we use drm prime in ffmpeg is to use zero-copy dmabuf importing(with custom mpv/gst xvimage)

so: 1/ mpp return dma buf 2/ ffmpeg convert it to normal buf(memcpy) 3/ player import it to GPU(memcpy) 4/ GPU render it to window buf 5/ GPU render window buf to screen buf

JeffyCN commented 1 year ago

for VPU performance, you can check with driver log: echo 0x100 >/sys/module/rk_vcodec/parameter/*debug dmesg

avafinger commented 1 year ago

if they use gpu(egl) to render video frame, the buffer to texture(glTexImage2D) step would cause a memcpy(neon version).

For instance, would you have an example of how to import dma buf to texture (egl)?

danergo commented 1 year ago

Quick (n00b) question here @hbiyik: if I wish to have an ffmpeg which can do the below task by hardware acceleration on RK3568B2:

Can any of your repository be my choice?

I tried with https://github.com/jjm2473/ffmpeg-rk, but it segfaults constantly, and repository owner is not responding to my questions.

hbiyik commented 1 year ago

@danergo libuv branch should do your trick

danergo commented 1 year ago

Thank you.

You mean libyuv branch?

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.

hbiyik commented 1 year ago

i suggest you open a ticket in my repo so jeffy's dont get spammed by those questions. there i can try to help the best i can

JeffyCN commented 1 year ago

For instance, would you have an example of how to import dma buf to texture (egl)?

check: https://github.com/JeffyCN/drm-cursor/blob/master/drm_egl.c#L375

i was using custom mpv&xserver: https://github.com/JeffyCN/mpv/commit/3d668a76af39079a50a8f6044e8a902f01416001 https://github.com/JeffyCN/xorg-xserver/blob/1.20.4/glamor/glamor_xv.c#L464

danergo commented 1 year ago

@hbiyik: that was my intention, but unfortunately your repo doesn't allow me to open tickets.

If you can let me do that I'll open it there. I appreciate your help.

Thank you!

Sorry Jeffy. :)

hbiyik commented 1 year ago

god VPU981 can max 8k@15fps. Ridicilous. image

hbiyik commented 1 year ago

Only option i see now is to use libdav1d together with VPU so that may be it can ctach up to 8k@30 for youtube.

@JeffyCN Thanks for your help so far, if i were to use livdavid decoder paralel in rkmppdec.c, when i return the decoded frames, they should not be ordered right? FFmpeg should reorder them according to pts?

In that case how to feed 2 different decoders so that each frames on different decoders would only have the packets that they need. Is it even possible?

JeffyCN commented 1 year ago

TRM's max fps could be lower than the real world, maybe you can: try gst(fakesink+fpsdisplaysink) try afbc format try performance mode(cpu/ddr) check the driver performance log

and maybe you can ask @HermanChen about the actual max fps

hbiyik commented 1 year ago

thanks, will, do. btw previous libdav1d thing was silly. Even the compression algo is depending on previous frames, let alone you can not align packets with frames. So thats impossible.

HermanChen commented 1 year ago

The av1 hw decoder performance is 4K@60fps. Some simple stream can reach 8K@30fps. But for all stream including high bitrate 8bit and 10bit source we can only ensure 4K@60fps. So the benchmark can only say 4K@60fps performance.

hbiyik commented 1 year ago

@HermanChen Thanks for your input. Really, however i need to openly say this, there is a serious design flaw in the vpu of RK3588 (and rk similar socs).

VDPU381: H265 8k@60fps = 2133 MBbps (Due to 10bit HDR content little bit higher i assume) VDPU381: H264 8k@60fps = 1600 MBbps VDPU381: VP9 8k@60fps = 1600 MBbps VDPU381: AVS2 8k@60fps = 1600 MBbps

and there is VDPU981: AV1 4k@60fps = 240Mbps (seriously libdav1d cpu decoder has similar comparable performance except latency)

I dont know how it is in Mainland China but in todays world, 8k means AV1 due to youtube 8k videos.

I dont really understand why Rockchip designed rk3588 chip to be capable to output 8k non-av1 streams with dual core IPCores from Verisilicon, but choose to go with single core for AV1 whick can only 4k properly. I really think this is the wrong choice.

Or may be when you designed the hardware, youtube was not capable of 8k, and you had to bet on either HEVC or AV1, and you choose the wrong bet.

May be in future when HEVC ramps up, this decision could make sense, and may be Youtube will also switch to HEVC which i think they will not.

HermanChen commented 1 year ago

rk3588 can decode 8k av1 video with lower fps. The next generation rkvdec will have av1 decoder with higher performance above 8k@30fps.

danergo commented 1 year ago

Folks,

On RK3568B2 (NanoPi R5C), I'm trying to transcode an 4K30 HEVC video to lower quality (bitrate, or FPS, or resolution).

I'm trying to do this with ffmpeg (compiled from source ffmpeg_rk repo (hevc_rkmpp decode and h264_rkmpp encode).

Benchmark starts at 2x speed, then after a few seconds it drops below 1x, finishing around 0.6x speed at the end.

This is obviously low performance, is there anything I can do (like is this issue related to this performance), or it's as it is, RK3568 in spite of being marketed is not able to transcode realtime?

Ffmpeg command I use:

$ sudo ffmpeg -benchmark -vcodec hevc_rkmpp -i ../DJI_0181.MP4 -vf 'scale_rga' -vcodec h264_rkmpp -f null -
ffmpeg version N-104499-g646d5566ac Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --pkg-config=pkg-config --enable-shared --enable-pthreads --enable-zlib --disable-doc --disable-debug --disable-lzma --disable-vaapi --disable-vdpau --disable-outdevs --disable-libx264 --disable-libopenh264 --disable-decoder=h264_v4l2m2m --disable-decoder=vp8_v4l2m2m --disable-decoder=mpeg2_v4l2m2m --disable-decoder=mpeg4_v4l2m2m --enable-lto --enable-neon --enable-vfp --enable-gnutls --enable-gpl --enable-version3 --enable-nonfree --enable-libdrm --enable-libopus --enable-hardcoded-tables --enable-libmp3lame --enable-libfdk-aac --enable-librga --enable-rkmpp
  libavutil      57.  7.100 / 57.  7.100
  libavcodec     59. 12.100 / 59. 12.100
  libavformat    59.  8.100 / 59.  8.100
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 16.100 /  8. 16.100
  libswscale      6.  1.100 /  6.  1.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100

Media info:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../DJI_0181.MP4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    creation_time   : 2023-04-08T14:53:45.000000Z
    encoder         : DJIAction2
  Duration: 00:09:26.74, start: 0.000000, bitrate: 53480 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 3840x2160, 51156 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2023-04-08T14:53:45.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
    Side data:
      displaymatrix: rotation of -180.00 degrees
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
    Metadata:
      creation_time   : 2023-04-08T14:53:45.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Data: none (djmd / 0x646D6A64), 9 kb/s
    Metadata:
      creation_time   : 2023-04-08T14:53:45.000000Z
      handler_name    : DJI meta
  Stream #0:3[0x4](und): Data: none (dbgi / 0x69676264), 1976 kb/s
    Metadata:
      creation_time   : 2023-04-08T14:53:45.000000Z
      handler_name    : DJI dbgi
  Stream #0:4[0x0]: Video: hevc, none, 90k tbr, 90k tbn (attached pic)
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (hevc_rkmpp) -> h264 (h264_rkmpp))
  Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))

Can you folks spot anything on this, which can help me?

Thank you very much!

JeffyCN commented 1 year ago

there's no rkmpp enc in my version ;)

danergo commented 1 year ago

Ah, okay, @JeffyCN, indeed I forgot that. Thanks!

hbiyik commented 1 year ago

@JeffyCN I have finished all my improvements based on ffmpeg6, are you interested in merging those into your branch?

To sum up: 1) Direct NV12 output support without RGA (1st priority autoselection, rk3588 performance around 4k@30fps) 2) NV12 -> Yuv420P conversion with RGA2 without librga (rk3588 performance around 4k@30fps) 3) NV15/16 -> NV12 conversion with RGA3 so that HDR videos could be output without DRM Prime (rk3588 performance around 4k@30fps) 4) Libyuv SIMD conversion NV12->YUV420P where librga is not available (rk3588 performance 1080P@60fps easily definetely can more). YUV420P is only needed for browsers, MPV directly outputs NV12 anyways 5) A lot of refactoring on the flow of the decoder due to above new improvements.

https://github.com/hbiyik/FFmpeg/commits/ffmpeg-6-dev

If you are interested i can rebase to which branch of yours? master? and create an RFC PR. If not i can close the ticket i guess, the interested parties can check the code in my repo.

As far as ffmpeg without DRMprime is concerned i think this is the maximum this decoder can output in my view if i did not miss anything.

JeffyCN commented 1 year ago

nice to know that, but actually i'm not willing to maintain ffmpeg for rockchip now, due to: 1/ the rockchip company doesn't allow using ffmpeg in any official sdk now(due to license issue) 2/ the rga api changes all the time, and the rga team doesn't care about the usage on non-android platform :( 3/ i don't have any setup to verify it anymore 4/ i don't know much about ffmpeg, i mostly working on gstreamer now

so if it's ok for you, maybe i can try to redirect people to your repo somehow?(maybe mention it to readme and repo detail?)

avafinger commented 1 year ago

@hbiyik I think you would be interested in adding a 0-copy to ffplay (NV12 texture), so less CPU Usage. Please, take a look at https://github.com/mingqian-0/SDL/commit/aaba60fa68f909ee169397e18a6443b8a001b433 I haven't figured out how to use it but adding that patch to SDL2 is straightforward.

@JeffyCN Maybe you could give us a hand?

hbiyik commented 1 year ago

@avafinger i am no expert in the area as well, but solely know how to use gdb :). However i think modifying any other library than FFmpeg is something i would not choose to, simply because it is not maintainable. Since rockchip and ffmpeg has license issues, i am modifying ffmpeg thinking that this solution has no proper future.

I think the right way to handle those would be to provide a wrapper of mpp to Libva backend. Libva also supports drm prime as well so this would fit perfectly. However i got lost so many times in libva, it is just too complex for my little brain.

@JeffyCN ok ill do my best, lets keep the ticket open then, i might need some support in case i get stuck somehwere, i am nowhere near an FFMpeg expert nor a guru C programmer.

hbiyik commented 1 year ago

@avafinger ah now that i noticed u mentioned usage of ffplay, that would be different story but what benefit would it make to integrate it to ffplay? ffplay is only for testing.

avafinger commented 1 year ago

ffplay (ffmpeg vout) plays 16 1080p video streams smoother than gstreamer , and can be easily integrated with your application (OpenCV, etc...) and more important EASY to debug. ffplay is similar to KODI, plays video and audio, like MPV but very 'simple' and efficient, and does everything KODI and MPV do. The only missing piece of ffplay is the 0-copy (dma buf) using texture. I know how to use a texture with SDL2 but need an example for that 0-copy implementation.

Do you use MPV on your testing? (or KODI)?

Update:

See here a practical example: gstreamer, ~ 100% CPU Usage, resized without aspect ratio, seems to drop some frames i guess, in theory, dma buf, 0-copy

gstreamer

ffmpeg (ffplay) - ~150% CPU usage, resized with the correct aspect ratio, memcpy, no frame drops

ffplay

hbiyik commented 1 year ago

I use mpv for perfomance bechmarking since it can output directly NV12, but for debugging ffplay simply because i have debugging symbols on ease of my access.

Here is an interesting graph of performance benchmark with MPV NV12 output.

Video is 4K 60Fps, 8bit but very high bitrate Vp9.

I have captured the latency on each frame decode output from mpp. After getting the buffer from mpp, setting it as output buffer is nearly instant several micro secs, only some ms is lost during first few frames due to ffmpeg is allocating buffers and then caching them for later use (correction, av buffers are not used in NV12 mode).

What is interesting is the blue lines, see the fluctuations on each latency samples, goes even up to 50ms where the max delay for each frame is 16ms (for 60fps). If MPV is not async where it writes the video buffer to texture buffers, then definetely this means that there is a latency issue in the decoder. But there is a possbility that MPV does not decode the stream until it finishes writing the buffer to video output. If thats the case, then the video output delay is impacting the decoder latency.

Yet in this current scenario, a player must at least have 1 second of buffer to manage the fluctiations of decoder latency (The Green Line in the chart), i check 0.5 sec (30 fps) and 0.25 sec (15 fps=orange line), the fluctiations in the latency is too much to drop the frames.

I am attaching the raw data in case you are interested in. ffmpeg_mpp_performance.ods

image

avafinger commented 1 year ago

Updated my info before your answer, maybe you could check if MPV can display the 16 1080p streams,as a reference.

Do you have a link to download your file?: "Video is 4K 60Fps, 8bit but very high bitrate Vp9."

hbiyik commented 1 year ago

How do you get output of 16 videos in ffplay? I think its somehow using ffmpeg filters? Can you share the command u execute with ffplay?

avafinger commented 1 year ago

ffplay sh:

#!/bin/bash
DISPLAY=:0.0 ffplay -i ~/Videos/rickiandtheflash-tlr2_h1080p.mov -x 480 -y 270 -noborder -left 0 -top 0 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/Mad_Max_Fury_Road_2015_Trailer_F4_5.1-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 480 -top 0 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/Star_Wars_Episode_VII_The_Force_Awakens_2015_Trailer_B_5.1-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 960 -top 0 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/Poltergeist_DOM_TrailerD-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 1440 -top 0 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/BatmanvSuperman_TLR-1_5.1-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 0 -top 270 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/Tomorrowland_2015_Trailer_H_5.1-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 480 -top 270 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/Fantastic_Four_2015_Trailer_2_Intl_5.1-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 960 -top 270 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/TheLastWitchHunter_TRLR1-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 1440 -top 270 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/Jurassic_World_TrailerA_International_5.1-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 0 -top 540 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/San_Andreas_2015_International_Trailer_3_5.1-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 480 -top 540 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/Furious_7_2015_International_Trailer_2_5.1-1080p-HDTN.mp4 -x 480 -y 270 -noborder -left 960 -top 540 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/hell-fest-trailer-1_h1080p.mov -x 480 -y 270 -noborder -left 1440 -top 540 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/smallfoot-trailer-1_h1080p.mov -x 480 -y 270 -noborder -left 0 -top 810 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/evil-dead-rise-trailer-2_h1080p.mov -x 480 -y 270 -noborder -left 480 -top 810 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/john-wick-chapter-four-trailer-3_h1080p.mov -x 480 -y 270 -noborder -left 960 -top 810 -autoexit -an -hide_banner -loglevel 0&
DISPLAY=:0.0 ffplay -i ~/Videos/heavenknowswhat-tlr1_h1080p.mov -x 480 -y 270 -noborder -left 1440 -top 810 -autoexit -an -hide_banner -loglevel 0&
hbiyik commented 1 year ago

as i see, and here is the tested vp9 file. https://fileport.io/SL7pMWdtdUpF

avafinger commented 1 year ago

Note that you need @amazingfate and @icecream95 patches and if i remember correctly, there was some patch to mpp about the DMA32/DMA64 and you may be suffering that issue where mpp does not return a frame , but i think Jeffy fixed that.

avafinger commented 1 year ago

gstreamer, latest Jeffy's patch:

#!/bin/bash
#DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/ElephantsDream.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<0,0,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/rickiandtheflash-tlr2_h1080p.mov ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<0,0,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/Mad_Max_Fury_Road_2015_Trailer_F4_5.1-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<480,0,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/Star_Wars_Episode_VII_The_Force_Awakens_2015_Trailer_B_5.1-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<960,0,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/Poltergeist_DOM_TrailerD-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<1440,0,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/BatmanvSuperman_TLR-1_5.1-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<0,270,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/Tomorrowland_2015_Trailer_H_5.1-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<480,270,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/Fantastic_Four_2015_Trailer_2_Intl_5.1-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<960,270,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/TheLastWitchHunter_TRLR1-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<1440,270,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/Jurassic_World_TrailerA_International_5.1-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<0,540,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/San_Andreas_2015_International_Trailer_3_5.1-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<480,540,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/Furious_7_2015_International_Trailer_2_5.1-1080p-HDTN.mp4 ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<960,540,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/hell-fest-trailer-1_h1080p.mov ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<1440,540,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/smallfoot-trailer-1_h1080p.mov ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<0,810,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/evil-dead-rise-trailer-2_h1080p.mov ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<480,810,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/john-wick-chapter-four-trailer-3_h1080p.mov ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<960,810,480,270>' decorations=0&
DISPLAY=:0.0 gst-launch-1.0 filesrc location=~/Videos/heavenknowswhat-tlr1_h1080p.mov ! qtdemux ! h264parse ! mppvideodec width=480 height=270 ! xvimagesink render-rectangle='<1440,810,480,270>' decorations=0&
avafinger commented 1 year ago

wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4 wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4 wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/VolkswagenGTIReview.mp4 wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WeAreGoingOnBullrun.mp wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WeAreGoingOnBullrun.mp4 wget http://videos.hd-trailers.net/Mad_Max_Fury_Road_2015_Trailer_F4_5.1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/Star_Wars_Episode_VII_The_Force_Awakens_2015_Trailer_B_5.1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/Poltergeist_DOM_TrailerD-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/BatmanvSuperman_TLR-1_5.1-1080p-HDTN.mp4 wget http://avideos.5min.com/995/5187995/518799420_8.mp4 wget http://avideos.5min.com/440/5188440/518843948_8.mp4 wget http://videos.hd-trailers.net/Tomorrowland_2015_Trailer_H_5.1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/Fantastic_Four_2015_Trailer_2_Intl_5.1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/Star_Wars_Episode_VII_The_Force_Awakens_2015_Trailer_B_5.1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/TheLastWitchHunter_TRLR1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/TheLastWitchHunter_TRLR1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/Jurassic_World_TrailerA_International_5.1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/San_Andreas_2015_International_Trailer_3_5.1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/Fantastic_Four_2015_Trailer_2_Intl_5.1-1080p-HDTN.mp4 wget http://videos.hd-trailers.net/Furious_7_2015_International_Trailer_2_5.1-1080p-HDTN.mp4 wget http://movietrailers.apple.com/movies/lionsgate/hell-fest/hell-fest-trailer-1_h1080p.mov wget http://movietrailers.apple.com/movies/wb/smallfoot/smallfoot-trailer-1_h1080p.mov wget https://movietrailers.apple.com/movies/wb/evil-dead-rise/evil-dead-rise-trailer-2_h1080p.mov wget https://movietrailers.apple.com/movies/lionsgate/john-wick-chapter-4/john-wick-chapter-four-trailer-3_h1080p.mov wget http://movietrailers.apple.com/movies/independent/heavenknowswhat/heavenknowswhat-tlr1_h1080p.mov wget http://movietrailers.apple.com/movies/sony_pictures/rickiandtheflash/rickiandtheflash-tlr2_h1080p.mov

hbiyik commented 1 year ago

that dma32/64 stuff is because mpp is using dma64 as high prio, to fix it, mpp needs to be patched, to my knowdledge there is no way to dicatate which device to use for mmap in mpp, however, in my case i dont even use rga. RGA is only necessary when explicitly Yuv420p is requested and only firefox or browsers do that.

When explicitly yuv420p is asked, i use RGA2, and when the dma problem happens i fallback to libyuv, which is arm SIMD optimized library, and i convert half of the planes, so this can easiliy 4k 30, which i think is ok for dump players like browsers. Browsers on the other hand have their own set of problems.

FFplay on the other hand is accepting nv12 decoder output but stupidly softconverts it to yuv420p with libavfilter. This in return causes cpu load. I am not sure if there is a way to force ffplay to use NV12 frame output or not, if not, just better use mpv.

avafinger commented 1 year ago

ffplay to use NV12 frame output or not

Yes, there is.

hbiyik commented 1 year ago

how? btw we start to use this issue as a chat window :)