hbiyik / FFmpeg

PLEASE USE https://github.com/nyanmisaka/ffmpeg-rockchip REPO INSTEAD.
https://github.com/nyanmisaka/ffmpeg-rockchip
Other
90 stars 7 forks source link

Questions decoders direct rendering and mpp #23

Closed eusoubrasileiro closed 9 months ago

eusoubrasileiro commented 10 months ago

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

hbiyik commented 9 months ago

Mpp is the user space library that provides access to the encoders/decoder hardware in rockchip SOCs. So this ffmpeg fork is using hardware, but both ffmpeg and mpp and rga library introduces of course some overhead.

DR1 Direct Rendering 1 (DR1)

I do not know what this is, and i am not sure rendering is a part of ffmpeg.

eusoubrasileiro commented 9 months ago

Thanks a lot @hbiyik for your answer. So if I understood correctly even if I choose hecv (software decoder) instead of hevc_rkmpp_decoder this ffmpeg fork will use the second and hence hardware acceleration for the decoding of my, for example, rtsp hevc stream?

Regarding DR1 it's specific for ffmpeg. Something like bellow I got from somewhere.

Direct Rendering 1 (DR1) is a method used by certain video decoders in FFmpeg for efficient video playback. It allows video frames to be directly displayed on the screen without extra copying, reducing delay and improving performance.

I really don't know the specifics I thought since you are knowledgeable on thousands of things you could guide me, if possible, to adapt the decoders to support this.

Whatever your answer thank you very much for your work!!

hbiyik commented 9 months ago

when you specify hevc as encoder or decoder, ffmpeg routes to first priority codec which can hevc. I have raised rkmpp codecs are the highes prio so it will auto select rkmpp_hevc* variants, but if you specify something libx265(not sure about the name) ffmpeg will then use this specific codec. so hevc is not actually a codec in ffmpeg but a codec name used to route hevc capable actual codec. At least this is my knowledge.

The fastest way to render the frames is to use drmprime, i dont know much about DR1, but conventional methods like vaapi will not work, because this requires gpu involvement. but again im no rendering expert, in general not an expert of anything :) just doing this because i can, so take those comments with a grain of salt.

eusoubrasileiro commented 9 months ago

@hbiyik you are aewsome man thanks very helpful. Thanks for the teachings and lessons. Cool I think I got the part about the priority of the codecs.

Not sure I fully understand your answer tought, but thank you again regardless. I need to to my homework hehe.

I will research more on the subject and try to understand how the specifc software (motion project) uses ffmpeg libraries and DR1 to read the frames directly and perform motion detection.

Again thanks a lot man and congratulations on your awesome fork!