add aac_adtstoasc bitstream filter for mpegts to mp4 conversion

This commit is contained in:
nyanmisaka
2020-11-14 14:22:15 +08:00
parent 536b054873
commit 32bb73acbb
3 changed files with 66 additions and 7 deletions

View File

@@ -596,10 +596,17 @@ namespace MediaBrowser.Controller.MediaEncoding
|| codec.IndexOf("hevc", StringComparison.OrdinalIgnoreCase) != -1;
}
// TODO This is auto inserted into the mpegts mux so it might not be needed
// https://www.ffmpeg.org/ffmpeg-bitstream-filters.html#h264_005fmp4toannexb
public bool IsAAC(MediaStream stream)
{
var codec = stream.Codec ?? string.Empty;
return codec.IndexOf("aac", StringComparison.OrdinalIgnoreCase) != -1;
}
public string GetBitStreamArgs(MediaStream stream)
{
// TODO This is auto inserted into the mpegts mux so it might not be needed
// https://www.ffmpeg.org/ffmpeg-bitstream-filters.html#h264_005fmp4toannexb
if (IsH264(stream))
{
return "-bsf:v h264_mp4toannexb";
@@ -608,6 +615,11 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return "-bsf:v hevc_mp4toannexb";
}
else if (IsAAC(stream))
{
// convert adts header(mpegts) to asc header(mp4)
return "-bsf:a aac_adtstoasc";
}
else
{
return null;