preserve image with audio sync encoding
This commit is contained in:
parent
6375920933
commit
c37652058c
|
@ -41,19 +41,36 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
}
|
||||
}
|
||||
|
||||
const string vn = " -vn";
|
||||
|
||||
var threads = GetNumberOfThreads(state, false);
|
||||
|
||||
var inputModifier = GetInputModifier(state);
|
||||
|
||||
return string.Format("{0} {1} -threads {2}{3} {4} -id3v2_version 3 -write_id3v1 1 -y \"{5}\"",
|
||||
var albumCoverInput = string.Empty;
|
||||
var mapArgs = string.Empty;
|
||||
var metadata = string.Empty;
|
||||
var vn = string.Empty;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(state.AlbumCoverPath))
|
||||
{
|
||||
albumCoverInput = " -i \"" + state.AlbumCoverPath + "\"";
|
||||
mapArgs = " -map 0:a -map 1:v -c:v copy";
|
||||
metadata = " -metadata:s:v title=\"Album cover\" -metadata:s:v comment=\"Cover(Front)\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
vn = " -vn";
|
||||
}
|
||||
|
||||
return string.Format("{0} {1}{6}{7} -threads {2}{3} {4} -id3v2_version 3 -write_id3v1 1{8} -y \"{5}\"",
|
||||
inputModifier,
|
||||
GetInputArgument(state),
|
||||
threads,
|
||||
vn,
|
||||
string.Join(" ", audioTranscodeParams.ToArray()),
|
||||
state.OutputFilePath).Trim();
|
||||
state.OutputFilePath,
|
||||
albumCoverInput,
|
||||
mapArgs,
|
||||
metadata).Trim();
|
||||
}
|
||||
|
||||
protected override string GetOutputFileExtension(EncodingJob state)
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
public long? InputFileSize { get; set; }
|
||||
public string OutputAudioSync = "1";
|
||||
public string OutputVideoSync = "vfr";
|
||||
public string AlbumCoverPath { get; set; }
|
||||
|
||||
public string GetMimeType(string outputPath)
|
||||
{
|
||||
|
|
|
@ -60,6 +60,14 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
|
||||
state.IsInputVideo = string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
var primaryImage = item.GetImageInfo(ImageType.Primary, 0) ??
|
||||
item.Parents.Select(i => i.GetImageInfo(ImageType.Primary, 0)).FirstOrDefault(i => i != null);
|
||||
|
||||
if (primaryImage != null)
|
||||
{
|
||||
state.AlbumCoverPath = primaryImage.Path;
|
||||
}
|
||||
|
||||
var mediaSources = await _mediaSourceManager.GetPlayackMediaSources(request.ItemId, null, false, new[] { MediaType.Audio, MediaType.Video }, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var mediaSource = string.IsNullOrEmpty(request.MediaSourceId)
|
||||
|
|
Loading…
Reference in New Issue
Block a user