mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 09:28:29 +00:00
web/util: add support for subtitle track language metadata
This commit is contained in:
parent
9f7f63783d
commit
993a885a3e
@ -52,7 +52,8 @@ export const CobaltFileMetadataKeys = [
|
|||||||
'artist',
|
'artist',
|
||||||
'album_artist',
|
'album_artist',
|
||||||
'track',
|
'track',
|
||||||
'date'
|
'date',
|
||||||
|
'sublanguage',
|
||||||
];
|
];
|
||||||
|
|
||||||
export type CobaltFileMetadata = Record<
|
export type CobaltFileMetadata = Record<
|
||||||
|
@ -18,6 +18,13 @@ export const formatFileSize = (size: number | undefined) => {
|
|||||||
export const ffmpegMetadataArgs = (metadata: CobaltFileMetadata) =>
|
export const ffmpegMetadataArgs = (metadata: CobaltFileMetadata) =>
|
||||||
Object.entries(metadata).flatMap(([name, value]) => {
|
Object.entries(metadata).flatMap(([name, value]) => {
|
||||||
if (CobaltFileMetadataKeys.includes(name) && typeof value === "string") {
|
if (CobaltFileMetadataKeys.includes(name) && typeof value === "string") {
|
||||||
|
if (name === "sublanguage") {
|
||||||
|
return [
|
||||||
|
'-metadata:s:s:0',
|
||||||
|
// eslint-disable-next-line no-control-regex
|
||||||
|
`language=${value.replace(/[\u0000-\u0009]/g, "")}`
|
||||||
|
]
|
||||||
|
}
|
||||||
return [
|
return [
|
||||||
'-metadata',
|
'-metadata',
|
||||||
// eslint-disable-next-line no-control-regex
|
// eslint-disable-next-line no-control-regex
|
||||||
|
Loading…
Reference in New Issue
Block a user