Jump to content

FLAC audio is not always gapless


gottogo99

Recommended Posts

Hello,

 

My first post here. This is a specialized problem but of great interest to me.

 

When burning an audio CD from a live album, with no gaps between tracks, there are no problems using the original .wav files. However, after converting to .flac, there is an audible tick between some tracks after burning.

 

Tracks were extracted using Exact Audio Copy and were verified with AccurateRip; converted using FLAC via foobar2000. All programs are the latest versions.

 

I take it the problems lies with the Directshow filter. I'm using Illiminable's 0.73... as recommended in another thread. CoreFLAC's version seemed even worse in an earlier test. MadFLAC doesn't work (yet).

 

Any suggestions? One thing which surprised me is that both burns show the write type as SAO. Sector At Once? I tried to manually set to Disc At Once but couldn't. Both log files combined into one doc attached, FLAC first.

 

Thanks for your time. Great program.

ImgBurn_Ya_Yas_compare_flac_wav.log

Link to comment
Share on other sites

The only way to get it 100% gapless (unless working with a file that doesn't need decoding - i.e. wav/pcm) is to save as 1 big file.

 

The others are subject to gaps if the decoded data doesn't match what the codec returns for a 'size' (playback time) of the file.

Link to comment
Share on other sites

Actually EAC can rip straight out to flac.

 

Set flac as your encoder in Compression Options. You'll need flac.exe obviously and you'll need to specify where it is.

 

When you rip a CD, got to

 

Action

 

then

 

Copy Image and create Cue Sheet

 

Then select compressed.

 

Then specify where to save and Bob's your Uncle. You will get one large .flac file and a .cue file.

 

You can also choose to do individual files compressed too.

 

Foobar is great too by the way. But it's an extra step.

Link to comment
Share on other sites

Oh and btw, SAO is Session At Once.

 

SAO and DAO are basically the same thing. It's called SAO on CD and DAO on DVD/HD DVD/Blu-ray.

 

Basically the write types available (as per the MMC specs) are Incremental, TAO, SAO, RAW, Layer Jump.

 

In 2.4.0.0 I only really support Incremental and SAO (which doubles up as DAO).

 

TAO is also then supported (properly - i.e. as a real option) in 2.4.1.0. It's in 2.4.0.0 but only as a fallback if SAO isn't available and it's implementation is pretty poor (hence the proper update in 2.4.1.0).

 

I guess I could actually write SAO/DAO in the 'Write Type' dropdown box to avoid the confusion.

 

On DVD/HD DVD/Blu-ray the only supported write types are Incremental, SAO/DAO (and 'Layer Jump' but that only applies to DVD-R DL and isn't supported by ImgBurn because it's a waste of time). If you select anything that's not supported it'll just default to SAO/DAO.

 

I've never got Incremental working on CD so that just defaults to SAO/DAO regardless.

Link to comment
Share on other sites

I realized too late SAO = Session At Once. Oops.

 

I know that audio tracks which don't end at the correct sector boundary will have an audible gap when burned and played back. The CDR burned from .wav files is fine. I then converted those files to .flac, and that burned CDR has some gaps. Not between every song, but some. The tracks do not have any sector boundary errors, so what's causing the gaps, the Directshow filter?

 

A single .flac file with multiple cue/track points, which I tried later, burns and plays without gaps. But most of my music is individual tracks.

 

Not sure what to try next. Any ideas? Would more information help? Has anyone else tried burning gapless FLACs? Or any other lossless compressed audio, for that matter.

Link to comment
Share on other sites

Yes it's the DirectShow filter (or at least I think it is!)

 

The playback time of the file is found via:

 

IMediaSeeking->GetDuration(&Duration)

 

That's then converted into 'frames' (which are equal to 1/75th of a second).

 

1 Frame = 1 Sector.

 

So once I've got that info I know how many sectors to reserve for the track in the cue sheet.

 

If the DirectShow filter doing the decoding say's it's finished processing the file and I've not reached the number of sectors I'd reserved, I have to pad it with zeroes until I have.

 

A zeroed sector or two at the end of the track wouldn't be noticable on normal discs but of course would be on a mixed cd. For that reason, those kinds of discs must use a single large file.

Link to comment
Share on other sites

Playback time is shown in the 'Time' column within the 'Create CD CUE File' window.

 

If the CUE file comes from elsewhere, press the 'Image Information' button once you've loaded it in to Write mode. (That's the button with the picture of a disc and a question mark on it)

Link to comment
Share on other sites

I extracted the audio tracks as a single image with EAC from the disc burned with FLAC audio files and checked it with an audio editor.

 

As LightningUK! suspected, there are gaps where one track doesn't go all the way to its end and the next track starts where it's supposed to. Gaps are 1-2 frames.

 

Is ImgBurn is too fast for the Directshow filter in some cases? Is there some way for it to check to make sure the filter has finished? I'm burning on a CDRW which is limited to 24X; I would think a 52X CDR would be even worse. I have a very modern PC so computing power shouldn't be an issue.

Link to comment
Share on other sites

'Too fast' doesn't come into it.

 

DS tells me when it's done, that's how I know I have to insert digital silence to pad the track if there isn't as much decoded data as originally estimated.

 

The only way you're going to get anywhere with this now is to go to the madflac bloke or whoever and ask why the DS filter comes up short (or doesn't work at all).

 

As mentioned previously, if you want a seamless disc you need to use a single large file.

 

Even ImgBurn could be semi useful for that, it'll read an Audio CD to a WAV file, then just compress it using a Flac GUI type thing. Change the .cue file so it points to the .flac file (and not .wav) and then burn away!

Link to comment
Share on other sites

Excellent news to report: this DirectShow filter works for FLAC with no dropped frames: http://www.dsp-worx.de/?n=15. I burned a live album with no gaps from FLAC files. ImgBurn verified it and it played back with no gaps. Problem solved.

 

If you use the binary archive you can edit the register.ini file to avoid registering unnecessary file types.

Link to comment
Share on other sites

  • 2 weeks later...

I've read this thread with great interest, as I am also annoyed by the gaps in live CDs. I have several CDs in MP3 or FLAC formats, and even after converting them to WAV, there are still gaps.

 

I hate to have to say that, but Nero doesn't have this issue. I don't know its secret, but I suppose that it is smart enough to verify the duration of the data, and that it uses some samples from the next file to fill the gap. (Perhaps it's why it scans all audio files before burning.)

 

I know that we can burn a large file to avoid the gaps. It should even be possible to use the cue produced by ImgBurn with the separate files, and edit it to use the large WAV instead. But it's much work, and not easy for most users. So, imo, I think it's an important thing to improve. There is certainly a possibility to avoid those gaps. Perhaps an option to truncate the last frame if it is not filled completely, instead of padding it? IMO, most of the time, that should be less perceptible.

 

BTW, what is the length of a frame, in samples? I would like to verify if my WAV files are cut at a frame boundary.

Link to comment
Share on other sites

If you convert to WAV then the gaps aren't added by ImgBurn - the decoded size should be a perfect match to what DS had estimated.

 

I don't know all the in's and out's of audio but if the size isn't a multiple of 2352 (the sector size) then there's always going to be some 'zero' bytes inserted.

 

I guess you're right though, the only way to get a 100% accurate size is to ignore the size reported by DS and do a dummy decoding process.

Link to comment
Share on other sites

If you convert to WAV then the gaps aren't added by ImgBurn - the decoded size should be a perfect match to what DS had estimated.

Right, but there are still little gaps in the audio CD, probably because the decoded WAV are not cut at a frame or sector boundary.

 

I don't know all the in's and out's of audio but if the size isn't a multiple of 2352 (the sector size) then there's always going to be some 'zero' bytes inserted.

Thanks for the info. Do you mean that each file must be cut at a sector boundary rather than at a frame boundary? That's bad news!

 

I guess you're right though, the only way to get a 100% accurate size is to ignore the size reported by DS and do a dummy decoding process.

Do you plan to implement something like that?

 

BTW, I've just tested with Nero 6, and there are no gaps. It has even an option to cross-fade the tracks. So, I'm now convinced that it fills the gaps with some data of the next track, or it cuts the previous file sooner and adds the remaining samples to the next track (imo a better solution.)

Link to comment
Share on other sites

Please don't do that! Adding new codecs when they are not absolutely necessary is extremely dangerous! See the numerous problems with the codec packs distributed on the internet.

Link to comment
Share on other sites

Thanks for the info. Do you mean that each file must be cut at a sector boundary rather than at a frame boundary? That's bad news!

 

Well no matter how much data you supply, the program can't write part of a sector so either the PCM data ends perfectly at byte 2351 or it ends before it and the rest are left as zeroes.

 

I don't really know about the whole taking data from other tracks thing... it seems kinda wrong to me.

 

I guess you're right though, the only way to get a 100% accurate size is to ignore the size reported by DS and do a dummy decoding process.
Do you plan to implement something like that?

 

I'm on it right now :)

 

Oh and I'd never include the filters in with ImgBurn. That's VERY messy.

Link to comment
Share on other sites

I haven't tested it fully yet, but it seems fine. I've just burned some good FLAC files, and the CD is perfect. No (audible) gap.

 

I can still hear gaps with some MP3 files, BUT the problem is in the file itself. (There is approx 100 ms of silence at the beginning and at the end of the file.) Of course, it's not an ImgBurn problem.

 

I will post more feedback here later...

 

Anyway, thanks for your good work!

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.