Kodi Community Forum

Full Version: Flac + Cue file not playing correctly
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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"
ISRC USEE10100855
TITLE "Regression"
INDEX 00 00:00:00
INDEX 01 00:00:32
ISRC USEE10100879
TITLE "Overture 1928"
INDEX 01 02:46:37
ISRC USEE10100856
TITLE "Strange Déjà Vu"
INDEX 01 06:18:37
ISRC USEE10100857
TITLE "Through My Words"
INDEX 01 11:21:05
ISRC USEE10100880
TITLE "Fatal Tragedy"
INDEX 01 13:03:20
ISRC USEE10100859
TITLE "Beyond This Life"
INDEX 01 19:25:10
ISRC USEE10100860
TITLE "John & Theresa Solo Spot"
INDEX 01 30:42:02
ISRC USEE10100861
TITLE "Through Her Eyes"
INDEX 01 33:59:45
ISRC USEE10100862
TITLE "Home"
INDEX 01 40:16:60
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 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

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

Thank you

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.

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.
+1 on this, still an issue in Dharma beta
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.

Sorry for my poor english. It's not my native language.
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

and replace in line
if (!m_file.Open(strFile, READ_CACHED))

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.