[solved] mmal hardware acceleration works only with root

Talk about the project itself, the community, where we are and what we need. Great place to introduce yourself and make friends as well.

[solved] mmal hardware acceleration works only with root

Postby acconciox » Sun Sep 29, 2019 5:38 pm

Hi, if i run
$this->bbcode_second_pass_code('', 'mpv movie.mkv # or mp4 or .VOB')
i get this message;
$this->bbcode_second_pass_code('', 'mmal: mmal_vc_shm_init: could not initialize vc shared memory service
mmal: mmal_vc_component_create: failed to initialise shm for 'vc.ril.video_render' (7:EIO)
mmal: mmal_component_create_core: could not create component 'vc.ril.video_render' (7)')

if i run
$this->bbcode_second_pass_code('', '·sudo mpv movie.mkv # it works with hardware acceleration even if i dont know where get the --vo --hwdec description as root ')

Im using ffmpeg-mmal and mpv-rpi
$this->bbcode_second_pass_code('', ' $ pacman -Qi mpv-rpi
Nome : mpv-rpi
Versione : 1:0.29.1-1
Descrizione : mpv with Raspberry Pi support
Architettura : armv7h
URL : https://mpv.io/
Licenze : GPL3
Gruppi : Nessuno
Fornisce : mpv
Dipenda da : desktop-file-utils ffmpeg-mmal hicolor-icon-theme jack
lcms2 libarchive libcaca libcdio-paranoia libdvdnav libgl
libva libxinerama libxkbcommon libxrandr libxss libxv
lua52 rubberband smbclient uchardet vulkan-icd-loader
wayland xdg-utils
Dipendenze opzionali : youtube-dl: for video-sharing websites playback [installato]
Richiesto da : Nessuno
Opzionale per : Nessuno
Conflitti con : mpv
Sostituisce : Nessuno
Spazio richiesto : 3,81 MiB
Pacchettizzatore : Unknown Packager
Data di creazione : dom 29 set 2019, 18:25:22
Data di installazione : dom 29 set 2019, 18:34:11
Motivo dell'installazione : Installato esplicitamente
Script di install : No
Convalidato da : Nessuno

$ pacman -Qi ffmpeg-mmal
Nome : ffmpeg-mmal
Versione : 1:4.2-1
Descrizione : ffmpeg built with MMAL hardware acceleration support for Raspberry Pi
Architettura : armv7h
URL : https://ffmpeg.org/
Licenze : GPL3
Gruppi : Nessuno
Fornisce : ffmpeg libavcodec.so=58-32 libavdevice.so=58-32 libavfilter.so=7-32 libavformat.so=58-32
libavutil.so=56-32 libpostproc.so=55-32 libswresample.so=3-32 libswscale.so=5-32
Dipenda da : alsa-lib bzip2 fontconfig fribidi gmp gnutls gsm jack lame libass.so=9-32 libavc1394
libbluray.so=2-32 libdav1d.so=2-32 libdrm libfreetype.so=6-32 libiec61883 libmodplug libomxil-bellagio
libpulse libraw1394 libsoxr libssh libtheora libva.so=2-32 libva-drm.so=2-32 libva-x11.so=2-32
libvdpau libvidstab.so=1.1-32 libvorbisenc.so=2-32 libvorbis.so=0-32 libvpx.so=6-32 libwebp libx11
libx264.so=157-32 libx265.so=176-32 libxcb libxext libxml2 libxv libxvidcore.so=4-32 opencore-amr
openjpeg2 opus raspberrypi-firmware sdl2 speex v4l-utils xz zlib
Dipendenze opzionali : ladspa: LADSPA filters [installato]
Richiesto da : chromaprint chromium ffmpegthumbnailer firefox freerdp gst-libav mpv-rpi qt5-webengine vapoursynth
vlc x264-git
Opzionale per : libde265 xmms2 youtube-dl youtube-dl-gui-git
Conflitti con : ffmpeg
Sostituisce : Nessuno
Spazio richiesto : 25,89 MiB
Pacchettizzatore : Unknown Packager
Data di creazione : dom 29 set 2019, 17:02:31
Data di installazione : dom 29 set 2019, 18:24:49
Motivo dell'installazione : Installato esplicitamente
Script di install : No
Convalidato da : Nessuno')
The normal behaviour should be mpv working as usual with this kind of mpv.conf
$this->bbcode_second_pass_code('', '
#
# Example mpv configuration file
#
# Warning:
#
# The commented example options usually do _not_ set the default values. Call
# mpv with --list-options to see the default values for most options. There is
# no builtin or example mpv.conf with all the defaults.
#
#
# Configuration files are read system-wide from /usr/local/etc/mpv.conf
# and per-user from ~/.config/mpv/mpv.conf, where per-user settings override
# system-wide settings, all of which are overridden by the command line.
#
# Configuration file settings and the command line options use the same
# underlying mechanisms. Most options can be put into the configuration file
# by dropping the preceding '--'. See the man page for a complete list of
# options.
#
# Lines starting with '#' are comments and are ignored.
#
# See the CONFIGURATION FILES section in the man page
# for a detailed description of the syntax.
#
# Profiles should be placed at the bottom of the configuration file to ensure
# that settings wanted as defaults are not restricted to specific profiles.

##################
# video settings #
##################

# Start in fullscreen mode by default.
#fs=yes

# force starting with centered window
geometry=100%:0%

# don't allow a new window to have a size larger than 90% of the screen size
# autofit-larger=50%x50%

# Do not close the window on exit.
#keep-open=yes

# Do not wait with showing the video window until it has loaded. (This will
# resize the window once video is loaded. Also always shows a window with
# audio.)
#force-window=immediate

# Disable the On Screen Controller (OSC).
osc=no

# Keep the player window on top of all other windows.
# ontop=yes

# Specify default video driver (see --vo=help for a list).
# vo=opengl
# vo=rpi:background
vo=rpi
# Specify high quality video rendering preset (for OpenGL VO only)
# Can cause performance problems with some drivers and GPUs.
#profile=opengl-hq

# Force video to lock on the display's refresh rate, and change video and audio
# speed to some degree to ensure synchronous playback - can cause problems
# with some drivers and desktop environments.
#video-sync=display-resample

# Enable hardware decoding if available. Often, this does not work with all
# video outputs, but should work well with default settings on most systems.
# If performance or energy usage is an issue, forcing the vdpau or vaapi VOs
# may or may not help.
# hwdec=rpi,auto
# Questa istruzione va ripristinata per mmal
# RIPRISTINARE
# vo=rpi
# vo=xv
hwdec=mmal
# hwdec-codecs=mpeg4,h264,mpeg2
hwdec-codecs=all
##################
# audio settings #
##################
audio-exclusive=yes
ad-lavc-downmix=no
alsa-resample=no
# Specify default audio driver (see --ao=help for a list).
ao=alsa
# ad=ac3,aac,aac_fixed,stereo
#ad=spdif:ac3,spdif:dts,ac3,aac,aac_fixed,auto
alsa-mixer-name=IQaudIO DAC HiFi pcm512x-hifi-0
audio-device=alsa/sysdefault:CARD=IQaudIODAC
# Disable softvol usage, and always use the system mixer if available.
# softvol=no
# Do not filter audio to keep pitch when changing playback speed.
#audio-pitch-correction=no

# Output 5.1 audio natively, and upmix/downmix audio with a different format.
#audio-channels=5.1
# Disable any automatic remix, _if_ the audio output accepts the audio format.
# of the currently played file. See caveats mentioned in the manpage.
# (This is the default.)
#audio-channels=auto
#ignore-chmap=yes
##################
# other settings #
##################

# Pretend to be a web browser. Might fix playback with some streaming sites,
# but also will break with shoutcast streams.
#user-agent="Mozilla/5.0"

# cache settings
#
# Use 150MB input cache by default. The cache is enabled for network streams only.
#cache-default=153600
# #
# Use 150MB input cache for everything, even local files.
# cache=256000
#
# Disable the behavior that the player will pause if the cache goes below a
# certain fill size.
#cache-pause=no
#
# Read ahead about 5 seconds of audio and video packets.
#demuxer-readahead-secs=5.0
#
# Raise readahead from demuxer-readahead-secs to this value if a cache is active.
#cache-secs=50.0

# Display English subtitles if available.
#slang=en

# Play Finnish audio if available, fall back to English otherwise.
#alang=fi,en

# Change subtitle encoding. For Arabic subtitles use 'cp1256'.
# If the file seems to be valid UTF-8, prefer UTF-8.
#sub-codepage=utf8:cp1256


# You can also include other configuration files.
#include=/path/to/the/file/you/want/to/include


############
# Profiles #
############

# The options declared as part of profiles override global default settings,
# but only take effect when the profile is active.

# The following profile can be enabled on the command line with: --profile=invert

#[invert]
# The profile forces this video filter:
#vf-add=flip
save-position-on-quit
volume=30
#volume-max=600
# verbose parziale:
msg-level=af=v:ao=v:ad=v

')

if i play sudo mpv movie.mkv
$this->bbcode_second_pass_code('', '
(+) Video --vid=1 (mpeg2video 720x576 25.000fps)
(+) Audio --aid=1 (ac3 6ch 48000Hz)
Audio --aid=2 (ac3 6ch 48000Hz)
Audio --aid=3 (ac3 6ch 48000Hz)
Audio --aid=4 (ac3 6ch 48000Hz)
Using hardware decoding (mmal).
VO: [rpi] 720x576 => 1024x576 mmal
AO: [alsa] 48000Hz stereo 2ch float
')

i need to start mpv without sudo as usual.
about the same problem this viewtopic.php?f=60&t=13737
but now seems a new clue
Last edited by acconciox on Sun Nov 03, 2019 8:06 am, edited 1 time in total.
acconciox
 
Posts: 110
Joined: Thu May 05, 2016 4:39 pm

Re: mmal hardware acceleration works only with root

Postby graysky » Sun Sep 29, 2019 8:10 pm

Not sure but thinking your regular users needs privileges to a few hardware decodes. See what we do in the kodi package for members in the video group: https://github.com/archlinuxarm/PKGBUIL ... kodi.rules or for RPi4: https://github.com/archlinuxarm/PKGBUIL ... kodi.rules
graysky
Developer
 
Posts: 1731
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: mmal hardware acceleration works only with root

Postby acconciox » Mon Sep 30, 2019 2:22 am

thanks ! this way it works is this a correct way?
added:
$this->bbcode_second_pass_code('', '
% cat /etc/udev/rules.d/raspberrypi.rules
# fix for /dev/vcio
SUBSYSTEM=="bcm2708_vcio",GROUP="video",MODE="0660"
# fix for /dev/vcsm
SUBSYSTEM=="vc-sm",GROUP="video",MODE="0660"
')
acconciox
 
Posts: 110
Joined: Thu May 05, 2016 4:39 pm

Re: mmal hardware acceleration works only with root

Postby graysky » Mon Sep 30, 2019 7:57 pm

You can probably just use the file I linked and just add your user to the video group.
graysky
Developer
 
Posts: 1731
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000


Return to Community

Who is online

Users browsing this forum: No registered users and 22 guests