Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Chapter Marks for Opus, Vorbis and FLAC (Read 17624 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Chapter Marks for Opus, Vorbis and FLAC

Hallo!

For those who might be interested, there exists now a new chapter extension for Vorbis Comments:
http://wiki.xiph.org/Chapter_Extension

This enables chapter marks for all file formats, which use the vorbis comments metadata system:
Opus, Oggg vorbis, flac, speex, etc.

Maybe there are some player developers here - it's a great alternative to chapters in MP4/M4A files and there are more and more people using Vorbis Chapters (especially in the german speaking podcasting scene).

The format is very simple:
Quote
CHAPTER001=00:00:00.000
CHAPTER001NAME=Chapter 1
CHAPTER002=00:05:00.000
CHAPTER002NAME=Chapter 2
CHAPTER003=00:07:35.500
CHAPTER002NAME=Chapter 3
...


Thanks for your attention
LG
Georg

Chapter Marks for Opus, Vorbis and FLAC

Reply #1
Thanks for the heads up. This should be useful with single file rips, though I'm not sure it's possible to convert CD frames to milliseconds exactly.

Chapter Marks for Opus, Vorbis and FLAC

Reply #2
Thanks for the heads up. This should be useful with single file rips, though I'm not sure it's possible to convert CD frames to milliseconds exactly.


Well, you can of course just skip the milliseconds, if you don't have this information ...

Chapter Marks for Opus, Vorbis and FLAC

Reply #3
Thanks for the heads up. This should be useful with single file rips, though I'm not sure it's possible to convert CD frames to milliseconds exactly.
One Audio CD frame contains 588 16bit stereo samples. This leads to one frame being 1/75s = 0.0133s = 13.3ms long. So the chapters can not be mapped 100% accurately to audio CD frames, though I guess sub-ms precision is not really necessary.
It's only audiophile if it's inconvenient.

Chapter Marks for Opus, Vorbis and FLAC

Reply #4
Great!
Is it (planned to be) supported by Foobar?
I've added some chapters by Mp3tag, they are visible in FB as tags, but not recognized as chapters (using v1.1.4)
I guess it will be the first one to support it, anyway.


Chapter Marks for Opus, Vorbis and FLAC

Reply #6
Isn't chaptering on OGG files already supprted (atleast with foobar2000)?
Convert any album with multiple tracks to multi-track Vorbis or any Ogg-based format. You get one chaptered file.

Chapter Marks for Opus, Vorbis and FLAC

Reply #7
Isn't chaptering on OGG files already supprted (atleast with foobar2000)?
Convert any album with multiple tracks to multi-track Vorbis or any Ogg-based format. You get one chaptered file.


This was just a hack, where each chapter must be one ogg vorbis  file and then they are concatenated in one big file.
That's no real solution, has many other problems and nobody besides some version of foobar supports it ...

For a more in-depth discussion see also:
http://comments.gmane.org/gmane.comp.multi...rbis.devel/5612

Chapter Marks for Opus, Vorbis and FLAC

Reply #8
This was just a hack
Bullshit. Monty himself, according to the link you gave, claims that chained ogg is a "clean solution". It's a great solution, IMO. Metadata is embedded in the stream. Although it requires a stream-crawl to get the metadata and location info, it is exactly identical to eg. a radio stream with changing metadata.

Chapter Marks for Opus, Vorbis and FLAC

Reply #9
Awesome new feature--thanks for the info.

I was getting my hopes up that FB2K 1.1.16 would support it. Oh well, maybe support arrives with 1.1.17.

Chapter Marks for Opus, Vorbis and FLAC

Reply #10
Maybe someone should make a feature request ...

Chapter Marks for Opus, Vorbis and FLAC

Reply #11
Delightful, conflicting chapter standards.

Let's see. Chained streams:
  • Came first.
  • Supports multiple formats in the same stream, if you care about that.
  • Supports full tagging of each stream.
  • Each stream may be an arbitrary number of samples in length, handled by the format.
  • Already supported by a number of players, including Winamp and XMPlay. Oh, right, and foobar2000, for many years now.


Chapter tags:
  • Newly drafted last March.
  • Supports exactly one audio stream, or possibly interleaved audio streams.
  • Supports full tagging of just the whole stream, with only titles and web links per chapter, at least until somebody decides to extend the draft again.
  • Chapter marks are limited to an arbitrary precision timestamp, with no option for sample accuracy.
  • Exactly which players support this, or are likely to support this, but not chained streams? Remember that this format is useless for live streams, as those will likely be transmitting intermittent metadata, which needs to be indicated by stream splices.


Please explain why this idea is better than chained streams again. I would love to know why supporting chained streams requires any more work than supporting this. Remember that seeking already requires bisecting the files to determine the packet offsets and their granule positions. Handling chained streams simply requires this process to take place on file discovery, to determine the offsets of each individual stream. And any player which supports Ogg Vorbis streaming should already support basic chaining, to support streams with metadata.

Chapter Marks for Opus, Vorbis and FLAC

Reply #12
chapter tags seem easier to deal with for me (i'm a non-technical user). i record one file, encode it, add metadata (including chapters), and upload it. done. seems more convenient to me than going the chained stream route for which i need to split up files, only to concatenate them again later.

for my typical usage scenario as a consumer of podcasts (i d/l podcasts via a podcatcher and play them back locally), i don't see why i would need the extra functionality of chained streams.

Chapter Marks for Opus, Vorbis and FLAC

Reply #13
I find this extension very useful for my needs.
I have a god number of albums (mainly progressive rock, concept albums etc) which contains tracks with multiple parts.
If I have to rip/convert an album to a format which doesn't support chapters, I would have two possibilities:
- rip the whole tracks and forget about particular parts, or
- divide the tracks into parts and encode the parts separately.
In the second case I have to tag explicitly the parts so that I know to which 'mother' track they belong, but the naming convention becomes a bit clumsy.
The same goes for many classical albums, BTW.
In order to keep the album structure as close as possible to original, currently I use Musepack, which has a native chapter support. However, adding chapters in mpc files is a bit tricky, because they are part of the stream. The advantage is, that the chapters cannot be removed easily by accident.
However, the suggested ogg chapter extension is easier, because the chapters can be added by a regular tag editor.
So, I could make use of this extension if I decide to use vorbis (for instance) as a lossy codec of choice.

Chapter Marks for Opus, Vorbis and FLAC

Reply #14
Please explain why this idea is better than chained streams again. I would love to know why supporting chained streams requires any more work than supporting this. Remember that seeking already requires bisecting the files to determine the packet offsets and their granule positions. Handling chained streams simply requires this process to take place on file discovery, to determine the offsets of each individual stream. And any player which supports Ogg Vorbis streaming should already support basic chaining, to support streams with metadata.


For what its worth, we can't support chaining in Rockbox because we have no way to reallocate the various buffer sizes without completely quitting the codec and reallocating everything (since we have no virtual addressing and so cannot defragment the address space).  We also have no way to detect that you've chained files since we can't seek to the end of the file because its most likely not loaded from the disk yet.  So from our point of view, restrictions on inane things (like changing the transform buffer sizes mid-file with no way to know prior to scanning the entire file) are certainly welcome.  We could reasonably support chapter tags though, and we do for other formats. 

Chapter Marks for Opus, Vorbis and FLAC

Reply #15
As the others already said, IMHO this chapter extension is much easier to use for tagging software and player developers.

For instance, we usually have 2h-3h podcast files with lots of chapters.
These chapters are often changed, some new ones are added, a few are deleted etc.
With chained chapters I would have to manipulate the direct ogg stream at every change - so I can just change the tags with any tagging software available.

And it's also easy for (simple) player developers: if they just use a library for playing media files, they can just read the chapter tags and seek to the desired location.
Furthermore it's similar to other common chapter mark systems as MP4, ID3 chapters (http://id3.org/id3v2-chapters-1.0), Matroska, WebVTT etc.

However, personally I do not care which exact chapter system should be used. If you think that the chained chapters are more appropriate, please speak up at the vorbis-dev mailing list, they are very open for suggestions!
For me it's just important, that there is one way which most of the devs and users agree on - it's 2012 and not possible to listen to podcasts with chapters in Ogg Vorbis are Opus, this should change!
Chapters are very common in MP4 podcasts and are also getting more and more popular in MP3 (http://id3.org/id3v2-chapters-1.0 - players like instacast or antennapod support it on the iPhone and Android).
Hopefully this will be possible with Ogg Vorbis and Opus too ...


Chapter Marks for Opus, Vorbis and FLAC

Reply #16
Old topic but I wonder if putting the stream in Matroska containers would be better for full CD rips because Matroska chapters can be nested, so a song can be it's own chapter and have chapters of its own.

Chapter Marks for Opus, Vorbis and FLAC

Reply #17
Old topic but I wonder if putting the stream in Matroska containers would be better for full CD rips because Matroska chapters can be nested, so a song can be it's own chapter and have chapters of its own.

For opus support, new elements (CodecDelay, DiscardPadding and SeekPreRoll) have been added to the Matroska v4 spec, that looks similar to the ones present in MP4.
http://matroska.org/news/opus_additions.html

They should be mandatory for sample accurate seeking/decoding of any MDCT based lossy codec including Vorbis, but I don't know how many implementation cares about it other than for opus.

Re: Chapter Marks for Opus, Vorbis and FLAC

Reply #18
I have stumbled upon the Thing soundtrack on YouTube, which has chapter marks.
To get OPUS: yt-dlp -f bestaudio[ext=webm] _vtd-K-zuiM -x --embed-chapters
To get M4A: yt-dlp -f bestaudio[ext=m4a] _vtd-K-zuiM -x --embed-chapters
Now I add both files to Foobar 2.0 (November 2023 build), but chapters are displayed only in the case of M4A, although MPC-HC and MPV players as well as MediaInfo show their presence in both files. But why, @Peter? Aggrrhh, 11 years passed and still no predictable behavior.
• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data

Re: Chapter Marks for Opus, Vorbis and FLAC

Reply #19
I have stumbled upon the Thing soundtrack on YouTube, which has chapter marks.
To get OPUS: yt-dlp -f bestaudio[ext=webm] _vtd-K-zuiM -x --embed-chapters
To get M4A: yt-dlp -f bestaudio[ext=m4a] _vtd-K-zuiM -x --embed-chapters
Now I add both files to Foobar 2.0 (November 2023 build), but chapters are displayed only in the case of M4A, although MPC-HC and MPV players as well as MediaInfo show their presence in both files. But why, @Peter? Aggrrhh, 11 years passed and still no predictable behavior.

Well, since I'm not the first one reviving this thread after over a decade...
How is one to take a list of 10 .opus files and put them into an indexed list of 10 chapters inside 1 .opus file?

I have not been able to find an easy "do this" tutorial and it seems like (from the above at least) this has issues...

Re: Chapter Marks for Opus, Vorbis and FLAC

Reply #20
Alright, I have gotten an index from my file names:
Code: [Select]
CHAPTER000=00:08:20.940
CHAPTER000NAME=Introduction
CHAPTER001=01:23:43.906
CHAPTER001NAME=The Unauthorized Peacemaker
CHAPTER002=00:58:55.938
CHAPTER002NAME=Speech Becomes Sedition
CHAPTER003=01:08:08.686
CHAPTER003NAME=The Federalists\' Last Stand
CHAPTER004=01:06:06.698
CHAPTER004NAME=The Rogue Diplomat
CHAPTER005=02:01:01.507
CHAPTER005NAME=The Gray-Eyed Man of Destiny
CHAPTER006=01:11:36.572
CHAPTER006NAME=Striking the Copperhead
CHAPTER007=00:59:42.677
CHAPTER007NAME=The Will of the People Undone
CHAPTER008=01:10:43.898
CHAPTER008NAME=American Bolshevik
CHAPTER009=01:01:19.956
CHAPTER009NAME=The Press Goes to War

Which isn't right, but since it's not working yet, I don't see how starting 8 1/3 minutes in going to break anything, however I just zeroed that out and reran it so that CHAPTER000=00:00:00.000 and thus CHAPTER001 will start 8 1/3 minutes late, but since I can't get VLC to see the chapter markers mediainfo does, this looks moot.

Code: [Select]
$ mi If\ This\ Be\ Treason\ --\ Audiobook.opus
General
Complete name                            : If This Be Treason -- Audiobook.opus
Format                                   : Ogg
File size                                : 74.5 MiB
Duration                                 : 11 h 9 min
Overall bit rate                         : 15.5 kb/s
Writing application                      : Lavc60.6.101 libopus

Audio
ID                                       : 415454770 (0x18C35632)
Format                                   : Opus
Duration                                 : 11 h 9 min
Channel(s)                               : 1 channel
Channel layout                           : C
Sampling rate                            : 24.0 kHz
Compression mode                         : Lossy
Writing library                          : Lavf60.18.100

Menu
00:00:00.000                             : Introduction
01:23:43.906                             : The Unauthorized Peacemaker
00:58:55.938                             : Speech Becomes Sedition
01:08:08.686                             : The Federalists\' Last Stand
01:06:06.698                             : The Rogue Diplomat
02:01:01.507                             : The Gray-Eyed Man of Destiny
01:11:36.572                             : Striking the Copperhead
00:59:42.677                             : The Will of the People Undone
01:10:43.898                             : American Bolshevik
01:01:19.956                             : The Press Goes to War
[NB: The quoted Federalists\' in the code above was done on the HA forum, not in bash.]

And that certainly looks like other books...even opus books converted from m4b.

FWIW: here's the code I used to generate the above.  If I run into a chapter longer than 09:59:59.99, then I'll split out the hours and do them separately, but for now this suffices—except for the fact that the times are start times and I need to sum them...

Code: [Select]
 
#!/bin/bash

for i in *opus
 do
   chno="${i#*Part }"; chno="${chno%.*}"; chno="${chno%:*}"
   chna="${i#* -- Part }"; chna="${chna%.opus}"; chna="${chna:4}"
   d=$(ffprobe -v error -show_entries format=duration -sexagesimal -of default=nk=1:nw=1 "$i")
   hms="${d%.*}"
   ms="${d##*.}" ; ms1="${ms:0:3}"; ms3="${ms:3:1}"
   [[ "$ms3" -gt 4 ]] && ((ms1++))
   printf "CHAPTER%03d=0%s.%03d\n" "${chno#0}" "$hms" "$ms1"
   printf "CHAPTER%03dNAME=%s\n" "${chno#0}" "$chna"
done


How do I make this work in e.g., VLC?



bash script to embed index in .opus Re: Chapter Marks for Opus, Vorbis and FLAC

Reply #21
Here's a bash script to take a bunch of <title> -- Part <##>: Chapter Title.opus and make them into an indexed <title> -- Audiobook.opus file:

https://github.com/iconoclasthero/indexopus
nb: still a work in progress that needs to be adapted, but it will embed an index from a list of constituent files.  The index can be added at any time regardless of whether it was split apart or not—though that script doesn't do that as written)

VLC's chapter support is weak at best (though they do sorta show up there). 

Works on audiobookshelf just fine.

Re: Chapter Marks for Opus, Vorbis and FLAC

Reply #22
@iconoclasthero, I've created a dedicated feature request that you track here.
• Join our efforts to make Helix MP3 encoder great again
• Opus complexity & qAAC dependence on Apple is an aberration from Vorbis & Musepack breakthroughs
• Let's pray that D. Bryant improve WavPack hybrid, C. Helmrich update FSLAC, M. van Beurden teach FLAC to handle non-audio data