Bug 256734

Summary: precise gapless playback
Product: [Applications] amarok Reporter: Andreas Nordal <andreas_nordal_4>
Component: PlaybackAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED UPSTREAM    
Severity: wishlist CC: giggi1999, kde-bugzilla, kunst.uber.alles, matej, s.hs, schubert.seb, sitter, tdfischer, vo.zaeb
Priority: NOR    
Version: 2.6.0   
Target Milestone: 2.7   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Audio sample: Hear the difference between Amarok crossfader and precise gapless.

Description Andreas Nordal 2010-11-12 20:40:24 UTC
Created attachment 53369 [details]
Audio sample: Hear the difference between Amarok crossfader and precise gapless.

Version:           2.3.2 (using KDE 4.5.2) 
OS:                Linux

Is precise gapless playback supposed to work in Amarok? I was unable to achieve that.

By "precise gapless", I mean "no gap and no overlap" between successive tracks, see [1]. If you consider this a stricter requirement than just "gapless", this report is not a dup of bug 99559. Otherwise, I'm afraid bug 99559 should never have been closed.

I'm using the brand new Fedora 14:
amarok-2.3.2-4.fc14.x86_64
phonon-4.4.2-1.fc14.x86_64
phonon-backend-xine-4.4.2-1.fc14.x86_64
gstreamer-0.10.30-1.fc14.x86_64

Suggestions for implementing precise gapless playback:
* Turn Amarok into an mpd client
* Use Gstreamer correctly, like Rhythmbox and Clementine
* Simply take crossfading out of Amarok (or Xine?), print it on paper and burn it as heresy.

Reproducible: Always

Steps to Reproduce:
1. Record Amarok's successive playback of audio files that supports precise gapless playback (e.g. FLAC).
2. Crop the recording precisely so that only the original audio remains.
3. If the length of the recording != the sum of lengths of the individual files, Amarok did not do precise gapless playback.

Actual Results:  
When using Xine, Amarok takes a hasty time trip to the next track. Although it nicely crossfades the overlapping parts, such behavior is incorrect. For people with a sense of rhythm, it sounds odd, literally.

In one rather audible amarok-mistransition between 2 tracks, I measured the disappearance of 0.63480 seconds, following my "Steps to Reproduce".

When using Gstreamer, Amarok inserts the notorious time gap between tracks. This is unlike Rhythmbox and Clementine [2], (both using Gstreamer) which do precise gapless playback according to my ears.

Expected Results:  
No gap, no overlap!

You may want to take into account the other reason why Xine is unusable: It will not seek in seekpointless FLAC files (unlike Gstreamer). Unfortunate, since the audiocd kioslave does not insert seekpoints, while proper ripping with K3B 2.0.1 is currently broken.

Sorry for my sharp wording, but not getting the elementary things right disappoints.

By the way, Clementine is a sort of resurrection of Amarok 1.4.

[1] http://en.wikipedia.org/wiki/Gapless_playback#Precise_gapless_playback
[2] http://clementine-player.org/
Comment 1 Myriam Schweingruber 2010-11-16 20:39:23 UTC
JFYI: bug 99559 is about Amarok 1.x, not Amarok 2.x
Comment 2 gaffu 2011-03-24 15:44:22 UTC
*** This bug has been confirmed by popular vote. ***
Comment 3 Basti 2011-06-18 19:58:56 UTC
Yeah, the gaps between the tracks are annoying. I made a wish for Phonon to support gapless playback. See bug 275995.
Comment 4 Basti 2011-06-18 20:05:39 UTC
(In reply to comment #3)
> I made a wish for Phonon to
> support gapless playback. See bug 275995.

So when Phonon supports gapless playback, why Amarok doesn’t?
Comment 5 Andreas Nordal 2011-06-19 13:09:16 UTC
Clementine has regressed. It inserts pauses now when using GStreamer.
Comment 6 Myriam Schweingruber 2011-09-05 22:18:54 UTC
*** Bug 281424 has been marked as a duplicate of this bug. ***
Comment 7 Basti 2012-02-10 19:37:02 UTC
May some developer *please* answer my question, why doesn’t Amarok play gapless wenn the backend supports it? :( That’s very annoying...
Comment 8 Myriam Schweingruber 2012-02-11 15:40:12 UTC
Just to make that clear: gapless works with file types supporting it by default like ogg and flac, it just doesn't work with mp3 as this needs more work: http://en.wikipedia.org/wiki/Gapless_playback#Format_support
Comment 9 Sebastian Schubert 2012-02-11 16:09:48 UTC
(In reply to comment #8)
> Just to make that clear: gapless works with file types supporting it by default
> like ogg and flac

Really? Having Amarok on KDE 4.8.0 with phonon-gstreamer 4.51 (using gstreamer 0.10.35) with phonon-kde 4.8.0, phonon 4.6.0 on Gentoo amd64, I have gaps between flac tracks (they've been ripped correctly). Configuration problem?
(I know this is no support forum, just a short hint and I switch to the KDE forum)
Comment 10 Benedikt Waldvogel 2012-02-11 21:00:34 UTC
Myriam, I can confirm that gapless DOES NOT work for FLAC or OGG. I compile Amarok from git, phonon from git and my backend (i.e. phonon-gstreamer) from git since a couple of months (!) and I test gapless playback regularly. It NEVER worked for me yet.

If gapless really works for you then please upload the very file you tested and the exact version of your software stack.
Comment 11 Andreas Nordal 2012-02-13 15:55:32 UTC
> Just to make that clear: gapless works for formats supporting it by default
> like ogg and flac, it just doesn't work for mp3 as this requires more work

That would be acceptible, and all I ask for!

This report is not about achieving the impossible.
Comment 12 Sebastian Schubert 2012-02-17 19:46:54 UTC
I just tried phonon-gstreamer 4.6.0 which is supposed to support gapless. Still no gapless playback in Amarok, though...
Comment 13 Andreas Nordal 2012-03-28 18:10:11 UTC
Clementine has been gapless for me for quite some time now (months), but after installing & uninstalling Amarok today, Clementine (or Gstreamer?) broke again!

No wonder Amarok never works if the package manager damages Gstreamer when installing it. Just my suspicion. Using OpenSuse 12.1 now. If only I could get Clementine gapless again, I could test this…
Comment 14 Myriam Schweingruber 2012-03-30 12:01:02 UTC
(In reply to comment #13)
> Clementine has been gapless for me for quite some time now (months), but
> after installing & uninstalling Amarok today, Clementine (or Gstreamer?)
> broke again!

I doubt the package manager is to blame. Which phonon-backend-gstreamer do you use? Installing an uninstalling Amarok normally should not affect Phonon at all, if that is the case please report this to the Opensuse packagers as that would be a packaging bug.
Comment 15 Andreas Nordal 2012-04-07 13:21:30 UTC
These are the packages I have right now:

Name                          | Version       | Repository
------------------------------+---------------+----------------------
amarok                        | 2.4.3-8.8.1   | openSUSE-12.1 Updates
clementine                    | 0.7.3-5.1.2   | openSUSE-12.1 OSS
gstreamer-0_10                | 0.10.35-4.1.4 | openSUSE-12.1 OSS
gstreamer-0_10-plugins-base   | 0.10.35-6.1.2 | openSUSE-12.1 OSS
gstreamer-0_10-plugins-good   | 0.10.30-6.4.1 | openSUSE-12.1 Updates
libgstreamer-0_10-0           | 0.10.35-4.1.4 | openSUSE-12.1 OSS
libphonon4                    | 4.6.0-9.4.2   | KDE:Distro:Stable
phonon-backend-gstreamer-0_10 | 4.5.90-5.4.1  | KDE:Distro:Stable

I also tried doing a dist-upgrade (zypper dup) back to plain OpenSuse 12.1 (reverting all updates), and deleted all hidden files & folders in my home directory that looked related to gstreamer or KDE, but clementine/gstreamer was still broken. I really wish I had btrfs now, so I could roll back whatever broke it.

I will be happy to report to OpenSuse packagers if we think this is a downstream issue. But Amarok was not gapless on Fedora either, and other people here are using Gentoo or compiling from git, so it seems unlikely.

To find out why it's only working for the devs, I think either we testers need a fully isolated  agreed-upon-with-the-devs chroot environment, or the devs could just pick any (live) distro, and debug why it isn't working by default. If there is a distro where Amarok works by default, then it's clearly downstream.
Comment 16 Myriam Schweingruber 2012-04-08 12:08:37 UTC
I strongly suggest you upgrade the phonon-backend-gstreamer, you are using an unstable version, 4.6 is out since quite some time.
Comment 17 Andreas Nordal 2012-04-08 21:38:31 UTC
No luck with phonon-backend-gstreamer 4.6.0-26.1 (from the "Upstream KDE 4.8" repo of http://en.opensuse.org/KDE_repositories). This is consistent with comment #12.

Thanks for pointing that out, Myriam! I did not knowingly use unstable software. In fact, I was using the "Stable" repo from that same page.
Comment 18 Sebastian Schubert 2012-08-15 07:59:34 UTC
I tried it on a Gentoo Box with
media-sound/amarok-2.6.0
media-libs/phonon-gstreamer-4.6.2
and KDE SC 4.8.4 in general with some flac files and I did not get gapless playback.
Comment 19 Andreas Nordal 2012-08-15 20:37:44 UTC
On a clean install of OpenSuse 12.2 RC 2 x86_64 (not the usual upgrade from previous installations), Amarok is gapless with flac! I am still afraid of installing Clementine due to possibly breaking Amarok again…
Amarok 2.5.0
KDE 4.8.4
phonon-backend-gstreamer 4.6.1-2.4.1
gstreamer 0.10.36-3.1.2
Comment 20 Myriam Schweingruber 2012-08-16 23:08:01 UTC
Interesting: one user who has the phonon-backend-gstreamer 4.6.1 has working gapless playback (although this is not possible due to the known regressions according to Harald Sitter) and one with version 4.6.2 hasn't. Seems quite confusing, subscribing the Phonon developers.
Comment 21 Matěj Laitl 2012-10-08 23:20:56 UTC
(In reply to comment #20)
> Interesting: one user who has the phonon-backend-gstreamer 4.6.1 has working
> gapless playback (although this is not possible due to the known regressions
> according to Harald Sitter) and one with version 4.6.2 hasn't. Seems quite
> confusing, subscribing the Phonon developers.

I must say that I had similar (and strange) observations: gapless (and fadeout) worked for me in phonon-gst 4.6.1 and regressed in 4.6.2. Trever?
Comment 22 Harald Sitter 2012-10-09 07:37:35 UTC
debug log please

random notes though:
a) 4.6.1 had a partial regression where in a lot of cases gapless would not work due to intermediate state changes (IIRC)
b) system needs to be fast enough
c) gstreamer ought to be supporting it for it to work in phonon

actually let me elaborate on b and c. for gapless to work gstreamer needs to somewhat accurately know the length of a track, it will then be able to fire a signal at phonon to queue the next track gapless (that is usually about 8 seconds before the end of the current track if I am not mistaken). phonon will then fire a signal for amarok to react upon, and here it gets tricky. the signal is queued (i.e. it gets placed in a queue of signals/events - the longer the queue, the bigger the delay between phonon queuing the signal and amarok receiving it). once the signal was queued phonon gives amarok 3 seconds to react and set the next track. if no track is set within 3 seconds, or if an intermediate state change occurs, or if gstreamer's signal was issued too late you are not getting gapless.
Comment 23 Benedikt Waldvogel 2012-12-15 14:28:33 UTC
Gapless playback is working for me since I upgraded gstreamer to 0.10.36.

Diagnostics:
Amarok Version: 2.6.0
KDE Version: 4.9.3
Qt Version: 4.8.2
Phonon Version: 4.6.0
Phonon Backend: GStreamer (4.6.2)
PulseAudio: Yes
Comment 24 Myriam Schweingruber 2012-12-15 23:06:41 UTC
Interesting, so was this an upstream issue?
Comment 25 Myriam Schweingruber 2012-12-27 22:08:47 UTC
*** Bug 312279 has been marked as a duplicate of this bug. ***
Comment 26 Myriam Schweingruber 2012-12-27 22:10:15 UTC
Closing based on comment #23. Please all, make sure you have the latest gstreamer version, at least version 0.10.36.
Comment 27 Alexander 2012-12-28 10:39:42 UTC
My tracks are located on local 10k rpm rapid drive so it could not be a problem here. But even if they were located on a remote storage, is it too hard to start pre-loading a next track before end a previous one?

The fact that it will only work with the phonon-backend-gstreamer and will not for .mp3 files (the most popular format, by the way) and only in certain moon position and the fact developers know about it does not solve the problem.

I am using VLC and don't want to switch to gstreamer. Is there a bug report on the phonon-vlc bug tracker? Is it related yo phonon-vlc at all or is it related to how amarok (phonon?) use it?
Comment 28 Myriam Schweingruber 2012-12-28 10:55:16 UTC
It totally depends on the Phonon backend, yes, as Amarok does no playback itself. Please make a feature request for the Phonon-backend-vlc
Comment 29 Alexander 2012-12-28 11:00:44 UTC
Okay, thank you.
Comment 30 Harald Sitter 2013-02-20 18:24:35 UTC
That request would be pointless as phonon-vlc cannot do gapless because vlc cannot do gapless. i.e. you'd best file the feature request with vlc, although AFAIK there are plenty of those already.