-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add id3v2 export to HLS output. (#3154)
This PR implements support for ID3 metadata for HLS output. From the doc: ## Metadata HLS outputs supports metadata in two ways: - Through a `timed_id3` metadata logical stream with the `mpegts` format. - Through regular ID3 frames, as requested by the [HLS specifications](https://datatracker.ietf.org/doc/html/rfc8216#section-3.4) for `adts`, `mp3`, `ac3` and `eac3` formats. - There is currently no support for in-stream metadata for the `mp4` format. Metadata parameters are passed through the record methods of the streams' encoders. Here's an example ```liquidsoap output.file.hls( "/path/to/directory", [ ("aac", %ffmpeg(format="adts", %audio(codec="aac")).{ id3_version = 3 }), ("ts-with-meta", %ffmpeg(format="mpegts", %audio(codec="aac")).{ id3_version = 4 }), ("ts", %ffmpeg(format="mpegts", %audio(codec="aac")).{ id3 = false }), ("mp3", %ffmpeg(format="mp3", %audio(codec="libmp3lame")).{ replay_id3 = false }) ], source ) ``` Parameters are: - `id3`: Set to `false` to deactivate metadata on the streams. Defaults to `true`. - `id3_version`: Set the `id3v2` version used to export metadata - `replay_id3`: By default, the latest metadata is inserted at the beginning of each segment to make sure new listeners always get the latest metadata. Set to `false` to disable it. Metadata for these formats are activated by default. If you are experiencing any issues with them, you can disable them by setting `id3` to `false`. Fixes: #3153
- Loading branch information
Showing
26 changed files
with
816 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
(***************************************************************************** | ||
Liquidsoap, a programmable audio stream generator. | ||
Copyright 2003-2023 Savonet team | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details, fully stated in the COPYING | ||
file at the root of the liquidsoap distribution. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
*****************************************************************************) | ||
|
||
let _ = | ||
Lang.add_builtin ~base:Liquidsoap_lang.Builtins_string.string "id3v2" | ||
~category:`String | ||
~descr:"Return a string representation of a id3v2 metadata tag" | ||
[ | ||
("", Lang.metadata_t, None, None); | ||
( "version", | ||
Lang.int_t, | ||
Some (Lang.int 3), | ||
Some "Tag version. One of: 3 or 4" ); | ||
] | ||
Lang.string_t | ||
(fun p -> | ||
let m = Utils.list_of_metadata (Lang.to_metadata (List.assoc "" p)) in | ||
let version = Lang.to_int (List.assoc "version" p) in | ||
Lang.string (Utils.id3v2_of_metadata ~version m)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.