Skip to content

Commit 4bc94d2

Browse files
Preserve input metadata
Preserve input metadata
2 parents 877eb13 + b9ff0d0 commit 4bc94d2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/src/main/java/com/nasahacker/convertit/data/repository/AudioConverterRepositoryImpl.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ class AudioConverterRepositoryImpl
231231
"-i", inputPath,
232232
"-map", "0:a", // Only map audio streams
233233
"-vn", // Disable video streams
234+
"-map_metadata", "0", // Preserve input metadata
234235
"-ar", "16000",
235236
"-ac", "1",
236237
"-c:a", AudioCodec.fromFormat(outputFormat).codec,
@@ -247,6 +248,7 @@ class AudioConverterRepositoryImpl
247248
"-i", inputPath,
248249
"-map", "0:a",
249250
"-vn",
251+
"-map_metadata", "0", // Preserve input metadata
250252
"-c:a", AudioCodec.fromFormat(outputFormat).codec,
251253
"-b:a", bitrate.bitrate,
252254
"-application", "voip",
@@ -260,6 +262,7 @@ class AudioConverterRepositoryImpl
260262
"-i", inputPath,
261263
"-map", "0:a",
262264
"-vn",
265+
"-map_metadata", "0", // Preserve input metadata
263266
"-c:a", AudioCodec.fromFormat(outputFormat).codec,
264267
"-b:a", bitrate.bitrate,
265268
"-filter:a", "atempo=$playbackSpeed",
@@ -273,6 +276,7 @@ class AudioConverterRepositoryImpl
273276
"-i", inputPath,
274277
"-map", "0:a",
275278
"-vn",
279+
"-map_metadata", "0", // Preserve input metadata
276280
"-c:a", AudioCodec.fromFormat(outputFormat).codec,
277281
"-b:a", bitrate.bitrate,
278282
"-filter:a", "atempo=$playbackSpeed",
@@ -467,6 +471,9 @@ class AudioConverterRepositoryImpl
467471

468472
args.addAll(arrayOf("-map", "0:a", "-vn"))
469473

474+
// Preserve input metadata on the output
475+
args.addAll(arrayOf("-map_metadata", "0"))
476+
470477
args.addAll(arrayOf("-ss", CueParser.formatSecondsForFFmpeg(track.startTimeSeconds)))
471478

472479

0 commit comments

Comments
 (0)