Jump to content

Recommended Posts

Posted

I‘m using an OrangePi Lite with the intent to display a 4kp30 video to a 4k TV over hdmi.

 

from reading through the forums I saw that mainline kernel does not support video acceleration - is this information current?

 

after installing the Xenial Image with 3.4 kernel I manage to play 1440p video smoothly two ways with mpv:

 

- windowed if display resolution is set to 4k

-fullscreen if display resolution is set to 1080p

 

if I try to run the 1440p video at 4k display resolution in fullscreen, the app crashes with messages about ‚not enough resources to create surface‘ and the framebuffer stays corrupted after that and I have to reboot.

 

The same happens if I try to play the 4k30p video (independently of whether I run it fullscreen or windowed, 4k or 1080p display res. I also tried both h264 and h265).

 

I Played around with extraargs=cma=... sunxi_ve_mem_reserve=... in ArmbianEnv.txt but it didn‘t seem to have effect. The docs state that in the 3.4 kernel the video memory is hardcoded to 80MB (not sure if I understood that correctly though) which probably would prevent 4k playback with that kernel.

 

on https://linux-sunxi.org/Cedrus/libvdpau-sunxi it's stated that:

This can be set by the following kernel argument.

sunxi_ve_mem_reserve=128
NOTE: This kernel parameter is ignored in recent linux-sunxi 3.4 kernels, if CMA is enabled in kernel configuration. If CONFIG_CMA=y, ve_size is hardcoded to 80MB in sunxi_cedar kernel module.

For A33 or H3, if you use the kernel from official SDK, you should modify the memory reservation configuration of ion memory allocator. 32 MB seems to be enough for 720p H.264 decoding, and 64MB is enough for 1080p H.264 decoding.

But I don't know what it means to modify the memory reservation configuration of ion memory allocator and how to do that?

 

Is there any kernel available which can playback hardware accelerated 4k30p video on Orange Pi Lite (H3) and if so, how do I need to go about to setup my Xenial installation to make use of it?

Posted

Hi!

 

HW video decoding on mainline kernel is possible, but in most cases you have to do some kernel patching yourself and use special library which provides VAAPI or use modified ffmpeg libraries. MPEG2 decoding is possible with kernel 5.0 or 5.1 (not sure), basic H264 decoding will be possible with kernel 5.3 and HEVC decoding will probably come with kernel 5.5 (patches already exist). Note that H264 and HEVC codecs are feature incomplete currently. However, I did some improvements for LibreELEC and there most H264 and HEVC videos work. Patches are available on LibreELEC github but are incompatible with VAAPI library, so only option is to use modified ffmpeg.

 

Regarding memory consumption, please note that with OrangePi Lite you have only 512 MiB of RAM which is a bit low. LibreELEC for that reason doesn't support devices with less than 1 GiB of RAM. Consider following calculations for memory requirements, no matter which kernel you use:

1. Multiple variants of 4K and 1440p resolutions exist, so I'll assume that 4K means 4096x2160 (same as on my LG TV) and 1440p means 2560x1440

2. kernel allocates one XRGB (4 bytes per pixel) buffer for user interface (no matter if you're using window manager or not), so for that you need 4096*2160*4 ~ 34 MiB of CMA memory

3. video is decoded to NV12 or NV21 formats and both take 1.5 byte per pixel, that means 2560*1440*1.5 = 5.27 MiB of CMA memory per single frame

4. worst case for H264 and HEVC is that you need 16 reference frames to properly decode current frame, which means additional 5.27 * 16 ~ 84 MiB of CMA memory

5. VPU needs additional scratch buffers per frame. Size of those buffers depends on codec features used, but for H264 is typically about 1/4th of multiplied width and height, so in worst case (1 + 16)*2560*1440/4  ~ 15 MiB of CMA memory

6. VPU needs some other scratch buffers, but they are small, about 1 MiB in total

7. you also need additional CMA memory for providing encoded data to VPU, but memory consumption for that heavily depends on userspace library/player implementation. Hard to give any estimation, so let's use 20 MiB.

 

Final estimation for worst case display + VPU CMA consumption for 4K display and 1440p video: 34 + 5.27 + 84 + 15 + 1 + 20 ~ 160 MiB. You also have to consider that other devices may use CMA memory at the same time. In LibreELEC, CMA memory size is set to 256 MiB because so much is needed for decoding 4K videos.

 

Hopefully that gives you perspective how much memory is needed for H264/HEVC video decoding.

 

I won't touch (use) 3.4 kernel anymore, but I can help you with patching mainline kernel for better H264 and/or HEVC support and bring up ffmpeg based solutions (that includes mpv), if you want.

Posted

Thank you for all the input. Really the only thing I want to do on this device is to playback this single video file in an infinite loop on 4k. So I really don't bother how old the kernel is or what other features there are, so long as it plays the video. It doesn't even need sound and there are no other processes running that I'd need. Is there any old (older than 3.4) image available that had hardware acceleration and for which video memory was not hardcoded to 80MB?

Posted

In the old days, I provided OpenELEC images with 3.4 kernel (https://github.com/jernejsk/OpenELEC-OPi2) and it worked with 4K videos on 1080p display. Sadly, images don't exist anymore and source doesn't build anymore. Be aware, I used CedarX library instead of libvdpau-sunxi.

 

I don't think I ever make it work with 4K screens, mostly because I didn't have such screen at the time.

Posted
3 hours ago, jernej said:

@manuti No, I really didn't. Good to know.


I made an archive/backup when you said down.nu is going to be closed. And also more or less forget about :) 

Posted (edited)
On 9/10/2019 at 4:14 PM, jernej said:

HW video decoding on mainline kernel is possible, but in most cases you have to do some kernel patching yourself and use special library which provides VAAPI or use modified ffmpeg libraries.

...

I won't touch (use) 3.4 kernel anymore, but I can help you with patching mainline kernel for better H264 and/or HEVC support and bring up ffmpeg based solutions (that includes mpv), if you want.

I would appreciate if you share how to patch mainline kernel for HEVC support and how to make mpv use hardware decoding. I have some experience compiling Linux kernel on desktop, and I know how to compile ffmpeg and mpv. But I do not know what patches I need for the kernel and ffmpeg/mpv, and I'm not sure what options I need to provide to mpv to make it actually work with hardware decoding on Orange Pi Lite. Currently there is little information about this.

 

For me 3.4 kernel does not work at all (produces black screen with my HDMI display). Armbian with 5.3 worked, except I cannot figure out how to get hardware video decoding (I think 5.3 has some support for H.264 but I could not figure out how to use it, and I prefer to use H.265 if possible).

 

Some information about my project. I have Orange Pi Lite with 512MB RAM. I know it is not much but if I could make it playback high resolution videos it would be great (even if it would be bare X with mpv and nothing else). In my case I do not really need full 4K. I need this for FPV project so my video stream will not have more than 1 reference frame to keep latency low. I tested my camera at 1FPS and measured 1 frame decoding delay with HEVC and 0 frame delay with MJPEG (I tested MJPEG to make sure I can make mpv not to buffer frames unless really necessary for decoding, since MJPEG by definition does not require previous frames to decode; I have used --profile=low-latency --untimed options to get low latency). I plan to use 2560x1440 HDMI 5.5 inch display and I will receive it in next few weeks (for now for testing I use 1920x1080 display). My camera produces 4:3 5MP HEVC video stream with 2592x1944 resolution at 30FPS.

 

I tried to calculate my memory requirements based on your example:

  1. 14 MiB 2560x1440 XRGB buffer
  2. 5.27 MiB of CMA memory per single frame 2592x1944
  3. Additional 5.27 MiB of CMA memory for up to 1 reference frame
  4. 2.4MiB for "scratch buffer"
  5. 1MiB some other scratch buffers
  6. I do not know how much CMA memory is needed for providing encoded data to VPU but 20MiB sounds like reasonable amount

Total is about 50MiB. So my project sounds something like Orange Pi Lite could handle if I could get hardware decoding working. I would be grateful for any help or clues how to achieve that.

Edited by Lissanro
Posted
On 9/17/2019 at 11:08 PM, Lissanro said:

Armbian with 5.3 worked, except I cannot figure out how to get hardware video decoding (I think 5.3 has some support for H.264 but I could not figure out how to use it, and I prefer to use H.265 if possible).

It's tricky and needed kernel header files are not exposed in UAPI (userspace API) yet because they are still evolving and changing.

 

You can try following:

1. Apply Linux patches 1 (you can filter out only media related patches), 5, 7-11 on kernel 5.3: https://github.com/jernejsk/LibreELEC.tv/tree/cedrus_update/projects/Allwinner/patches/linux

2. Apply all FFmpeg patches on FFmpeg 4.0.4 (it is easy to port those patches on newer version, to avoid rebuilding mpv): https://github.com/jernejsk/LibreELEC.tv/tree/cedrus_update/packages/multimedia/ffmpeg/patches/v4l2-request-api

3. Compile FFmpeg with at least following options

--enable-v4l2-request --enable-libudev --enable-libdrm

4. Recompile mpv if needed - depends on FFmpeg version used. If it matches to what was was used to compile mpv with, then there is no need.

5. Add your user to appropriate group ("video" I think) so you can use VPU without root privileges.

 

Now you should have working mpv with HW accelerated decoding. As I don't use any desktop on SBCs, I run mpv with following options:

mpv --hwdec=auto --vo=drm video.mkv

This gives you most speed - HW decoded and directly rendered by DRM driver, so CPU is not involved. Only downside is that it is fullscreen only. Not sure how big performance hit (CPU usage) you would get with X11.

Posted

Thank you jernej for the detailed instructions.

I successfully built 5.3 kernel with cedrus driver enabled and the patched ffmpeg 4.0.4 on a NanoPiNeo

I'm interested in processing streams from ip cameras on headless devices and I don't require mpv.
I tried to directly run ffmpeg to test hardware decoding but it doesn't seem to take advantage of the hardware acceleration.
CPU is still very high. I piped the output to a named pipe in order to discard it to remove any writing overhead to SD disk.
Have you got any hints to take advantage of the hw accel?
 

> cat outpipe > /dev/null
> ffmpeg -i ipc47_seq03.h264 -c:v rawvideo -pix_fmt yuv420p -f rawvideo pipe:1 > outpipe
ffmpeg version n4.0.4 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)
  configuration: --enable-v4l2-request --enable-libudev --enable-libdrm
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
Input #0, h264, from 'ipc47_seq03.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Output #0, rawvideo, to 'pipe:1':     0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, q=2-31, 622080 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.18.100 rawvideo
av_interleaved_write_frame(): Broken pipeB time=00:00:53.28 bitrate=605734.1kbits/s speed=0.911x    
Error writing trailer of pipe:1: Broken pipe
frame= 1305 fps= 22 q=-0.0 Lsize= 3960900kB time=00:00:53.60 bitrate=605367.4kbits/s speed=0.911x    
video:3963938kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown


> armbianmonitor -m
11:57:25: 1368MHz  2.62  94%  16%  77%   0%   0%   0% 59.3°C  0/8
11:57:31: 1368MHz  2.73  94%  16%  77%   0%   0%   0% 59.3°C  0/8
11:57:36: 1368MHz  2.75  94%  16%  77%   0%   0%   0% 60.9°C  0/8

> top
top - 11:57:01 up  3:49,  3 users,  load average: 2.35, 0.96, 0.66
Tasks: 112 total,   2 running,  64 sleeping,   0 stopped,   0 zombie
%Cpu(s): 78.7 us, 16.0 sy,  0.0 ni,  5.2 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem :   502912 total,   238052 free,   100316 used,   164544 buff/cache
KiB Swap:   251452 total,   238472 free,    12980 used.   391764 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                       
31161 armbi     20   0  157540  52764   8760 R 350.2 10.5   0:43.71 ffmpeg                                                                        
31162 armbi     20   0    1548    336    292 S  29.2  0.1   0:03.13 cat                                                                           
31158 armbi     20   0    4680   2096   1680 R   1.6  0.4   0:00.74 top                                                                           
  373 root     -51   0       0      0      0 S   0.3  0.0   0:03.28 irq/54-ths                                                                    
 1009 root      20   0    4680    552    484 S   0.3  0.1   0:00.16 cron 

 

 

Posted

I don't know, first try with mpv? If that works, we can be sure that it works and move forward. Did you fix your user permissions? or just for sake of trying, can you run it as root?

Posted

Thank you for quick reply.

That was first attempt I made but I got troubles:

 

> mpv --hwdec=auto --vo=drm ipc47_seq01.mp4
Playing: ipc47_seq01.mp4
 (+) Video --vid=1 (*) (h264 1920x1088 9.939fps)
[vo/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
[vo/drm] Cannot retrieve DRM resources: Operation not supported
[vo/drm] Failed to create KMS.
Error opening/initializing the selected video_out (--vo) device.
Video: no video
No video or audio streams selected.


Exiting... (Errors when loading file)

 

 

Posted

Sure, thank you.

Read below.

 

What is not clear to me is if your patches still use VAAPI.

In that case I've not yet installed (because of compilation errors to solve) libva-v4l2-request as suggested by https://linux-sunxi.org/Sunxi-cedrus
 

libva-v4l2-request

The main userspace component that supports the Cedrus VPU driver is the libva-v4l2-request VAAPI backend. It is available at:

Repository: https://github.com/bootlin/libva-v4l2-request

In the very same page it's also suggested for VLC, but could be the same for FFMPEG, to

export LIBVA_DRIVER_NAME=v4l2_request

 

Here's the output by MPV:

sudo mpv -v --hwdec=auto --vo=drm ipc47_seq01.mp4
[sudo] password for armbi:
[cplayer] Command line options: '-v' '--hwdec=auto' '--vo=drm' 'ipc47_seq01.mp4'
[cplayer] mpv 0.28.2 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
[cplayer]  built on Sun Sep 22 11:14:34 UTC 2019
[cplayer] ffmpeg library versions:
[cplayer]    libavutil       56.14.100
[cplayer]    libavcodec      58.18.100
[cplayer]    libavformat     58.12.100Aout
[cplayer]    libswscale      5.1.100
[cplayer]    libavfilter     7.16.100
[cplayer]    libswresample   3.1.100
[cplayer] ffmpeg version: n4.0.4
[cplayer]
[cplayer] Configuration: ./waf configure
[cplayer] List of enabled features: alsa asm atomics build-date cplayer cplugins cuda-hwaccel debug-build drm drmprime egl-drm egl-helpers egl-x11 encoding fchmod ffmpeg gbm gbm.h gl gl-x11 glibc-thread-name glob glob-posix gnuc gpl iconv libaf libass libass-osd libav-any libavcodec libavdevice libdl libm librt linux-fstatfs optimize oss-audio posix posix-or-mingw posix-spawn posix-spawn-native pthreads pulse stdatomic vaapi vaapi-drm vaapi-egl vaapi-glx vaapi-x-egl vaapi-x11 vdpau vdpau-gl-x11 vt.h x11 xv zlib
[cplayer] Reading config file /usr/local/etc/mpv/encoding-profiles.conf
[cplayer] Playing: ipc47_seq01.mp4
[file] Opening ipc47_seq01.mp4
[demux] Trying demuxers for level=normal.
[lavf] Found 'mov,mp4,m4a,3gp,3g2,mj2' at score=100 size=2048.
[demux] Detected file format: mov,mp4,m4a,3gp,3g2,mj2 (libavformat)
[cplayer] Opening done: ipc47_seq01.mp4
[find_files] Loading external files in .
[lavf] select track 0
[cplayer]  (+) Video --vid=1 (*) (h264 1920x1088 9.939fps)
[vo/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
[vo/drm] Cannot retrieve DRM resources: Operation not supported
[vo/drm] Failed to create KMS.
[cplayer] Error opening/initializing the selected video_out (--vo) device.
[lavf] deselect track 0
[cplayer] Video: no video
[cplayer] No video or audio streams selected.
[cplayer] finished playback, no audio or video data played (reason 4)
[cplayer]
[cplayer]
[cplayer] Exiting... (Errors when loading file)

The issue is in 'bool vt_switcher_init(struct vt_switcher *s, struct mp_log *log)' in drm_common.c where:

   if (ioctl(s->tty_fd, VT_SETMODE, &vt_mode) < 0) {
        MP_ERR(s, "VT_SETMODE failed: %s\n", mp_strerror(errno));
        return false;
    }

 

Posted

Digging a bit more

Calling v4l2-ctl --log-status I'm getting the same 'Inappropriate ioctl for device' seen before

> v4l2-ctl --list-devices --verbose
cedrus (platform:cedrus):
    /dev/video0

VIDIOC_QUERYCAP: ok
> v4l2-ctl --log-status --verbose
VIDIOC_QUERYCAP: ok
VIDIOC_LOG_STATUS: failed: Inappropriate ioctl for device

 

Posted
7 hours ago, FGuerzoni said:

What is not clear to me is if your patches still use VAAPI.

I haven't been clear enough. You can go either ffmpeg way or VAAPI way (technically using VAAPI with ffmpeg should be possible, but that's not tested). So no, VAAPI is not used.

 

Are you running this in desktop environment? If so, it won't work. You have to shut down whatever desktop you're using and run this command from command line. Note that this is only for test to see if known good configuration works.

Posted

Thank you jernej,

there's no desktop environment at all and I'm running command from the command line.

I'm using just the standard megous DEV branch patched with the kernel patches you suggested.

 

I'm already able to run on the same device the VAAPI stack, which is quite limited because it's able to correctly decode only the base profile.

From previous posts I got the fact that the ffmpeg way could decode any h264 profiles. Is it right?

If so I'm very interested to make it work, because I don't have any idea when the VAAPI stack will be fully implemented.

 

Regards

F

Posted

log status is not implemented by cedrus. Do you have /dev/dri/card0? Do you have any monitor connected? It seems to me that mpv can't find any monitor.

 

2 hours ago, FGuerzoni said:

From previous posts I got the fact that the ffmpeg way could decode any h264 profiles. Is it right?

Yes, it should. But kernel patches used in LE and FFmpeg contain hacks which are used to handle some cases (interlaced videos). That makes interface incompatible for VAAPI library until right approach is agreed upon and implemented. This may take a while, though.

Posted

Yes I have /dev/dri/card0

> ls /dev/dri/card0
/dev/dri/card0

but I don't have any monitor connected. NanoPiNeo doesn't have any HDMI output.

Sorry, I wasn't aware that the physical monitor is mandatory.

So with my device the only way is to dig into ffmpeg and understand why it's apparently not using the hw accels.

I'll post results in case I'll get them.

Thank you again

Regards

F

Posted

ok, I didn't know that neo doesn't have HDMI output. In that case, you can replace "drm" with "null". I think it should still give useful output.

Posted

I had some progresses using 'null'.

But it's logging that it's using software decoding.

From that the fact the cpu is very high.

> mpv --vo=null --hwdec=auto -v bbb_1080p.mp4 
[cplayer] Command line options: '--vo=null' '--hwdec=auto' '-v' 'bbb_1080p.mp4'
[cplayer] mpv 0.28.2 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
[cplayer]  built on Sun Sep 22 11:14:34 UTC 2019
[cplayer] ffmpeg library versions:
[cplayer]    libavutil       56.14.100
[cplayer]    libavcodec      58.18.100
[cplayer]    libavformat     58.12.100
[cplayer]    libswscale      5.1.100
[cplayer]    libavfilter     7.16.100
[cplayer]    libswresample   3.1.100
[cplayer] ffmpeg version: n4.0.4
[cplayer] 
[cplayer] Configuration: ./waf configure
[cplayer] List of enabled features: alsa asm atomics build-date cplayer cplugins cuda-hwaccel debug-build drm drmprime egl-drm egl-helpers egl-x11 encoding fchmod ffmpeg gbm gbm.h gl gl-x11 glibc-thread-name glob glob-posix gnuc gpl iconv libaf libass libass-osd libav-any libavcodec libavdevice libdl libm librt linux-fstatfs optimize oss-audio posix posix-or-mingw posix-spawn posix-spawn-native pthreads pulse stdatomic vaapi vaapi-drm vaapi-egl vaapi-glx vaapi-x-egl vaapi-x11 vdpau vdpau-gl-x11 vt.h x11 xv zlib
[cplayer] Reading config file /usr/local/etc/mpv/encoding-profiles.conf
[cplayer] Playing: bbb_1080p.mp4
[file] Opening bbb_1080p.mp4
[demux] Trying demuxers for level=normal.
[lavf] Found 'mov,mp4,m4a,3gp,3g2,mj2' at score=100 size=2048.
[demux] Detected file format: mov,mp4,m4a,3gp,3g2,mj2 (libavformat)
[cplayer] Opening done: bbb_1080p.mp4
[find_files] Loading external files in .
[lavf] select track 0
[lavf] select track 1
[cplayer]  (+) Video --vid=1 (*) (h264 1920x1080 30.002fps)
[cplayer]  (+) Audio --aid=1 --alang=und (*) (aac 2ch 44100Hz)
[vd] Container reported FPS: 30.001577
[vd] Codec list:
[vd]     h264 - H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
[vd]     h264_v4l2m2m (h264) - V4L2 mem2mem H.264 decoder wrapper
[vd] Opening video decoder h264
[vd] Looking at hwdec h264-vdpau...
[vd] Could not create device.
[vd] Looking at hwdec h264-vaapi...
[vd] Could not create device.
[vd] Looking at hwdec h264-vdpau-copy...
[vd] Could not create device.
[vd] Looking at hwdec h264-vaapi-copy...
[vaapi] libva: VA-API version 1.1.0
[vaapi] libva: va_getDriverName() returns -1
[vaapi] libva: va_getDriverName() failed with unknown libva error,driver_name=(null)
[vd] Could not create device.
[vd] Looking at hwdec h264_v4l2m2m-v4l2m2m-copy...
[vd] Trying hardware decoding via h264_v4l2m2m-v4l2m2m-copy.
[vd] Using underlying hw-decoder 'h264_v4l2m2m'
[ffmpeg] h264_v4l2m2m: driver 'cedrus' on card 'cedrus'
[ffmpeg] h264_v4l2m2m: Could not find a valid device
[ffmpeg] h264_v4l2m2m: can't configure decoder
[vd] Could not open codec.
[vd] Falling back to software decoding.
[vd] Detected 4 logical cores.
[vd] Requesting 5 threads for decoding.
[vd] Selected video codec: h264 (H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10)
[ad] Codec list:
[ad]     aac - AAC (Advanced Audio Coding)
[ad]     aac_fixed (aac) - AAC (Advanced Audio Coding)
[ad] Opening audio decoder aac
[ad] Requesting 1 threads for decoding.
[ad] Selected audio codec: aac (AAC (Advanced Audio Coding))
[cplayer] Starting playback...
[af] Audio filter chain:
[af]   [in] 44100Hz stereo 2ch floatp
[af]   [out] 44100Hz stereo 2ch floatp
[af]   [ao] 44100Hz stereo 2ch floatp
[ao] Trying audio driver 'pulse'
[ao/pulse] requested format: 44100 Hz, stereo channels, floatp
[ao/pulse] Library version: 11.1.0
[ao/pulse] Proto: 32
[ao/pulse] Server proto: 4294967295
[ao] Trying audio driver 'alsa'
[ao/alsa] requested format: 44100 Hz, stereo channels, floatp
[ao/alsa] using ALSA version: 1.1.3
[ao/alsa] opening device 'default'
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
[ao/alsa] Playback open error: No such file or directory
[ao] Trying audio driver 'oss'
[ao/oss] requested format: 44100 Hz, stereo channels, floatp
[ao/oss] using '/dev/mixer' mixer device
[ao/oss] using 'pcm' mixer channel
[ao/oss] using '/dev/dsp' dsp device
[ao/oss] Can't open audio device /dev/dsp: No such file or directory
[ao] Failed to initialize audio driver 'oss'
[cplayer] Could not open/initialize audio device -> no sound.
[ad] Uninit audio decoder.
[lavf] deselect track 1
[cplayer] Audio: no audio
[vd] Using software decoding.
[vd] Decoder format: 1920x1080 yuv420p auto/auto/auto/auto CL=mpeg2/4/h264 (auto 0.000000/0.000000/0.000000)
[vd] Using container aspect ratio.
[vf] Video filter chain:
[vf]   [in] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited SP=1.000000 CL=mpeg2/4/h264
[vf]   [out] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited SP=1.000000 CL=mpeg2/4/h264
[cplayer] VO: [null] 1920x1080 yuv420p
[cplayer] VO: Description: Null video output
[cplayer] first video frame after restart shown
[cplayer] playback restart complete
[statusline] V: 00:05:08 / 00:10:34 (48%) Dropped: 508
[cplayer] EOF code: 6  
[vd] Uninit video.
[cplayer] finished playback, success (reason 3)
[cplayer] 
[cplayer] 
[cplayer] Exiting... (Quit)

 

> top - 21:39:21 up  1:33,  2 users,  load average: 3.12, 1.37, 0.56
Tasks: 109 total,   1 running,  61 sleeping,   0 stopped,   0 zombie
%Cpu(s): 65.7 us,  1.0 sy,  0.0 ni, 33.2 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem :   502912 total,     6120 free,   117948 used,   378844 buff/cache
KiB Swap:   251452 total,   250172 free,     1280 used.   373080 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                       
 1721 armbi     20   0  179360  74832  11708 S 265.3 14.9   6:05.28 mpv                                                                           
 1439 armbi     20   0    4680   2200   1732 R   0.7  0.4   0:08.04 top                                                                           
 1720 root      20   0       0      0      0 I   0.3  0.0   0:00.05 kworker/0:2-eve     

 

Posted

It seems that your ffmpeg doesn't support request api decoding. You can check that by searching for "h264_v4l2request" in output of "ffmpeg -decoders". Can you give your configuration output printed by "ffmpeg" (without any parameters)?

Posted

You are right,

even if I don't understand why because I've explicitly set  '--enable-v4l2-request'

 

> ffmpeg
ffmpeg version n4.0.4 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)
  configuration: --enable-v4l2-request --enable-libudev --enable-libdrm
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

> ffmpeg -decoders | grep h264
ffmpeg version n4.0.4 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)
  configuration: --enable-v4l2-request --enable-libudev --enable-libdrm
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
 VFS..D h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
 V..... h264_v4l2m2m         V4L2 mem2mem H.264 decoder wrapper (codec h264)

> ffmpeg -hwaccels
ffmpeg version n4.0.4 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)
  configuration: --enable-v4l2-request --enable-libudev --enable-libdrm
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
Hardware acceleration methods:
vdpau
vaapi
drm

 

Posted

ffmpeg configure script does some checking and if no appropriate library is found, option is disabled anyway. Can you make sure that you have libdrm, libudev and kernel headers installed?

Posted

Maybe I have problems on kernel headers.

Please confirm me that this is the right way to search for them

> whereis libdrm
libdrm: /usr/lib/arm-linux-gnueabihf/libdrm.so /usr/include/libdrm /usr/share/libdrm

> whereis libudev
libudev: /lib/arm-linux-gnueabihf/libudev.so /usr/include/libudev.h /usr/share/man/man3/libudev.3.gz

> sudo ls /usr/src/kernels/$(uname -r) 
ls: cannot access '/usr/src/kernels/5.3.0-sunxi': No such file or directory

 

Posted

I checked the armbian config-default.conf where the option is empty instead of "yes"

 

INSTALL_HEADERS="" # install kernel headers package

 

Tomorrow I'll rebuild everything and I'll let you know if it's working

Thanks and regards

 

Posted

After complete rebuild and reinstall of everything it's still not working.

It falls back to software decoding with cpu over 350%

The file to decode is the standard Big Bucket Bunny at 1080p

> whereis libdrm
libdrm: /usr/lib/arm-linux-gnueabihf/libdrm.so /usr/include/libdrm /usr/share/libdrm
> whereis libudev
libudev: /lib/arm-linux-gnueabihf/libudev.so /usr/include/libudev.h /usr/share/man/man3/libudev.3.gz
> ls /usr/src/linux-headers-5.3.1-sunxi/
Documentation  Makefile        arch   certs   drivers  include  ipc     lib  net      scripts   sound  usr
Kconfig        Module.symvers  block  crypto  fs       init     kernel  mm   samples  security  tools  virt

and mpv log of

> mpv --vo=null --hwdec=auto -v bbb_1080p.mp4

is in the attached file.

 

 

mpv_log_201909241048

Posted

I guess that if you specify only those arguments I gave you to ffmpeg configure script it will build monolithic binaries which is not what you want. I suggest that you check what arguments were used to build ffmpeg from Debian repository by reinstalling it  from repository and running "ffmpeg" without any arguments. Use them and add those which I mentioned. After you build ffmpeg and install it, I think mpv will complain that it can't run with different ffmpeg libraries. Then you have to rebuild mpv.

Posted

Thank you, I did a first quick attempt because of little time available, but I was not able to build ffmpeg with so many options. I got troubles installing so many libraries and make them available to ffmpeg. I'll retry later.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines