JFL
31 July 2023 17:22
21
Can hardware decode jellyfish.mkv with mpv-0.36.0-1
jfl@jfl-gtkpro mpv --gpu-context=wayland --hwdec=v4l2m2m-copy ‘/home/jfl/Videos/Jellyfish_1080_10s_1MB.mkv’
(+) Video --vid=1 (*) (h264 1920x1080 30.000fps)
[vo/gpu/wayland] GNOME’s wayland compositor lacks support for the idle inhibit protocol. This means the screen can blank during playback.
Using hardware decoding (v4l2m2m-copy).
VO: [gpu] 1920x1080 nv12
Invalid video timestamp: 0.000000 → 0.000000
V: 00:00:09 / 00:00:10 (99%)
Exiting… (End of file)
But couldn’t hardware decode BigBunny.mp4
JFL
1 August 2023 03:41
22
Looking forward to test your mpv and ffmpeg builds.
Rip2
1 August 2023 04:52
23
–hwdec=hwdec_drmprime --hwdec-codecs=v4l2m2m, no error but no different?
JFL
1 August 2023 06:07
24
Unfornately, both the above command are basically ignored on Amlogic S922X, no hardware decode. So far, only --hwdec=v4l2m2m-copy works and with mpv-0.36.0-1 only “x264.mkv” video files is hardware decode is available. “mp4” videos does no hardware acceleration on mpv-0.36.0-1.
With ffmpeg-git 6.1 i can hardware decode mp4 big bunny but not jellyfish mkv or youtube h264 with yt-dlp.
I have tested with latest libplacebo-git same result. But i have some errors with opengl and vulkan.
[1/2] Running all tests.
1/14 colorspace.c OK 0.09s
2/14 common.c OK 0.08s
3/14 dither.c OK 0.17s
4/14 lut.c OK 0.14s
5/14 filters.c OK 0.13s
6/14 string.c OK 0.12s
7/14 dummy.c OK 0.33s
8/14 utils.c OK 0.16s
9/14 icc.c OK 0.34s
10/14 dav1d.c OK 0.07s
11/14 tone_mapping.c OK 0.71s
12/14 libav.c OK 0.11s
13/14 opengl_surfaceless.c FAIL 2.90s exit status 1
>>> MALLOC_PERTURB_=77 /home/bloodmoon/.cache/yay/libplacebo-git/src/build/src/tests/test.opengl_surfaceless.c
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Listing only the last 100 lines from a long log.
{0} Executed shader: frame mixing (1 frame), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (1 frame), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: frame mixing (1 frame), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (1 frame), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: frame mixing (1 frame), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (1 frame), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: frame mixing (1 frame), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (1 frame), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: color decoding
{0} Executed shader: frame mixing (2 frames), color encoding
{0} Executed shader: frame mixing (1 frame), color encoding
[2.318][d] (Re)creating 323x255x0 texture with format r16: ../libplacebo/src/utils/upload.c:245
[2.319][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[2.319][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[2.319][e] Failed initializing plane texture!
stderr:
EGL error: EGL_BAD_MATCH
EGL error: EGL_BAD_MATCH
[0.071][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.071][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.072][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.072][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.072][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.072][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.072][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.072][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.072][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.072][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.073][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.073][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.073][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.073][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.073][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.073][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.074][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.074][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.074][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.074][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.074][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.074][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.074][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.074][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.168][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.168][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.168][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.169][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.169][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.169][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[0.169][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[0.169][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[1.652][e] H.274 film grain synthesis requires compute shaders!
[2.319][w] GL: FBO incomplete: driver marked FBO as incomplete [-1]
[2.319][e] Failed creating framebuffer: GL_FRAMEBUFFER_UNSUPPORTED
[2.319][e] Failed initializing plane texture!
=== FAILED: 'pl_upload_plane(gpu, &img.planes[i], &src_tex[i], &data[i])' at ../libplacebo/src/tests/gpu_tests.h:1518
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
14/14 vulkan.c FAIL 9.66s exit status 1
>>> MALLOC_PERTURB_=187 /home/bloodmoon/.cache/yay/libplacebo-git/src/build/src/tests/test.vulkan.c
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Listing only the last 100 lines from a long log.
[9.342][d] [ 6] };
[9.342][d] [ 7] layout(constant_id=0) const float _2 = 1;
[9.342][d] [ 8] layout(constant_id=1) const float _3 = 1;
[9.342][d] [ 9] layout(constant_id=2) const float _8004 = 1;
[9.342][d] [ 10] layout(constant_id=3) const float _8 = 1;
[9.342][d] [ 11] layout(constant_id=4) const float _9 = 1;
[9.342][d] [ 12] layout(constant_id=5) const float _a = 1;
[9.342][d] [ 13] layout(binding=0) uniform sampler2D _8002;
[9.342][d] [ 14] layout(binding=1) uniform sampler2D _7;
[9.342][d] [ 15] layout(location=0) in vec2 _e;
[9.342][d] [ 16] layout(location=0) out vec2 _8003;
[9.342][d] [ 17] layout(location=1) in vec2 _f;
[9.342][d] [ 18] void main() {
[9.342][d] [ 19] _8003 = _e;
[9.342][d] [ 20] vec2 va_pos = _f;
[9.342][d] [ 21] gl_Position = vec4(va_pos, 0.0, 1.0);
[9.342][d] [ 22] }
[9.342][d] fragment shader source:
[9.342][d] [ 1] #version 450
[9.342][d] [ 2] #extension GL_ARB_texture_gather : enable
[9.342][d] [ 3] layout(std430, push_constant) uniform PushC {
[9.342][d] [ 4] layout(offset=0) vec3 _5;
[9.342][d] [ 5] layout(offset=16) mat3 _4;
[9.342][d] [ 6] };
[9.342][d] [ 7] layout(constant_id=0) const float _2 = 1;
[9.342][d] [ 8] layout(constant_id=1) const float _3 = 1;
[9.342][d] [ 9] layout(constant_id=2) const float _8004 = 1;
[9.342][d] [ 10] layout(constant_id=3) const float _8 = 1;
[9.342][d] [ 11] layout(constant_id=4) const float _9 = 1;
[9.342][d] [ 12] layout(constant_id=5) const float _a = 1;
[9.342][d] [ 13] layout(binding=0) uniform sampler2D _8002;
[9.342][d] [ 14] layout(binding=1) uniform sampler2D _7;
[9.342][d] [ 15] layout(location=0) in vec2 _8003;
[9.342][d] [ 16] layout(location=0) out vec4 out_color;
[9.342][d] [ 17]
[9.342][d] [ 18] vec4 _8001() {
[9.342][d] [ 19] // pl_shader_sample_direct
[9.342][d] [ 20] vec4 color = vec4(_8004) * textureLod(_8002, _8003, 0.0);
[9.342][d] [ 21] return color;
[9.342][d] [ 22] }
[9.342][d] [ 23]
[9.342][d] [ 24] #define _6(pos) (texelFetch(_7, ivec2(pos), 0).x)
[9.342][d] [ 25] vec4 _1() {
[9.342][d] [ 26] vec4 color = vec4(_2, vec2(_3), 1.0);
[9.342][d] [ 27] // pass_read_image
[9.342][d] [ 28] {
[9.342][d] [ 29] vec4 tmp;
[9.342][d] [ 30] tmp = _8001();
[9.342][d] [ 31] color[0] = tmp[0];
[9.342][d] [ 32] }
[9.342][d] [ 33] // pl_shader_decode_color
[9.342][d] [ 34] {
[9.342][d] [ 35] color.rgb = _4 * color.rgb + _5;
[9.342][d] [ 36] }
[9.342][d] [ 37] // pl_shader_encode_color
[9.342][d] [ 38] {
[9.342][d] [ 39] }
[9.342][d] [ 40] // pl_shader_dither
[9.342][d] [ 41] {
[9.342][d] [ 42] float bias;
[9.342][d] [ 43] vec2 pos = fract(gl_FragCoord.xy * 1.0/_8);
[9.342][d] [ 44] bias = _6(ivec2(pos * _9));
[9.342][d] [ 45] const float scale = 4294967295.0;
[9.342][d] [ 46] color = scale * color + vec4(bias);
[9.342][d] [ 47] color = floor(color) * (1.0 / scale);
[9.342][d] [ 48] }
[9.342][d] [ 49] color *= vec4(1.0 / _a);
[9.342][d] [ 50] vec4 _b = color;
[9.342][d] [ 51] color = vec4(0.0, 0.0, 0.0, 1.0);
[9.342][d] [ 52] color[0] = _b[0];
[9.342][d] [ 53] color[1] = _b[1];
[9.342][d] [ 54] color[2] = _b[2];
[9.342][d] [ 55] return color;
[9.342][d] [ 56] }
[9.342][d] [ 57]
[9.342][d] [ 58] void main() {
[9.343][d] [ 59] out_color = _1();
[9.343][d] [ 60] }
[9.343][d] Specialization constant values:
[9.343][d] constant_id=0: 0.000000
[9.343][d] constant_id=1: 0.500000
[9.343][d] constant_id=2: 1.000000
[9.343][d] constant_id=3: 64.000000
[9.343][d] constant_id=4: 64.000000
[9.343][d] constant_id=5: 0.000000
[9.348][d] shaderc compile status 'success' (0 errors, 0 warnings)
[9.348][d] Spent 5.851 ms translating SPIR-V
[9.359][d] shaderc compile status 'success' (0 errors, 0 warnings)
[9.359][i] Spent 10.244 ms translating SPIR-V
[9.359][d] Spent 0.050 ms compiling shader
[9.360][d] Spent 1.145 ms creating pipeline
[9.360][d] Pass statistics: size 5532, SPIR-V: vert 748 frag 2176 comp 0
stderr:
[0.038][w] API debugging requested but no debug meta layers present... ignoring
[6.391][w] Spent 1277.562 ms translating SPIR-V (slow!)
[7.779][w] Spent 1214.819 ms translating SPIR-V (slow!)
[8.860][w] Spent 1048.066 ms translating SPIR-V (slow!)
[9.253][w] Debanding requires uploaded textures to be linearly sampleable (params.sample_mode = PL_TEX_SAMPLE_LINEAR)! Disabling debanding..
=== FAILED: 'pl_renderer_get_errors(rr).errors == PL_RENDER_ERR_NONE' at ../libplacebo/src/tests/gpu_tests.h:1138
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Summary of Failures:
13/14 opengl_surfaceless.c FAIL 2.90s exit status 1
14/14 vulkan.c FAIL 9.66s exit status 1
Ok: 12
Expected Fail: 0
Fail: 2
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /home/bloodmoon/.cache/yay/libplacebo-git/src/build/meson-logs/testlog.txt
FAILED: meson-internal__test
Rip2
2 August 2023 02:52
26
how to check v4l2m2m work or not?
Rip2
2 August 2023 07:45
27
ffmpeg-v4l2-request for Rpi
ffmpeg-mpp for Rockchip
ffmpeg-aml for Amlogic
Now with latest ffmpeg-git/mpv-git with mkv, mp4 and youtube (hwdec=v4l2m2m-copy)
[ffmpeg/video] h264_v4l2m2m: output VIDIOC_REQBUFS failed: Invalid argument
[ffmpeg/video] h264_v4l2m2m: no v4l2 output context's buffers
[ffmpeg/video] h264_v4l2m2m: can't configure decoder
https://trac.ffmpeg.org/query?status=!closed&keywords=~v4l2m2m
and
accelerated decoding not working on Raspberry Pi with newer kernels
This explains why a few months ago we could use hardware decoding. Which regains interest with firefox 116.
As mentioned in the firefox thread yesterday I had issues compiling mpv againstARCH’s ffmmpeg-rpi. Today I found that the ffmpeg-rpi package had issues placing it’s .pc files for it’s modules. I finally got mpv 0.36 compiled today with ffmpeg-rpi (v4.4) and seems to be working pretty good playing h264’s.
The stoutest vid I could find on a quick search:
mediainfo
General
Unique ID : 180095094178597437752096238712062376784 (0x877D0DB0503F6FE28ECD479547FE7B50)
Complete name : /home/ray/Downloads/FPS_test_1080p59.94_L4.2.mkv
Format : Matroska
Format version : Version 4
File size : 25.8 MiB
Duration : 10 min 5 s
Overall bit rate mode : Variable
Overall bit rate : 357 kb/s
Frame rate : 59.940 FPS
Encoded date : 2014-09-18 20:05:11 UTC
Writing application : mkvmerge v7.2.0 (‘On Every Street’) 32bit built on Sep 13 2014 15:42:11
Writing library : libebml v1.3.0 + libmatroska v1.4.1
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.2
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 10 min 5 s
Bit rate : 354 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 59.940 (60000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.003
Stream size : 25.5 MiB (99%)
Htop playing the h264 mkv:
mpv startup in terminal
[ray@jellyfin]$ mpv --hwdec=v4l2m2m FPS_test_1080p59.94_L4.2.mkv
(+) Video --vid=1 () (h264 1920x1080 59.940fps)
(+) Audio --aid=1 --alang=eng ( ) (mp3 2ch 48000Hz)
Using hardware decoding (v4l2m2m).
AO: [pipewire] 48000Hz stereo 2ch floatp
VO: [gpu] 1920x1080 drm_prime [yuv420p]
AV: 00:01:07 / 00:10:05 (11%) A-V: 0.000 Dropped: 89
Notice it “Using hardware decoding (v4l2m2m)” and VO: is using drm_prime above.
I will post my mpv build here as soon as I get it uploaded.
Here is the mpv compiled against ffmpeg-rpi I mentioned in the previous post. This has ffmpeg-rpi and mpv. Install them both.
See post #47 below for newer packages.
Rip2
16 August 2023 21:42
31
‘had issues placing it’s .pc files for it’s modules’, whats mean?
Should only matter if compiling mpv. The compiler could not find the .pc files where the ffmpeg-rpi package put them. Since I only had ffmpeg-rpi installed so mpv could use it when compiling I copied them over to /usr/lib/pkgconfig/ with all of the other .pc files. After compiling I removed them when I installed the ffmpeg v6 package since it’s .pc files go there. ffmpeg and ffmpeg-rpi can be installed at the same time after mpv was compiled with ffmpeg-rpi since mpv only looks for the lib versions it was compiled with.
The only issue I have seen with this done is with vlc not working right since it is compiled with the package ffmpeg4.4 which has the same lib versions that are not specially patched. I did not recompile vlc to see if there would be any difference though.
Rip2
17 August 2023 00:37
33
ok, got error
mpv --hwdec=v4l2m2m Sultan_of_Swing.mp4
Unsupported hwdec: v4l2m2m
I not sure why or what program versions you are testing or what all you have installed. As for here All I have installed is the ones in the link above (mpv / ffnpeg-rpi v4.4) and ffmpeg (v6).
[ray@jellyfin AKA.2023]$ mpv --hwdec=v4l2m2m AKA\ \(2023\).mp4
(+) Video --vid=1 (*) (h264 720x480 25.000fps)
(+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
Subs --sid=1 (*) (mov_text)
File tags:
Title: AKA (2023)
Using hardware decoding (v4l2m2m).
AO: [pipewire] 48000Hz stereo 2ch floatp
VO: [gpu] 720x480 => 1152x480 drm_prime[yuv420p]
AV: 00:00:04 / 02:04:20 (0%) A-V: 0.000
Every once in a while I do see some weird things going on with some mp4’s that won’t play using --hwdec=v4l2m2m
Rip2
17 August 2023 06:09
35
can do this, no error but no v4l2 showed.
mpv --hwdec-codecs=h264_v4l2m2m-copy
JFL
17 August 2023 07:04
36
Hi @Darksky , After install ffmpeg-rpi, does it conflict with ffmpeg-6.0-8. Reason for this, is that Chromium requires ffmpeg-6.0-8, else it will NOT launch/work.
Does not conflict with ffmpeg 6. It does break vlc and chromium though.
1 Like
JFL
17 August 2023 17:24
38
Then it is the same/similar to the current ffmpeg-m2m. The current ffmpeg-m2m is in conflict with the regular ffmpeg (6.0-8), and Chromium will no longer works once ffmpeg-m2m is installed.
1 Like
Rip2
22 August 2023 12:27
39
ok, build ffmpeg --enable-omx --enable-omx-rpi & EXTRA_FFMPEG_CONF=‘extra-cflags=“-I/opt/vc/include/IL”’.
build mpv -Drpi=enabled -Domx=enabled.
mpv --hwdec-codecs=omx big_bunny_1280x720.mp4, cpu usage 2x% up/down, no error.
Darksky:
--hwdec=v4l2m2m
Would like to see the output in the terminal when you run mpv.
I still do not understand why you can not use v4l2m2m running mpv compiled with ffmpeg-rpi I posted a link to above.