hzeller / gmrender-resurrect

Resource efficient UPnP/DLNA renderer, optimal for Raspberry Pi, CuBox or a general MediaServer. Fork of GMediaRenderer to add some features to make it usable.
GNU General Public License v2.0
832 stars 202 forks source link

gmrender cannot skip within FLAC files #185

Closed mr-berndt closed 4 years ago

mr-berndt commented 5 years ago

I figured that there is no way to skip within FLAC files, as long as gmrender takes care of the FLAC decoding. When forcing my control point to do the decoding the issue is gone. While this can be done with bubble-upnp there are other control points that don't offer this option.

I did not find a way to either disable the compiled gmrender binary from announcing the capability to decode FLAC nor disable it altogether using ./configure.

It would be great to have such option? - Any chances?

mill1000 commented 5 years ago

What media server are you using? What format are your FLAC files? I play 16 bit 44.1 kHz FLAC files regularly and believe seeking works as expected.

mr-berndt commented 5 years ago

Since I maintain the Aroio distribution with a growing user base, it is hard to have details about every case. Personally I tried: FLAC, 48 kHz, 16 Bits, 2 Channels, 2 hours, which I got from a user that had problems with all his FLAC files. I tried it, using bubbleupnp as a controlpoint playing local files, as well as a control point under linux, also playing a local file. I forgot the name of the control point, and it was on my former laptop.

I have six reports of people mostly using android phones, that have the same issue using the same file as well as various FLAC files. We swapped that one file to have a common ground.

MMinga commented 4 years ago

Dear mill, I was one of the users who reported the bug. I use Aroio as renderer. I does not matter what resolution the flacs have, it does not matter if the file is local on PC, SmartPhone, or NAS, in my case Twonky. I does not work if I use:

Additionally, if I try to stream AAC (M4a) via UPnP to Aroio, no sound is played but the time is running.

mill1000 commented 4 years ago

Unfortunately I cannot reproduce this issue. Can you capture the log output when attempting to seek?

I have tried both Hi-Fi Cast and BubbleUPnP with a local file on my Moto X4 and my media server (MinimServer). I am running gmrender-resurrect on a Raspberry Pi 3B.

The FLAC files I tested are 16 bit 44.1 kHz with a duration of about 5 minutes. @mr-berndt You referenced a 2 hour long file, are all the reports with extremely long files? Could you share the file your users are having issues with?

mr-berndt commented 4 years ago

I'll have to see that I get hold of it again. I had it on my smartphone but deleted it, since it was rather large.

MMinga commented 4 years ago

Dear mill100, it does not matter how long and what resolution flacs have. Here logs as requested, IHTH. The file was local on my Smartphone; 16bit 44kHz I see, as I did the test, that the file will be resumed after approx. one minute at the jumped place. `

journalctl -u gmediarender

-- Logs begin at Wed 2017-07-12 16:01:10 CEST, end at Wed 2017-07-12 16:09:18 CEST. -- Jul 12 16:01:16 Wohnzimmer systemd[1]: Started Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Main process exited, code=exited, status=1/FAILURE Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Unit entered failed state. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Failed with result 'exit-code'. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Service hold-off time over, scheduling restart. Jul 12 16:01:17 Wohnzimmer systemd[1]: Stopped Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer systemd[1]: Started Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer taskset[457]: Invalid byte sequence in conversion input Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Main process exited, code=exited, status=1/FAILURE Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Unit entered failed state. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Failed with result 'exit-code'. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Service hold-off time over, scheduling restart. Jul 12 16:01:17 Wohnzimmer systemd[1]: Stopped Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer systemd[1]: Started Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer taskset[479]: Invalid byte sequence in conversion input ss exited, code=exited, status=1/FAILUREmediarender.service: Main proce--More-- ed failed state.Wohnzimmer systemd[1]: gmediarender.service: Unit enter--More-- h result 'exit-code'.immer systemd[1]: gmediarender.service: Failed wit--More-- Jul 12 16:01:18 Wohnzimmer systemd[1]: gmediarender.service: Service hold-off time over, scheduling restart. Jul 12 16:01:18 Wohnzimmer systemd[1]: Stopped Gmedia Renderer Audio Player. Jul 12 16:01:18 Wohnzimmer systemd[1]: Started Gmedia Renderer Audio Player. Jul 12 16:01:18 Wohnzimmer taskset[496]: Invalid byte sequence in conversion input Jul 12 16:01:18 Wohnzimmer taskset[496]: Ready for rendering. # `

MMinga commented 4 years ago

Additional log: Source is on NAS, Twonky Version: 7.2.9-6. This song is over one hour long. Mike Oldfield -- Amarok 16bit, 44khz

`

journalctl -u gmediarender

-- Logs begin at Wed 2017-07-12 16:01:10 CEST, end at Wed 2017-07-12 16:16:45 CEST. -- Jul 12 16:01:16 Wohnzimmer systemd[1]: Started Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Main process exited, code=exited, status=1/FAILURE Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Unit entered failed state. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Failed with result 'exit-code'. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Service hold-off time over, scheduling restart. Jul 12 16:01:17 Wohnzimmer systemd[1]: Stopped Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer systemd[1]: Started Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer taskset[457]: Invalid byte sequence in conversion input Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Main process exited, code=exited, status=1/FAILURE Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Unit entered failed state. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Failed with result 'exit-code'. Jul 12 16:01:17 Wohnzimmer systemd[1]: gmediarender.service: Service hold-off time over, scheduling restart. Jul 12 16:01:17 Wohnzimmer systemd[1]: Stopped Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer systemd[1]: Started Gmedia Renderer Audio Player. Jul 12 16:01:17 Wohnzimmer taskset[479]: Invalid byte sequence in conversion input ss exited, code=exited, status=1/FAILUREmediarender.service: Main proce--More-- ed failed state.Wohnzimmer systemd[1]: gmediarender.service: Unit enter--More-- h result 'exit-code'.immer systemd[1]: gmediarender.service: Failed wit--More-- Jul 12 16:01:18 Wohnzimmer systemd[1]: gmediarender.service: Service hold-off time over, scheduling restart. Jul 12 16:01:18 Wohnzimmer systemd[1]: Stopped Gmedia Renderer Audio Player. Jul 12 16:01:18 Wohnzimmer systemd[1]: Started Gmedia Renderer Audio Player. Jul 12 16:01:18 Wohnzimmer taskset[496]: Invalid byte sequence in conversion input `

mill1000 commented 4 years ago

@MMinga Thanks, unfortunately those logs don't have much information.

Could you try running the recommended logging setup as detailed in INSTALL.md?

Use this command, and post the created log file.

gmediarender -f "MyRender" --logfile=/tmp/gmrender.log >> /tmp/gmrender.log 2>&1
mr-berndt commented 4 years ago

I was away from any Computer when MMinga asked me for the command to retrieve the Logs. I gave him the journactl one, not remembering that I redirected gmediarenderer's logs elsewhere. he is informed and should come up with the logs shortly..

It is strange that you cannot reproduce this. Might be a compilation issue.

Here you find the .mk file from buildroot which takes care of it: https://github.com/unicap/audiostreamer-buildroot/blob/5603531a0f685c82424f3926e761a2b8f930098a/package/gmrender-resurrect/gmrender-resurrect.mk

This is originally included in buildroot, but I changed the used version several times, because i had several issues. The version I am using worked best so far.

MMinga commented 4 years ago

Dear Mill, here are logs. IHTH now. One ist created by your command, the other logs are system logs, as mr-berndt told me to export. gmlog.txt gmrender.log

mill1000 commented 4 years ago

Thanks.

Looks like we're building against different versions of libupnp & gstreamer. Might be a clue there.

Your versions:

gmediarender 0.0.7-git log started [ gmediarender 0.0.7-git (libupnp-1.6.22; glib-2.54.2; gstreamer-1.12.3) ]

Mine version:

gmediarender 0.0.7-git log started [ gmediarender 2018-08-18_a7b0b1b (libupnp-1.6.19+git20160116; glib-2.50.3; gstreamer-1.10.4) ]

mr-berndt commented 4 years ago

Thanks for the hint.

I have tried different libupnp versions before but it didin't help. I will see if I can change the gstreamer-version or if it would break some other package. That will take until somewhen next week.

mill1000 commented 4 years ago

What audio backend are you using? ALSA?

mr-berndt commented 4 years ago

Yes, alsa and in some cases jack (Aroio has several output options), but also through an alsa-jack bridge. So gmrender always gets to see alsa.

hzeller commented 4 years ago

mmh, as to 'skipping flac files', this sounds strange to me, it usually just works for me. If you do someting that generates files on-the-fly (such as folve, it might sometimes take a while until it arrives at the generated bits, but I suppose this is not your set-up.

Right now, mime-filters (--mime_filter) are only fairly coarse-grained, so you can't explicitly filter out just flac, but this sounds like it might be a good idea to implement in general.

mr-berndt commented 4 years ago

If I set my playing application to only transmit WAVE/LPCM, the FLAC gets decoded on the smartphone, or whatever is used to stream and there is no problem. Any device should nowadays be capable of doing so, so an option to disable FLAC decoding altogether might also do the trick.

IIRC the DLNA specification lists LPCM as must have and several other formats/codecs als optional.

MMinga commented 4 years ago

As user I'm interested, if there are actions in background to solve the issue. As written above in combination with Aroio OS the device povides no sound output when I try to stream an AAC (m4a) file. Thanks for an answer in advance.

MMinga commented 4 years ago

Now after a while, may I kindly ask if there are actions or information about the issue available? Was the information by my log useful? Do you need addtional information?

Loking forward for an answer and hopfully a solution.

mill1000 commented 4 years ago

Being unable to reproduce the issue on my end there is not much I can do to assist. We identified that @mr-berndt was building against different versions of libupnp and gstreamer. Perhaps they have found something?

hzeller commented 4 years ago

Could it be a combination of slow network and gstreamer somehow walk through the whole file until it finds something ? If there is a wireless connection used, this might take a while if we skip 30min of a flac. In particular the observation that eventually after a minute or so it arrives seems to indicate that.

After all, the serving of the file is done via http from the server. In order to 'properly' skip somewhere in the middle of the file, it either has to go there byte-by-byte until it finds it or it has to be done using HTTP byte ranges: this would require that the Twonky NAS can do byte ranges (It should have Accept-Ranges: bytes in HTTP response headers) and that gstreamer can convert seek requests to request byte ranges from the server (e.g. Range: byte=2789-). The latter would require possibly some sort of indexing in the flac file to quickly know which range in the compressed file to look at and the gstramer source be able to translate that into desired byte-ranges (one could also probably do some approximate skipping given the observed/estimated compression factor).

I don't know if gstreamer is doing something like that, so it might be worthwhile asking a mailing lest there. Observing network traffic to see if it streams through long-time worth of data might help further tracing this down.

MMinga commented 4 years ago

Thanks for an answer. No it does not correlate with the network. It does not matter if I try to jump from a title at NAS with Twonky or from a local file from my phone. The same happens with Windows 10 when I play a title by right-click => Play on renderer.

As describe above an aac (m4a) is not played (scrolbar works by silence). I found that the same happens by a WMA-file. In both cases a jump within a file works. Maybe it correlates.

ejokic commented 4 years ago

Hello, i also have no possibility to to move slider and search, skip to different time position within the song (not just flac but also mp3 and wav). i have allo usbridge and gmrender, i use it for two years but it never worked. i used many upnp/dlna controllers over the time and it is always crashing gmrender when moving slider. i am interested to try to solve this because sometimes i move slider by mistake and then i have to unplug from electricity, it is really annoying. please if you want me to send some logs tell me how to create them because i am not very experienced in linux commands. Thank you

hzeller commented 4 years ago

What is the media server you are using ? The skipping is just delegated to the media server, but if it has trouble jumping to a different position, then this is the culprit. I am using minidlna and with that, I can do arbitrary skipping.

ejokic commented 4 years ago

thank you for your reply. I use synology nas with minimserver. Also tried with synology's native mediaserver but it was the same. Also tried Jriver on pc server. I use wired connection through Mikrotik switch. i tried most of software upnp/dlna renderers (windows and linux) and unfortunatelly only gmrender doesn't work with skipping to position in my experience. I have dietpi installed on allo sparky usbridge. When i installed Volumio, the buikt in dlna renderer (i believe it is open home/dlna combo) worked good with skipping to position, but i prefer the sound and usability of gmrender on dietpi.

I would like to thank for this resurrection project, i enjoy music every day. If some other people have same problem and there is possibility to try to resolve this it would be great.... Regards

MMinga commented 4 years ago

So, I can tell here the follwoing: It does not work from Twonky and MinimServer, with standards (without conversion). If an app can convert it, then it works. I my case, I use Bubble UPnP and convert all to "wav". Then it works for both servers. Bubble UPnP also supports the ReplayGain so it is now for me the tool. Hi-Fi Cast does not support it. BTW: m4a are not played without conversion.

with regards

mill1000 commented 4 years ago

I use Hi-Fi Cast, MinimServer and gmrender-resurrect exclusively. I have no issues with seeking.

Here's my system

Linux 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

gmediarender 0.0.8; gmediarender 0.0.8_git2020-04-05_1f75ab1 (libupnp-1.8.4; glib-2.50.3; gstreamer-1.10.4)
ejokic commented 4 years ago

Ok, thank you for your reply, since i do not intend to use conversion i cannot use it, so i will search for another solution for my dietpi device. Thank you

phpbg commented 4 years ago

Works fine with

mr-berndt commented 4 years ago

I can happily report that after updating our buildroot system to a recent version the problem is gone. It is hard to tell which updated software packet causes this, since all involved packages are newer now. Anywa, the next Aroio version will be rid of this issue!

MMinga commented 4 years ago

Too late, for at least one user of Aroio OS!

ejokic commented 4 years ago

Is it going to be in the next update for dietpi allo sparky version?

mr-berndt commented 4 years ago

I don't know, I have nothing to do with dietpie.

As for the "one user": I told you, things will be taken care of in time and you were very pushing, unfriendly and unpatient. So spare me the comment and think about your general behaviour, especially towards people doing open source software.

Closing this issue now, thx. everybody for trying to help!

MMinga commented 4 years ago

@mr-berndt, you call me unpatient! Facts: -I bought the device for several hundreds of Euro, with the software version. 3.50 in March 2018.

I would say, you as developer of the AroioOS have failed and you are not able to take criticism.

I was happy that I could sell my device. Currently I'm happy to use a device wihtout your expertise. Btw. my dealer told me everyone who bought the device with Aroio OS returned it, because it doesn't work proper in UPnP mode.

mr-berndt commented 4 years ago

... and here we go again! - This is nor the place nor the platform for your rant and so I will not answer any further.