Open patrickkfkan opened 4 years ago
That's because the FLAC file has its metadata at the beginning; it comes before any audio data, and therefore MPD can read it before playing anything. The DSF file has an ID3 tag at the end of the file. So MPD plays and plays, and only when the song is over, it sees the ID3 tag. Scanning the whole file for tags would require several additional HTTP requests and would cause long delays. Do you want MPD to do that?
Thanks for looking into this.
Would it be possible to implement this in such a way that MPD starts playing the stream first, followed by making these additional HTTP requests in the background and updating itself when it obtains the metadata?
In my tests, mediainfo
and ffmpeg
both took less than a second to fetch the metadata from the DSF sample stream, which I think is not too bad (the stream itself is ~207MB):
> time mediainfo "http://jelly.szesewsew.com:21915/audio/3c6ccea4-424c-c1c8-4977-03792c2e12de/stream.dsf?DeviceId=test&MediaSourceId=3c6ccea4424cc1c8497703792c2e12de&Static=true&Tag=3a45a9c240c1077bfa1d2e53ae0854d4&dlnaheaders=true"
Complete name : http://jelly.szesewsew.com:21915/audio/3c6ccea4-424c-c1c8-4977-03792c2e12de/stream.dsf?DeviceId=test&MediaSourceId=3c6ccea4424cc1c8497703792c2e12de&Static=true&Tag=3a45a9c240c1077bfa1d2e53ae0854d4&dlnaheaders=true
Format : DSF
Format/Info : Direct Stream Digital Stream File
Format version : Version 1
File size : 207 MiB
Duration : 5 min 7 s
Overall bit rate : 5 647 kb/s
Album : POLARITY — an acoustic jazz project
Album/Performer : Hoff Ensemble
Part/Position : 1
Track name : Innocence
...
real 0m0.128s
user 0m0.022s
sys 0m0.007s
> time ffmpeg -i 'http://jelly.szesewsew.com:21915/audio/3c6ccea4-424c-c1c8-4977-03792c2e12de/stream.dsf?DeviceId=test&MediaSourceId=3c6ccea4424cc1c8497703792c2e12de&Static=true&Tag=3a45a9c240c1077bfa1d2e53ae0854d4&dlnaheaders=true' -f ffmetadata /tmp/dsf-metadata.txt
...
Metadata:
encoded_by : Merging Technologies Album Publishing
comment : Generated by Merging Technologies Album Publishing
: Label Code: 2L
title : Innocence
artist : Hoff Ensemble: Jan Gunnar Hoff, Audun Kleive & Anders Jormin
album_artist : Hoff Ensemble
composer : Jan Gunnar Hoff
album : POLARITY — an acoustic jazz project
...
real 0m0.276s
user 0m0.059s
sys 0m0.017s
> cat /tmp/dsf-metadata.txt
;FFMETADATA1
encoded_by=Merging Technologies Album Publishing
comment=Generated by Merging Technologies Album Publishing\
Label Code: 2L
title=Innocence
artist=Hoff Ensemble: Jan Gunnar Hoff, Audun Kleive & Anders Jormin
album_artist=Hoff Ensemble
composer=Jan Gunnar Hoff
album=POLARITY — an acoustic jazz project
track=1/12
disc=1
TSRC=NOMPP1801010
=7041888523628
publisher=2L
date=2018
genre=Jazz
encoder=Lavf57.83.100
Perhaps MPD can utilize ffmpeg for retrieving the metadata from the stream?
MPD can read those tags just fine without FFmpeg. MPD just doesn't bother doing that, and nobody spent time on implementing your idea, because this problem doesn't exist on sane codecs (i.e. FLAC, Vorbis, Opus). Your ffmpeg command takes 4 seconds here, and involves 3 connections to the server and 3 HTTP requests, and receives 77 kB of data from the internet. Bottom line: yes, it can be done, and maybe somebody volunteers and sends me the code. But I feel that my time is better spent on other things.
For me at least, I would prefer to have the stream play ASAP instead of having to wait a couple of seconds for MPD to retrieve metadata. And I respect that you don't want to spend time implementing this through threading just for the sake of one codec (and the fact that this doesn't affect the majority of users, apparently). Unfortunately, I know nothing about C / C++ to be able to do this myself, so I guess we should just leave things as they are :)
On the other hand, would you consider adding a config option so that users can choose whether MPD should fetch metadata before playing a DSF stream? In my use case, I can enable this option when streaming on local network and the delay should be unnoticeable.
Thanks.
Wouldn't compressing the dsf files with wavpack accomplish what you are after?
Wouldn't compressing the dsf files with wavpack accomplish what you are after?
Hello,
Thanks for the suggestion. If the DSF streams are served from a remote server, then I cannot compress them into Wavpack if I don't have access to that server.
Fortunately in my case, since the streams are remote and I do have the metadata at hand (provided by the server hosting the DSF), I am able to work around the issue by using MPD's addtagid command to specify the song title, artist, etc.
I agree with Max's comment that it may not be worthwhile to implement metadata fetching for DSFs, given the overhead involved, but I leave it to his discretion whether this issue should be closed as "not going to be resolved".
Regards, Patrick
Bug report
Describe the bug
When playing a DSF stream, MPD does not read metadata from the stream. Clients therefore do not show title, album, artist, etc. Only the URI of the stream is shown.
Expected Behavior
MPD reads metadata from DSF stream and makes it available to clients.
Actual Behavior
Only the URI of the stream is returned to clients.
Version
How to reproduce
Following example uses mpc 0.33 as the MPD client. DSF sample was downloaded from http://www.2l.no/hires/ (Hoff: Innocence - Stereo DSD 64 2.8224Mbit/s) and streamed from a Jellyfin server.
Log
To verify that the stream does contain metadata:
Metadata is available when streaming other types of media such as FLAC. For example (same track as above but in FLAC format):
MPD Conf