Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
better fix for unexpected concat audio codec
Browse files Browse the repository at this point in the history
- minor tweaks to RenderMngr
  • Loading branch information
red-rj committed Apr 14, 2018
1 parent 6bd0349 commit 0930bfa
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
19 changes: 14 additions & 5 deletions Src/BRClib/Commands/Concat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,23 @@ public ConcatCmd(string program) : base(program) { }
public string MixdownFile { get; set; }
public TimeSpan? Duration { get; set; }

// ref: https://ffmpeg.org/ffmpeg-all.html#concat-1
// 0=ChunkTxtPath, 1=Optional mixdown input, 2=Optional duration, 3=Final file path + .EXT
const string CONCAT_FMT = "-f concat -safe 0 -i \"{0}\" {1} {2} \"{3}\" -y";

protected override string GetArgs()
{
var codecText = !string.IsNullOrWhiteSpace(MixdownFile)
? "-i \"" + MixdownFile + "\" -c:v copy -map 0:v:0 -map 1:a:0" : "-c copy";
// ref: https://ffmpeg.org/ffmpeg-all.html#concat-1
// 0=ChunkTxtPath, 1=codec specs, 2=Optional duration, 3=Final file path + .EXT
const string CONCAT_FMT = "-f concat -safe 0 -i \"{0}\" {1} {2} \"{3}\" -y";

string codecText;

if (string.IsNullOrWhiteSpace(MixdownFile))
{
codecText = "-c copy";
}
else
{
codecText = string.Format("-i \"{0}\" -c copy -map 0:v:0 -map 1:a:0", MixdownFile);
}

var durText = Duration.HasValue
? "-t " + Duration.Value.ToString(@"hh\:mm\:ss") : string.Empty;
Expand Down
4 changes: 2 additions & 2 deletions Src/BlenderRenderController/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.0.1")]
[assembly: AssemblyFileVersion("1.2.0.1")]
13 changes: 7 additions & 6 deletions Src/BlenderRenderController/RenderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class RenderManager : IBrcRenderManager
BrcSettings _setts = Services.Settings.Current;

// after render
List<Process> _arProcesses;
//List<Process> _arProcesses;
const string MIX_KEY = "mixdown";
const string CONCAT_KEY = "concat";
CancellationTokenSource _arCts;
Expand Down Expand Up @@ -140,7 +140,7 @@ public RenderManager()
{
_timer = new Timer
{
Interval = 100,
Interval = 250,
};

_timer.Tick += delegate
Expand Down Expand Up @@ -308,7 +308,7 @@ void ResetFields()
{
_chunkList = _proj.ChunkList.ToList();
_processes = _chunkList.Select(CreateRenderProcess).ToList();
_arProcesses = new List<Process>();
//_arProcesses = new List<Process>();

_framesRendered = new ConcurrentHashSet<int>();
_currentIndex = 0;
Expand Down Expand Up @@ -425,6 +425,7 @@ private void TryQueueRenderProcess()
private void OnChunksFinished()
{
bool renderOk = _processes.TrueForAll(p => p.ExitCode == 0);
_processes.Clear();

if (!renderOk)
{
Expand Down Expand Up @@ -474,7 +475,7 @@ void ReportProgress(int framesRendered, int chunksCompleted)
private void DisposeProcesses()
{
var procList = _processes.ToList();
procList.AddRange(_arProcesses);
//procList.AddRange(_arProcesses);

foreach (var p in procList)
{
Expand Down Expand Up @@ -598,7 +599,7 @@ bool AfterRenderProc(object state)
if (_arCts.IsCancellationRequested) return false;

// check for bad exit codes
var badProcResults = _arProcesses.Where(p => p != null && p.ExitCode != 0).ToArray();
var badProcResults = _processes.Where(p => p != null && p.ExitCode != 0).ToArray();

if (badProcResults.Length > 0)
{
Expand Down Expand Up @@ -661,7 +662,7 @@ void RunProc(ref Process proc, string key)
proc.BeginOutputReadLine();
proc.BeginErrorReadLine();

_arProcesses.Add(proc);
_processes.Add(proc);

proc.WaitForExit();

Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/TestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static BlendData GetBlendData(string blendPath)
proc.Start();
var output = proc.StandardOutput.ReadToEnd();

return Utilities.ParsePyOutput(output);
return BlendData.FromPyOutput(output);
}

public static Process GetBlendDataProc(string path)
Expand Down

0 comments on commit 0930bfa

Please sign in to comment.