Flac + Cue file not playing correctly
#1
Good evening,

I've been using XBMC for the last month and I have to say I'm very impressed. However, with a few of my flac+cue files, I have a very annoying bug. When I start a song, the song play just fine. When it transition to the next song in the album, the first second of the 2nd song play twice. Also, it takes a very long time for the playback timer to go from 00:00 to 00:01, a lot more than a second. After the skip the playback timer resume it's normal functions. It really is annoying, especially since flac+cue file is supposed to have perfect gaps. The cue file play correctly in foobar2000. The flac file have a cue file embeeded, but it is the same as the cue file itself.

When I play the flac file in VLC (which see it as one very long song), the gaps are perfect, no repetition of the first second of the songs while transiting from a song to another. This means that the audio content itself is good.

CATALOG 0075596266123
FILE "scenesny1.flac" FLAC
PERFORMER "Dream Theater"
TITLE "Live Scenes From New York"
TRACK 01 AUDIO
ISRC USEE10100855
TITLE "Regression"
INDEX 00 00:00:00
INDEX 01 00:00:32
TRACK 02 AUDIO
ISRC USEE10100879
TITLE "Overture 1928"
INDEX 01 02:46:37
TRACK 03 AUDIO
ISRC USEE10100856
TITLE "Strange Déjà Vu"
INDEX 01 06:18:37
TRACK 04 AUDIO
ISRC USEE10100857
TITLE "Through My Words"
INDEX 01 11:21:05
TRACK 05 AUDIO
ISRC USEE10100880
TITLE "Fatal Tragedy"
INDEX 01 13:03:20
TRACK 06 AUDIO
ISRC USEE10100859
TITLE "Beyond This Life"
INDEX 01 19:25:10
TRACK 07 AUDIO
ISRC USEE10100860
TITLE "John & Theresa Solo Spot"
INDEX 01 30:42:02
TRACK 08 AUDIO
ISRC USEE10100861
TITLE "Through Her Eyes"
INDEX 01 33:59:45
TRACK 09 AUDIO
ISRC USEE10100862
TITLE "Home"
INDEX 01 40:16:60
TRACK 10 AUDIO
ISRC USEE10100863
TITLE "The Dance of Eternity"
INDEX 01 53:37:72


I tried to change filetype from FLAC to WAVE, but nothing changed. The file really seems to comply to the wiki page on the subject.

I disabled crossover completely in the player setting.

The only relevant log entry I found in xbmc.log is
16:58:59 T:2716 M:2474385408 ERROR: MUSIC_INFO::CFlacTag::Read Unable to create album art for D:\EricHome\Musique\Dream Theater\Live Scenes From New York\scenesny1.flac (extension=jpeg, size=46502)

This flac also have embeded artwork but I really don't think it's relevant.

Can anyone point out what could be wrong with my cue sheet & why do I experience this ? Again, the problem is that when playing an album, the first second of the songs are played twice during the transition.


I use XBMC 9.0.4.1-repack2 on Windows 7 x64. I have a intel E8400, 4GB ram. I have a geforce 9300 chipset which provides video and audio. NVIDIA Geforce 9300/nForce 730i driver 8.15.11.9038

Debug log available at : http://pastebin.com/m5fdf394f


Thank you

Eric
Reply
#2
bump
Reply
#3
Exact Same problem.

Ripped CDs to a single FLAC image with separate CUE file.

Playing a track in XBMC results in a second or two of the next track being played.

If you play two tracks one after the other you get the first second or two of track 2 at the end of track 1 and then the first second or two of track two is repeated when track two starts.

This happened whether the FLAC was ripped using EAC or foobar2000

The same FLAC would play without these problems in other apps e.g. foobar2000.

If found that if I edited the cue file to make the track 2 seconds shorter I could trick XBMC into working, but that's no solution.

I've resorted to ripping the CDs into separate FLACs for each track, which isn't what I had hoped for, but it's not a problem, and I suppose if I ever figure this out in XBMC then I can recombine them later.

Other than that, loving XBMC, although I'd like a neat way to handle home videos, but that's another story.

-Rd
Reply
#4
Build: Camelot

I have the same problem also in combination with mp3s.
The stutter is much quicker than 1 second but still really annoying.

Cue-sheets are almost a necessity when it comes to live sets and therefore it's really appreciated if someone could help me fix this problem.
Reply
#5
+1 on this, still an issue in Dharma beta
Reply
#6
Another issue in dharma beta 2. There is large delay (up to 15 seconds) when starting to play some other than the first track of flac+cue on large amount of my flac's.

I think it's caused by realisation of seeking frame beginning in flac stream.

While waiting for track to start playing log fills with lots of strings like:

22:51:11 T:140113926801168 M:1366745088 DEBUG: Process, request seek on source to 152518416

XBMC 9.11 log looks the same, but there is no delay.

As far as i can see problem is that libFLAC's function FLAC__stream_decoder_seek_absolute searches
for the start of the frame that begins before the requested absolut seek byte offset. This causes lots of calls of

FLAC__StreamDecoderSeekStatus FLACCodec:Big GrinecoderSeekCallback(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
which in turn calls

int64_t CFileCache::Seek(int64_t iFilePosition, int iWhence)

and posts event for the thread, executing

void CFileCache:Tonguerocess()
which produces this log messges

In 9.11 callstack looks the same.
Sadly i've got no free time to investigate further, but to my opinon this issue may be caused by some changes to IPC which slows it down.

For the case of playing FLAC's and other streams which use backward searches, to my mind would be reasonable to implement special caching methods which on seek would buffer some kilobytes before seek positon. This will allow to read from cache in the same thread that produces decoding and avoid unnecessary IPC usage.

PS.
Sorry for my poor english. It's not my native language.
Reply
#7
As a fast but rough workaround one can turn off caching of flac files.

How to:
Find implementation of method
bool FLACCodec::Init(const CStdString &strFile, unsigned int filecache)
in file
xbmc/cores/paplayer/FLACcodec.cpp

and replace in line
if (!m_file.Open(strFile, READ_CACHED))
open mode READ_CACHED to READ_NO_CACHE.

As a result you'll have this string:
if (!m_file.Open(strFile, READ_NO_CACHE))

This will eliminate delay before start playing of flac's.
Reply

Logout Mark Read Team Forum Stats Members Help
Flac + Cue file not playing correctly0