Posts by tommy55

    Hello,

    I was not sure where to put my question, feel free to move this thread...

    My question is related to FFMPEG that LibreElec is using. I have a Raspberry Pi 4 with official Raspberry OS.

    In short - I am trying to achieve realtime transcoding of a HEVC video stream to H264. And for this I need hardware acceleration of both HEVC decoding and H264 encoding.

    Unfortunatelly, the current stock FFMPEG provided with Raspberry OS only supports HW accelerated H264 encoding using h264_omx encoder. It also has h264_v4l2m2m encoder, but it produces video with a green tint (bug?). And regarding HEVC - I was not able to enable HW acceleration for it.

    I have read that LibreElec uses a custom patched version of FFMPEG and supports HEVC HW accelerated decoding.

    So I tried to make my own build of ffmpeg based on LibreElec. And now here is the part where I am failing :)

    I investigated LibreElec build system (mainly LibreELEC.tv/gen-patches.sh at master · LibreELEC/LibreELEC.tv · GitHub).

    I used FFMPEG sources from Kodi(XBMC) branch 4.3.1-Matrix-Alpha1-1 from GitHub - xbmc/FFmpeg: mirror of git://source.ffmpeg.org/ffmpeg.git.

    Then I merged GitHub - jc-kynesim/rpi-ffmpeg: FFmpeg work for RPI (branch test/4.3/kodi_main), GitHub - lrusak/FFmpeg: mirror of git://source.ffmpeg.org/ffmpeg.git (v4l2-drmprime-v5) and GitHub - LibreELEC/FFmpeg (branch 4.3-libreelec-misc).

    Then I configured build according to package.mk:

    and succesfully builded FFMPEG.

    The resulting FFMPEG however does not work as expected :) For some reason I get these errors:

    Code
    [h264_v4l2m2m @ 0x23bdd70] All capture buffers returned to userspace. Increase num_capture_buffers to prevent device deadlock or dropped packets/frames.

    And it also seems that HW acceleration of HEVC decoding is not working either.

    My FFMPEG command line is:

    Code
    ./ffmpeg -hwaccel drm -c:v hevc -i Udalosti.ts -c:v h264_v4l2m2m -c:a copy -b:v 1500k -pix_fmt yuv420p Udalosti.avi

    I am pretty sure that I am doing something wrong, as I am not an expert...

    Can someone please point me to the right direction, what might be wrong?

    Or if there is another way... I just need HEVC -> H264 HW transcoding of a video stream through pipes.

    Thank you very much for any useful info.