@@ -151,19 +151,38 @@ public static async Task SetColorData(string path, VideoColorData d)
151151 try
152152 {
153153 string tmpPath = IoUtils . FilenameSuffix ( path , ".tmp" ) ;
154- string args = $ "-o { tmpPath . Wrap ( ) } " +
155- $ "--colour-matrix 0:{ d . ColorMatrixCoeffs } " +
156- $ "--colour-range 0:{ d . ColorRange } " +
157- $ "--colour-transfer-characteristics 0:{ d . ColorTransfer } " +
158- $ "--colour-primaries 0:{ d . ColorPrimaries } " +
159- $ "--max-luminance 0:{ d . LumaMax } " +
160- $ "--min-luminance 0:{ d . LumaMin } " +
161- $ "--chromaticity-coordinates 0:{ d . RedX } ,{ d . RedY } ,{ d . GreenX } ,{ d . GreenY } ,{ d . BlueX } ,{ d . BlueY } " +
162- $ "--max-content-light 0:{ d . MaxCll } " +
163- $ "--max-frame-light 0:{ d . MaxFall } " +
164- $ "{ path . Wrap ( ) } ";
165-
166- await AvProcess . RunMkvMerge ( args , true ) ;
154+ //string args = $"-o {tmpPath.Wrap()} " +
155+ // $"--colour-matrix 0:{d.ColorMatrixCoeffs} " +
156+ // $"--colour-range 0:{d.ColorRange} " +
157+ // $"--colour-transfer-characteristics 0:{d.ColorTransfer} " +
158+ // $"--colour-primaries 0:{d.ColorPrimaries} " +
159+ // $"--max-luminance 0:{d.LumaMax} " +
160+ // $"--min-luminance 0:{d.LumaMin} " +
161+ // $"--chromaticity-coordinates 0:{d.RedX},{d.RedY},{d.GreenX},{d.GreenY},{d.BlueX},{d.BlueY} " +
162+ // $"--max-content-light 0:{d.MaxCll} " +
163+ // $"--max-frame-light 0:{d.MaxFall} " +
164+ // $"{path.Wrap()}";
165+
166+ List < string > args = new List < string > ( ) ;
167+
168+ args . Add ( $ "-o { tmpPath . Wrap ( ) } ") ;
169+ args . Add ( $ "--colour-matrix 0:{ d . ColorMatrixCoeffs } ") ;
170+ args . Add ( $ "--colour-transfer-characteristics 0:{ d . ColorTransfer } ") ;
171+ args . Add ( $ "--colour-primaries 0:{ d . ColorPrimaries } ") ;
172+ if ( ! string . IsNullOrWhiteSpace ( d . LumaMax ) ) args . Add ( $ "--max-luminance 0:{ d . LumaMax } ") ;
173+ if ( ! string . IsNullOrWhiteSpace ( d . LumaMin ) ) args . Add ( $ "--min-luminance 0:{ d . LumaMin } ") ;
174+ if ( ! string . IsNullOrWhiteSpace ( d . RedX ) ) args . Add ( $ "--chromaticity-coordinates 0:{ d . RedX } ,{ d . RedY } ,{ d . GreenX } ,{ d . GreenY } ,{ d . BlueX } ,{ d . BlueY } ") ;
175+ if ( ! string . IsNullOrWhiteSpace ( d . MaxCll ) ) args . Add ( $ "--max-content-light 0:{ d . MaxCll } ") ;
176+ if ( ! string . IsNullOrWhiteSpace ( d . MaxFall ) ) args . Add ( $ "--max-frame-light 0:{ d . MaxFall } ") ;
177+ args . Add ( $ "{ path . Wrap ( ) } ") ;
178+
179+ await AvProcess . RunMkvMerge ( string . Join ( " " , args ) , true ) ;
180+
181+ if ( ! File . Exists ( tmpPath ) )
182+ {
183+ Logger . Log ( $ "Error: Muxing failed.") ;
184+ return ;
185+ }
167186
168187 int filesizeDiffKb = ( int ) ( ( Math . Abs ( new FileInfo ( path ) . Length - new FileInfo ( tmpPath ) . Length ) ) / 1024 ) ;
169188 double filesizeFactor = ( double ) ( new FileInfo ( tmpPath ) . Length ) / ( double ) ( new FileInfo ( path ) . Length ) ;
0 commit comments