Browse Source

include audio language metadata in all streaming modes (#295)

* include audio language metadata in all streaming modes

* cleanup
pull/296/head
Jason Dove 4 years ago committed by GitHub
parent
commit
5f28707cce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CHANGELOG.md
  2. 18
      ErsatzTV.Core/FFmpeg/FFmpegProcessBuilder.cs
  3. 6
      ErsatzTV.Core/FFmpeg/FFmpegProcessService.cs

5
CHANGELOG.md

@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] ## [Unreleased]
### Added
- Include audio language metadata in all streaming modes
### Fixed
- Fix flooding schedule items that have a fixed start time
## [0.0.48-prealpha] - 2021-06-22 ## [0.0.48-prealpha] - 2021-06-22
### Added ### Added

18
ErsatzTV.Core/FFmpeg/FFmpegProcessBuilder.cs

@ -230,14 +230,29 @@ namespace ErsatzTV.Core.FFmpeg
return this; return this;
} }
public FFmpegProcessBuilder WithMetadata(Channel channel) public FFmpegProcessBuilder WithMetadata(Channel channel, Option<MediaStream> maybeAudioStream)
{ {
if (channel.StreamingMode == StreamingMode.TransportStream)
{
_arguments.AddRange(new[] { "-map_metadata", "-1" });
}
foreach (MediaStream audioStream in maybeAudioStream)
{
if (!string.IsNullOrWhiteSpace(audioStream.Language))
{
_arguments.AddRange(new[] { "-metadata:s:a:0", $"language={audioStream.Language}" });
}
}
var arguments = new List<string> var arguments = new List<string>
{ {
"-metadata", "service_provider=\"ErsatzTV\"", "-metadata", "service_provider=\"ErsatzTV\"",
"-metadata", $"service_name=\"{channel.Name}\"" "-metadata", $"service_name=\"{channel.Name}\""
}; };
_arguments.AddRange(arguments); _arguments.AddRange(arguments);
return this; return this;
} }
@ -323,7 +338,6 @@ namespace ErsatzTV.Core.FFmpeg
new[] new[]
{ {
"-c:a", playbackSettings.AudioCodec, "-c:a", playbackSettings.AudioCodec,
"-map_metadata", "-1",
"-movflags", "+faststart", "-movflags", "+faststart",
"-muxdelay", "0", "-muxdelay", "0",
"-muxpreload", "0" "-muxpreload", "0"

6
ErsatzTV.Core/FFmpeg/FFmpegProcessService.cs

@ -105,7 +105,7 @@ namespace ErsatzTV.Core.FFmpeg
}); });
return builder.WithPlaybackArgs(playbackSettings) return builder.WithPlaybackArgs(playbackSettings)
.WithMetadata(channel) .WithMetadata(channel, maybeAudioStream)
.WithFormat("mpegts") .WithFormat("mpegts")
.WithDuration(start + version.Duration - now) .WithDuration(start + version.Duration - now)
.WithPipe() .WithPipe()
@ -130,7 +130,7 @@ namespace ErsatzTV.Core.FFmpeg
.WithErrorText(desiredResolution, errorMessage) .WithErrorText(desiredResolution, errorMessage)
.WithPixfmt("yuv420p") .WithPixfmt("yuv420p")
.WithPlaybackArgs(playbackSettings) .WithPlaybackArgs(playbackSettings)
.WithMetadata(channel) .WithMetadata(channel, None)
.WithFormat("mpegts"); .WithFormat("mpegts");
duration.IfSome(d => builder = builder.WithDuration(d)); duration.IfSome(d => builder = builder.WithDuration(d));
@ -149,7 +149,7 @@ namespace ErsatzTV.Core.FFmpeg
.WithRealtimeOutput(playbackSettings.RealtimeOutput) .WithRealtimeOutput(playbackSettings.RealtimeOutput)
.WithInfiniteLoop() .WithInfiniteLoop()
.WithConcat($"http://localhost:{Settings.ListenPort}/ffmpeg/concat/{channel.Number}") .WithConcat($"http://localhost:{Settings.ListenPort}/ffmpeg/concat/{channel.Number}")
.WithMetadata(channel) .WithMetadata(channel, None)
.WithFormat("mpegts") .WithFormat("mpegts")
.WithPipe() .WithPipe()
.Build(); .Build();

Loading…
Cancel
Save