more video improvements

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti 2012-08-13 22:24:35 -04:00
parent caffc4c3ec
commit cbfc2ac368

View File

@ -18,7 +18,10 @@ namespace MediaBrowser.Api.HttpHandlers
{ {
get get
{ {
return new string[] { "mp4", "wmv", "3gp", "avi", "ogv", "mov", "m4v", "mkv" }; // mp4, 3gp, mov - muxer does not support non-seekable output
// avi, mov, mkv, m4v - can't stream these when encoding. the player will try to download them completely before starting playback.
// wmv - can't seem to figure out the output format name
return new string[] { "mp4", "3gp", "m4v", "mkv", "avi", "mov", "wmv" };
} }
} }
@ -145,6 +148,14 @@ namespace MediaBrowser.Api.HttpHandlers
{ {
return "wmv2"; return "wmv2";
} }
else if (outputFormat.Equals("wmv"))
{
return "wmv2";
}
else if (outputFormat.Equals("ogv"))
{
return "libtheora";
}
return "libx264"; return "libx264";
} }
@ -156,6 +167,18 @@ namespace MediaBrowser.Api.HttpHandlers
// Per webm specification, it must be vorbis // Per webm specification, it must be vorbis
return "libvorbis"; return "libvorbis";
} }
else if (outputFormat.Equals("asf"))
{
return "wmav2";
}
else if (outputFormat.Equals("wmv"))
{
return "wmav2";
}
else if (outputFormat.Equals("ogv"))
{
return "libvorbis";
}
// See if we can just copy the stream // See if we can just copy the stream
if (HasBasicAudio(audioStream)) if (HasBasicAudio(audioStream))
@ -168,10 +191,18 @@ namespace MediaBrowser.Api.HttpHandlers
private int? GetNumAudioChannelsParam(string audioCodec, int libraryItemChannels) private int? GetNumAudioChannelsParam(string audioCodec, int libraryItemChannels)
{ {
if (libraryItemChannels > 2 && audioCodec.Equals("libvo_aacenc")) if (libraryItemChannels > 2)
{ {
// libvo_aacenc currently only supports two channel output if (audioCodec.Equals("libvo_aacenc"))
return 2; {
// libvo_aacenc currently only supports two channel output
return 2;
}
else if (audioCodec.Equals("wmav2"))
{
// wmav2 currently only supports two channel output
return 2;
}
} }
return GetNumAudioChannelsParam(libraryItemChannels); return GetNumAudioChannelsParam(libraryItemChannels);
@ -179,11 +210,12 @@ namespace MediaBrowser.Api.HttpHandlers
private bool HasBasicAudio(AudioStream audio) private bool HasBasicAudio(AudioStream audio)
{ {
int maxChannels = AudioChannels ?? 2; if (AudioChannels.HasValue)
if (audio.Channels > maxChannels)
{ {
return false; if (audio.Channels > AudioChannels.Value)
{
return false;
}
} }
if (audio.AudioFormat.IndexOf("aac", StringComparison.OrdinalIgnoreCase) != -1) if (audio.AudioFormat.IndexOf("aac", StringComparison.OrdinalIgnoreCase) != -1)