GNOME Bugzilla – Bug 351595
[flacenc] write seek tables
Last modified: 2010-01-08 16:45:01 UTC
FLAC seek tables are necessary for at least the XINE framework to support track seeking. I'm not sure about other frameworks. This is pretty important to me, as I (accidentally) encoded 50 GB of audio (my entire CD collection) without seek tables. As a result my media player (Amarok) cannot seek any of them. By default seek tables are built, except in situations where the input size is unkown. I believe this is the situation with sound-juicer, where the data is streamed to the flac encoder as it is being ripped. From flac's man page: With no -S options, flac defaults to '-S 10s'. Use --no-seektable for no SEEKTABLE. Note: '-S #x' and '-S #s' will not work if the encoder can't determine the input size before starting. Without knowing anything about gstreamer, here are a couple proposed solutions: 1. If the size can be pre-calculated: From flac's man page: --input-size=# Specify the size of the raw input in bytes. If you are encoding raw samples from stdin, you must set this option in order to be able to use --skip, --until, --cue-sheet, or other options that need to know the size of the input beforehand. If the size given is greater than what is found in the input stream, the encoder will complain about an unex- pected end-of-file. If the size given is less, samples will be trun- cated. 2. Otherwise, include an option to queue tracks to be encoded only after being completely ripped first.
I found another option: 3. Use metaflac to add the seek tables afterwards From the metaflac man page: --add-seekpoint={#|X|#x|#s} Add seek points to a SEEKTABLE block. Using #, a seek point at that sample number is added. Using X, a placeholder point is added at the end of a the table. Using #x, # evenly spaced seek points will be added, the first being at sample 0. Using #s, a seekpoint will be added every # seconds (# does not have to be a whole number; it can be, for example, 9.5, meaning a seekpoint every 9.5 seconds). If no SEEKTABLE block exists, one will be created. If one already exists, points will be added to the existing table, and any duplicates will be turned into placeholder points. You may use many --add-seekpoint options; the resulting SEEKTABLE will be the unique-ified union of all such values. Example: --add-seekpoint=100x --add-seekpoint=3.5s will add 100 evenly spaced seekpoints and a seekpoint every 3.5 seconds. #3 also allows me to easily fix my collection! Yay! :)
SJ doesn't actually write the FLAC files, GStreamer does.
Totem with GStreamer 0.10 backend seems to have absolutely no problem seeking in GStreamer-encoded flac files, neither do mplayer or VLC, so this looks like something worth filing in the xine bugtracker as well. Nevertheless, seek tables would be nice to have of course.
Maybe it is not connected, but recording rather big bunches of audio data (approximately 350 MB) from audio in with this pipeline on Ubunty Feisty: gst-launch-0.10 alsasrc device="hw:2" ! audioconvert ! flacenc ! filesink location=file.flac ...gives the same unseekable FLAC file as mentioned in bug report (Totem simply freezes when trying to seek), which is quite annoying. Also such pipeline spawns several WARNING: from element /pipeline0/alsasrc0: Internal GStreamer error: clock problem. Please file a bug at http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer. Additional debug info: gstbaseaudiosrc.c(583): gst_base_audio_src_create (): /pipeline0/alsasrc0: dropped 13230 samples errors to deal with.
commit fe1128e40b1ff27d98d1467711dcd5a16a7ca94f Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> Date: Wed Jan 6 17:06:53 2010 +0100 flacenc: optionally add a seek table API: GstFlacEnc:seekpoints Fixes #351595.