Bug 418079

Summary: k3b problems with flac 24bit
Product: [Applications] k3b Reporter: Nikos Papadopoulos <231036448>
Component: Audio ProjectAssignee: k3b developers <k3b>
Status: RESOLVED FIXED    
Severity: major CC: aacid, krashrson, michalm, trueg
Priority: NOR    
Version: 19.04   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: "original" flac file created by Audacity
"cropped" wav file, created by k3b, out of the "original" 24bit flac

Description Nikos Papadopoulos 2020-02-23 09:29:18 UTC
SUMMARY
K3b has problems creating audio CDs out of 24bit flac files, but reports success.

STEPS TO REPRODUCE

Version 1
1. download some 24bit flac files
2. open k3b, create a new audio CD project
3. add the 24bit flac files
4. choose to "extract audio only" (you can also choose to burn the CD, but you'll just waist a CD)
5. check (open) the new wav files with audacity, or mediainfo, or any media player


Version 2
1. open an audio file with audacity
2. crop the bulk of the file and keep just 1.5 seconds of sound
3. export as 24bit flac file (example: "001_24bit_8compresion.flac")
4. again, export, but this time, as a 16bit flac file (example: "002_16bit_8compresion.flac")
5. check the two new flac files with some other media app (the audio must be practically the same)
6. ...
7. open k3b, create a new audio CD project
8. add the 24bit flac file AND the similar 16bit flac file
9. choose to "extract audio only" (you can also choose to burn the CD, but you'll just waist a CD)
10. check (open) the new wav files with audacity, or mediainfo, or any media player


OBSERVED RESULT

In version 1, the files that were produced were empty of audio.
Although they were proper files 
(mediainfo showed them as typical wav files,
but opening them with audacity showed a flat line,
and other media players played the files "normally", 
but with 0 sound).
Previously I had burned the CD, and k3b reported as 100% done.
Yet, when I tried to play the CD, it was playing "normally", 
but with no sound coming out.

In version 2, the wav file, that was produced by the 24bit flac file, had sound, but had gotten cropped by k3b.
Instead of 1.5 seconds of music it had only 1.0 seconds.
quote from the original 24bit flac:
> Complete name                            : .../001_24bit_8compresion.flac
> Duration                                 : 1 s 562 ms
quote from the created wav file:
> Complete name                            : .../k3b_audio_0_01.wav
> Duration                                 : 1 s 0 ms
Whereas the similar wav file, that was produced by the similar 16bit flac file, had no problems.

Therefore I concluded that k3b has problems with 24bit flac files.

EXPECTED RESULT
This is probably an issue with the flac encoder, but k3b should, at least, warn the user in advance, instead of falsely reporting success, afterwards.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma:   Mageia 7 64bit
KDE Plasma Version: 
KDE Frameworks Version:    KDE Frameworks 5.57.0
Qt Version:   Qt 5.12.6 (built against 5.12.2)

ADDITIONAL INFORMATION
Comment 1 Albert Astals Cid 2020-02-23 11:02:53 UTC
Could you attach any of those files that fail for you?
Comment 2 Nikos Papadopoulos 2020-02-23 17:49:36 UTC
Created attachment 126348 [details]
"original" flac file created by Audacity
Comment 3 Nikos Papadopoulos 2020-02-23 17:52:35 UTC
Created attachment 126349 [details]
"cropped" wav file, created by k3b, out of the "original" 24bit flac
Comment 4 Albert Astals Cid 2020-02-23 19:13:55 UTC
Git commit 183d20b1aa544c221592eb32b9743dc287ae0e79 by Albert Astals Cid.
Committed on 23/02/2020 at 19:13.
Pushed by aacid into branch 'release/19.12'.

Fix libsoundfiledecoder with files with non whole second length

There were two issues:
 * the frames calculation was first doing integer division and the
   multiplication by a double, so the result was always a whole number
of seconds in frames
 * the code decodeInternal always assumed that it would read a whole
   second and if not that was a problem

M  +1    -5    plugins/decoder/libsndfile/k3blibsndfiledecoder.cpp

https://commits.kde.org/k3b/183d20b1aa544c221592eb32b9743dc287ae0e79
Comment 5 Albert Astals Cid 2020-02-23 19:15:27 UTC
I've fixed the half second of that file getting cropped. If you have different issues with other files (from reading your original text i think you do), please open a new bug.