Raspberry Pi + Systemd + Python App + VLC/CVLC = 1080 only, no 4K

*nix specific usage questions
nixternal
New Cone
New Cone
Posts: 5
Joined: 25 Jun 2020 00:46

Raspberry Pi + Systemd + Python App + VLC/CVLC = 1080 only, no 4K

Postby nixternal » 25 Jun 2020 00:57

OK, this is weird. I have been battling this all day & have been unsuccessful as of yet. I am working on a project that is Python based. The project is started via systemd scripts. Weird thing is vlc/cvlc works to an extent, it will run a 1080 vid just fine but not 4K. If I run the python app from the command line, everything works perfectly. Running the app from systemd is the wonkiness.

For instance, when it is run with the following code & service script, It will play a 1080 file but not a 4K file. If I run the python outside of systemd script, it will play a 1080 & 4k file just fine. Try it out with the following & let me know if you can figure it out. I greatly appreciate any & all help. Thanks!

EDITED: Rémi pointed me in the right direction for the dbus issue, but the bigger issue is the lack of 4K when using systemd now. Thanks Rémi!!! I've added more Environment= to the service file, but still no luck as of yet.

EDIT: ADDED VLC LOG TO REPLY

PYTHON CODE (testvlc):

Code: Select all

#!/usr/bin/env python from subprocess import Popen, PIPE import time vid = 'somevideo.mp4' cmd = 'DISPLAY=:0 cvlc -f --no-osd %s -L' % vid Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) while True: print("Hello!") time.sleep(5)
SYSTEMD SCRIPT (testvlc.service) added Environment= stuff per Rémi's response, thanks!:

Code: Select all

[Unit] Description=Test VLC From Python Script [Service] User=user Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus" Environment="DISPLAY=:0" Environment="XDG_RUNTIME_DIR=/run/user/1001" Environment="XAUTHORITY=/home/ppp/.Xauthority" ExecStart=/usr/bin/screen -D -S testvlc -m /home/user/testvlc [Install] WantedBy=multi-user.target
Last edited by nixternal on 25 Jun 2020 19:08, edited 4 times in total.

Rémi Denis-Courmont
Developer
Developer
Posts: 15280
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Systemd + Python App that runs VLC/CVLC = No dbus

Postby Rémi Denis-Courmont » 25 Jun 2020 15:44

Check the logs. Probably it can't find the session bus.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

nixternal
New Cone
New Cone
Posts: 5
Joined: 25 Jun 2020 00:46

Re: Systemd + Python App that runs VLC/CVLC = No dbus

Postby nixternal » 25 Jun 2020 18:11

Check the logs. Probably it can't find the session bus.
Thanks Rémi for pointing me in the right direction with your response. Now to figure out the 4K issue.

nixternal
New Cone
New Cone
Posts: 5
Joined: 25 Jun 2020 00:46

Re: Raspberry Pi + Systemd + Python App + VLC/CVLC = 1080 only, no 4K

Postby nixternal » 25 Jun 2020 19:07

VLC LOG FILE --verbose=2
Only errors were mmal_avcodec errors at the bottom of the log file.

Code: Select all

main debug: VLC media player - 3.0.11 Vetinari main debug: Copyright © 1996-2020 the VideoLAN team main debug: revision 3.0.11-0-gdc0c5ced72 .... main debug: `file:///home/media/BigBuckBunny_HEVC-1.mp4' gives access `file' demux `any' path `/home/media/BigBuckBunny_HEVC-1.mp4' main debug: creating demux: access='file' demux='any' location='/home/media/BigBuckBunny_HEVC-1.mp4' file='/home/media/BigBuckBunny_HEVC-1.mp4' .... main debug: no stream_filter modules matched main debug: looking for stream_directory module matching "any": 1 candidates main debug: no stream_directory modules matched main debug: attachment of directory-extractor failed for file:///home/media/BigBuckBunny_HEVC-1.mp4 main debug: looking for stream_filter module matching "record": 26 candidates main debug: using stream_filter module "record" main debug: creating demux: access='file' demux='any' location='/home/media/BigBuckBunny_HEVC-1.mp4' file='/home/media/BigBuckBunny_HEVC-1.mp4' main debug: looking for demux module matching "mp4": 55 candidates mp4 debug: dumping root Box "root" mp4 debug: | + ftyp size 24 offset 0 mp4 debug: | + moov size 3645 offset 24 mp4 debug: | | + mvhd size 108 offset 32 mp4 debug: | | + trak size 3529 offset 140 mp4 debug: | | | + tkhd size 92 offset 148 mp4 debug: | | | + mdia size 3429 offset 240 mp4 debug: | | | | + mdhd size 32 offset 248 mp4 debug: | | | | + hdlr size 66 offset 280 mp4 debug: | | | | + minf size 3323 offset 346 mp4 debug: | | | | | + vmhd size 20 offset 354 mp4 debug: | | | | | + dinf size 36 offset 374 mp4 debug: | | | | | | + dref size 28 offset 382 mp4 debug: | | | | | | | + url size 12 offset 398 mp4 debug: | | | | | + stbl size 3259 offset 410 mp4 debug: | | | | | | + stsd size 239 offset 418 mp4 debug: | | | | | | | + hvc1 size 223 offset 434 mp4 debug: | | | | | | | | + hvcC size 117 offset 520 mp4 debug: | | | | | | | | + btrt size 20 offset 637 mp4 debug: | | | | | | + stts size 24 offset 657 mp4 debug: | | | | | | + ctts size 1840 offset 681 mp4 debug: | | | | | | + stss size 20 offset 2521 mp4 debug: | | | | | | + stsc size 52 offset 2541 mp4 debug: | | | | | | + stsz size 980 offset 2593 mp4 debug: | | | | | | + stco size 96 offset 3573 mp4 debug: | + mdat size 2512740 offset 3669 mp4 debug: | + free size 59 offset 2516409 mp4 debug: unrecognized major media specification (iso4). mp4 debug: found 1 tracks mp4 debug: track[Id 0x1] read 20 chunk mp4 warning: STTS table of 1 entries mp4 warning: CTTS table of 228 entries mp4 debug: track[Id 0x1] read 240 samples length:10s main debug: selecting program id=0 mp4 debug: adding track[Id 0x1] video (enable) language undef main debug: using demux module "mp4" main debug: looking for a subtitle file in /home/media/ main debug: looking for video decoder module matching "any": 18 candidates mmal_codec debug: OpenDecoder: <<< (hevc/----)[----] 3840x2160 0/0=0/0 o:0 -> (----/----) 0x0 0/0 o:0 mmal_avcodec debug: MmalAvcodecOpenDecoder: <<< (hevc/----)[----] 3840x2160 -> (----/----) 0x0 [CMA/536870912] xb:3 mmal_avcodec debug: using ffmpeg Lavc58.35.100 mmal_avcodec debug: CPU flags: 0x0000003f mmal_avcodec: Looking for HEVC decoder 'hevc' mmal_avcodec debug: allowing 3 thread(s) for decoding mmal_avcodec debug: codec (hevc) started mmal_avcodec debug: using frame thread mode with 3 threads main debug: using video decoder module "mmal_avcodec" .... main debug: no meta reader modules matched main debug: `file:///home/media/BigBuckBunny_HEVC-1.mp4' successfully opened mp4 debug: track[Id 0x1] using Sync Sample Box (stss) mp4 debug: stss gives 0 --> 0 (sample number) main debug: Buffering 0% main debug: Buffering 25% main debug: Buffering 50% main debug: Buffering 75% main debug: Buffering 100% main debug: Stream buffering done (1250 ms in 1 ms) mmal_avcodec debug: Pool size: (8+3) * 12441600 mmal_avcodec warning: Failed to preallocate decoder pool (8+3) * 12441600 mmal_avcodec error: CMA buf pool alloc buf failed mmal_avcodec error: avcodec_send_packet critical error main error: buffer deadlock prevented main debug: Decoder wait done in 101 ms mmal_avcodec error: CMA buf pool alloc buf failed mmal_avcodec error: CMA buf pool alloc buf failed main debug: EOF reached main debug: killing decoder fourcc `hevc' main debug: removing module "mmal_avcodec" mmal_avcodec debug: <<< MmalAvcodecCloseDecoder main debug: removing module "mp4" mp4 debug: freeing all memory main debug: Program doesn't contain anymore ES main debug: removing module "record" main debug: removing module "cache_read" main debug: removing module "filesystem" main debug: dead input main debug: changing item without a request (current 0/1) main debug: nothing to play
Last edited by nixternal on 26 Jun 2020 16:33, edited 2 times in total.

nixternal
New Cone
New Cone
Posts: 5
Joined: 25 Jun 2020 00:46

Re: Raspberry Pi + Systemd + Python App + VLC/CVLC = 1080 only, no 4K

Postby nixternal » 25 Jun 2020 19:50

Here is the mmal_avcodec section from a good 4k file run taken when not using systemd:

Code: Select all

main debug: looking for video decoder module matching "any": 18 candidates mmal_codec debug: OpenDecoder: <<< (hevc/----)[----] 3840x2160 0/0=0/0 o:0 -> (----/----) 0x0 0/0 o:0 mmal_avcodec debug: MmalAvcodecOpenDecoder: <<< (hevc/----)[----] 3840x2160 -> (----/----) 0x0 [CMA/536870912] xb:3 mmal_avcodec debug: using ffmpeg Lavc58.35.100 mmal_avcodec debug: CPU flags: 0x0000003f mmal_avcodec: Looking for HEVC decoder 'hevc' mmal_avcodec debug: allowing 3 thread(s) for decoding mmal_avcodec debug: codec (hevc) started mmal_avcodec debug: using frame thread mode with 3 threads main debug: using video decoder module "mmal_avcodec" main debug: looking for meta reader module matching "any": 2 candidates lua debug: Trying Lua scripts in /home/ppp/.local/share/vlc/lua/meta/reader lua debug: Trying Lua scripts in /usr/lib/arm-linux-gnueabihf/vlc/lua/meta/reader lua debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/meta/reader/filename.luac lua debug: Trying Lua scripts in /usr/share/vlc/lua/meta/reader main debug: no meta reader modules matched main debug: `file:///home/media/BigBuckBunny_HEVC-1.mp4' successfully opened mp4 debug: track[Id 0x1] using Sync Sample Box (stss) mp4 debug: stss gives 0 --> 0 (sample number) main debug: Buffering 0% main debug: Buffering 25% main debug: Buffering 50% main debug: Buffering 75% main debug: Buffering 100% main debug: Stream buffering done (1250 ms in 1 ms) mmal_avcodec debug: Pool size: (8+3) * 12441600

nixternal
New Cone
New Cone
Posts: 5
Joined: 25 Jun 2020 00:46

[SOLVED] Raspberry Pi + Systemd + Python App + VLC/CVLC = 1080 only, no 4K

Postby nixternal » 26 Jun 2020 16:32

The fix, put the systemd service script in ~/.config/systemd/user/ and use systemctl --user enable. Not what I wanted, but it works & is a solution. Change the service script a little of course:

Code: Select all

[Unit] Description=Test VLC From Python Script After=graphical-session.target [Service] ExecStart=/usr/bin/screen -D -S testvlc -m /home/user/testvlc [Install] WantedBy=default.target

llamafilm
Blank Cone
Blank Cone
Posts: 13
Joined: 06 Aug 2018 02:36

Re: Raspberry Pi + Systemd + Python App + VLC/CVLC = 1080 only, no 4K

Postby llamafilm » 14 Jan 2021 23:39

Have you figured out the reason for this? I have the same problem but even HD doesn't work. I suspect it's something to do with the HEVC decoder. This looks like the problem but I don't know why it only happens when running via systemd

Code: Select all

Pool size: (3+3) * 4177920 Failed to preallocate decoder pool (3+3) * 4177920 CMA buf pool alloc buf failed avcodec_send_packet critical error

I tried making it a user service like this, and then it work to run manually, but it does not run automatically on reboot.


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 35 guests