[Bugfix] Provile bitStreamArgs for HLS fMP4

Enable the audio bitstream arguments to ffmpeg for both ts and fMP4 HLS streaming
pull/7333/head
Isaac Gordezky 3 years ago
parent b92e1baa3c
commit 151ddd400d

@ -1680,7 +1680,7 @@ namespace Jellyfin.Api.Controllers
{ {
if (EncodingHelper.IsCopyCodec(audioCodec)) if (EncodingHelper.IsCopyCodec(audioCodec))
{ {
var bitStreamArgs = EncodingHelper.GetAudioBitStreamArguments(state, state.Request.SegmentContainer, state.MediaSource.Container); var bitStreamArgs = EncodingHelper.GetAudioBitStreamArguments(state, state.Request.SegmentContainer, state.MediaSource.Container, state.TranscodingType);
return "-acodec copy -strict -2" + bitStreamArgs; return "-acodec copy -strict -2" + bitStreamArgs;
} }
@ -1711,7 +1711,7 @@ namespace Jellyfin.Api.Controllers
if (EncodingHelper.IsCopyCodec(audioCodec)) if (EncodingHelper.IsCopyCodec(audioCodec))
{ {
var videoCodec = _encodingHelper.GetVideoEncoder(state, _encodingOptions); var videoCodec = _encodingHelper.GetVideoEncoder(state, _encodingOptions);
var bitStreamArgs = EncodingHelper.GetAudioBitStreamArguments(state, state.Request.SegmentContainer, state.MediaSource.Container); var bitStreamArgs = EncodingHelper.GetAudioBitStreamArguments(state, state.Request.SegmentContainer, state.MediaSource.Container, state.TranscodingType);
if (EncodingHelper.IsCopyCodec(videoCodec) && state.EnableBreakOnNonKeyFrames(videoCodec)) if (EncodingHelper.IsCopyCodec(videoCodec) && state.EnableBreakOnNonKeyFrames(videoCodec))
{ {

@ -950,7 +950,7 @@ namespace MediaBrowser.Controller.MediaEncoding
} }
} }
public static string GetAudioBitStreamArguments(EncodingJobInfo state, string segmentContainer, string mediaSourceContainer) public static string GetAudioBitStreamArguments(EncodingJobInfo state, string segmentContainer, string mediaSourceContainer, TranscodingJobType transcodingType)
{ {
var bitStreamArgs = string.Empty; var bitStreamArgs = string.Empty;
var segmentFormat = GetSegmentFileExtension(segmentContainer).TrimStart('.'); var segmentFormat = GetSegmentFileExtension(segmentContainer).TrimStart('.');
@ -958,6 +958,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// Apply aac_adtstoasc bitstream filter when media source is in mpegts. // Apply aac_adtstoasc bitstream filter when media source is in mpegts.
if (string.Equals(segmentFormat, "mp4", StringComparison.OrdinalIgnoreCase) if (string.Equals(segmentFormat, "mp4", StringComparison.OrdinalIgnoreCase)
&& (string.Equals(mediaSourceContainer, "mpegts", StringComparison.OrdinalIgnoreCase) && (string.Equals(mediaSourceContainer, "mpegts", StringComparison.OrdinalIgnoreCase)
|| transcodingType == TranscodingJobType.Hls
|| string.Equals(mediaSourceContainer, "hls", StringComparison.OrdinalIgnoreCase))) || string.Equals(mediaSourceContainer, "hls", StringComparison.OrdinalIgnoreCase)))
{ {
bitStreamArgs = GetBitStreamArgs(state.AudioStream); bitStreamArgs = GetBitStreamArgs(state.AudioStream);
@ -1676,8 +1677,8 @@ namespace MediaBrowser.Controller.MediaEncoding
} }
// Source and target codecs must match // Source and target codecs must match
if (string.IsNullOrEmpty(videoStream.Codec) if (string.IsNullOrEmpty(videoStream.Codec) || (state.SupportedVideoCodecs.Any()
|| !state.SupportedVideoCodecs.Contains(videoStream.Codec, StringComparison.OrdinalIgnoreCase)) && !state.SupportedVideoCodecs.Contains(videoStream.Codec, StringComparison.OrdinalIgnoreCase)))
{ {
return false; return false;
} }

Loading…
Cancel
Save