nyanmisaka / ffmpeg-rockchip

FFmpeg with async and zero-copy Rockchip MPP & RGA support
Other
326 stars 48 forks source link

Help building ffplay #16

Closed ShyneTurtle closed 3 months ago

ShyneTurtle commented 5 months ago

Hello,

after seeing your work here: https://github.com/jellyfin/jellyfin-ffmpeg/issues/34 i decided to try building your ffmpeg fork, following the wiki.

However, when i try to use it using the following command: DISPLAY=:0 ffplay -codec:v hevc_rkmpp /etc/jellyfinlib/bbb_sunflower_2160p_60fps_normal.mp4

The video doesn't even open. I also tried to use vlc with this custom ffmpeg and the output is unreadable. I also tried transcoding video and reading it on an x86 pc and the video is corrupted.

While trying to read the original video with the your ffmpeg fork, FFPLAY gives me this error:

[hevc_mp4toannexb @ 0x7f382b4b50] No parameter sets in the extradata
[hevc_rkmpp @ 0x7f382dc220] Failed to get packet (code = -1094995529)
    Last message repeated 437 times
[hevc_rkmpp @ 0x7f382dc220] Failed to get packet (code = -1094995529)
    Last message repeated 1705 times
[hevc_rkmpp @ 0x7f382dc220] Failed to get packet (code = -1094995529)
    Last message repeated 1944 times

Hardware: CM3588 from friendlyelec Uname: Linux CM3588 6.1.25 #123 SMP Thu Nov 16 11:25:37 CST 2023 aarch64 aarch64 aarch64 GNU/Linux FFMPEG version: 668585f built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) Configuration configuration: --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga

If you need further details please let me know, i've been looking into this for hours now and i can't find anything telling me what's wrong.

Thank you for your time.

nyanmisaka commented 5 months ago

@ShyneTurtle There is no such line of code Failed to get packet (code = %d) is this repository rkmppdec.c. It comes from JeffyCN/FFmpeg.

So I concluded that there is more than one ffmpeg/ffplay binary in your environment and you are not using absolute path to execute the custom one.

Moreover, when building ffplay it will check for the libsdl2-dev package, and if it is not detected, it will skip building ffplay. Explicitly set --enable-ffplay will expose the error.

ShyneTurtle commented 5 months ago

Hello and thank you for your answer.

I thought that the previous builds would be overwritten, my bad. I tried running ffmpeg again (from this repo) and the transcode worked flawlessly.

Only problem is that ffplay is not built, even though i added the --enable-ffplay flag and no errors showed up. You can read the whole build logs here (i used the script provided in the wiki as a baseline): https://pastebin.com/nkyWMFQY

This is a minor problem and most certainly an error in my configure call.

This is definitely off topic but would you mind telling me what i should do to use this in jellyfin ? Just so you know i used the .dev package from their official builds jellyfin-ffmpeg5_5.1.4-2-jammy_arm64.deb. Problem being i can't provide a path to the custom ffmpeg since it uses its internal ffmpeg build and the ffmpeg path option is disabled in the dashboard.

nyanmisaka commented 5 months ago
// line 751
Programs:
ffmpeg                  ffprobe

Try --enable-sdl.

You can download the prebuilt jellyfin-ffmpeg here. Checks -> Artifacts -> arm64.deb

Or use my docker image instead.

ShyneTurtle commented 5 months ago

Thank you for your answer.

Enabling SDL didn't fix the ffplay issue.

Using the docker image after clearing out all the old jellyfin data (even in /home/pi/.local/jellyfin ???) the hardware transcoding works in jellyfin.

Thank you again for all the work you have done to bring this amazing chip into a usable state.

nyanmisaka commented 5 months ago

oops. it should be --enable-sdl2

./configure --disable-doc --disable-shared --enable-static --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga --enable-sdl2
ERROR: sdl2 requested but not found
ShyneTurtle commented 5 months ago

I managed to build ffplay using SDL2 However playing video falls back to software decode because of the following error:

[AVHWFramesContext @ 0x7efc0017e0] Failed to map RKMPP object -1 to memory: 9.
[hevc_rkmpp @ 0x7f181274d0] av_hwframe_transfer_data failed: -9
[hevc_rkmpp @ 0x7f181274d0] Decoder failed to get frame: -9
[AVHWFramesContext @ 0x7efc0017e0] Failed to map RKMPP object -1 to memory: 9.
[hevc_rkmpp @ 0x7f181274d0] av_hwframe_transfer_data failed: -9
[hevc_rkmpp @ 0x7f181274d0] Decoder failed to get frame: -9
nyanmisaka commented 5 months ago

It seems there are permission issues in your environment. See the links below to fix them. https://github.com/nyanmisaka/ffmpeg-rockchip/issues/3#issuecomment-1875297620 https://github.com/nyanmisaka/ffmpeg-rockchip#important

nyanmisaka commented 3 months ago

Closing as it can not be reproduced.