2
0

EncodingOptions.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. #pragma warning disable CA1819 // XML serialization handles collections improperly, so we need to use arrays
  2. #nullable disable
  3. using MediaBrowser.Model.Entities;
  4. namespace MediaBrowser.Model.Configuration;
  5. /// <summary>
  6. /// Class EncodingOptions.
  7. /// </summary>
  8. public class EncodingOptions
  9. {
  10. /// <summary>
  11. /// Initializes a new instance of the <see cref="EncodingOptions" /> class.
  12. /// </summary>
  13. public EncodingOptions()
  14. {
  15. EnableFallbackFont = false;
  16. EnableAudioVbr = false;
  17. DownMixAudioBoost = 2;
  18. DownMixStereoAlgorithm = DownMixStereoAlgorithms.None;
  19. MaxMuxingQueueSize = 2048;
  20. EnableThrottling = false;
  21. ThrottleDelaySeconds = 180;
  22. EnableSegmentDeletion = false;
  23. SegmentKeepSeconds = 720;
  24. EncodingThreadCount = -1;
  25. // This is a DRM device that is almost guaranteed to be there on every intel platform,
  26. // plus it's the default one in ffmpeg if you don't specify anything
  27. VaapiDevice = "/dev/dri/renderD128";
  28. QsvDevice = string.Empty;
  29. EnableTonemapping = false;
  30. EnableVppTonemapping = false;
  31. EnableVideoToolboxTonemapping = false;
  32. TonemappingAlgorithm = TonemappingAlgorithm.bt2390;
  33. TonemappingMode = TonemappingMode.auto;
  34. TonemappingRange = TonemappingRange.auto;
  35. TonemappingDesat = 0;
  36. TonemappingPeak = 100;
  37. TonemappingParam = 0;
  38. VppTonemappingBrightness = 16;
  39. VppTonemappingContrast = 1;
  40. H264Crf = 23;
  41. H265Crf = 28;
  42. DeinterlaceDoubleRate = false;
  43. DeinterlaceMethod = DeinterlaceMethod.yadif;
  44. EnableDecodingColorDepth10Hevc = true;
  45. EnableDecodingColorDepth10Vp9 = true;
  46. EnableDecodingColorDepth10HevcRext = false;
  47. EnableDecodingColorDepth12HevcRext = false;
  48. // Enhanced Nvdec or system native decoder is required for DoVi to SDR tone-mapping.
  49. EnableEnhancedNvdecDecoder = true;
  50. PreferSystemNativeHwDecoder = true;
  51. EnableIntelLowPowerH264HwEncoder = false;
  52. EnableIntelLowPowerHevcHwEncoder = false;
  53. EnableHardwareEncoding = true;
  54. AllowHevcEncoding = false;
  55. AllowAv1Encoding = false;
  56. EnableSubtitleExtraction = true;
  57. AllowOnDemandMetadataBasedKeyframeExtractionForExtensions = ["mkv"];
  58. HardwareDecodingCodecs = ["h264", "vc1"];
  59. }
  60. /// <summary>
  61. /// Gets or sets the thread count used for encoding.
  62. /// </summary>
  63. public int EncodingThreadCount { get; set; }
  64. /// <summary>
  65. /// Gets or sets the temporary transcoding path.
  66. /// </summary>
  67. public string TranscodingTempPath { get; set; }
  68. /// <summary>
  69. /// Gets or sets the path to the fallback font.
  70. /// </summary>
  71. public string FallbackFontPath { get; set; }
  72. /// <summary>
  73. /// Gets or sets a value indicating whether to use the fallback font.
  74. /// </summary>
  75. public bool EnableFallbackFont { get; set; }
  76. /// <summary>
  77. /// Gets or sets a value indicating whether audio VBR is enabled.
  78. /// </summary>
  79. public bool EnableAudioVbr { get; set; }
  80. /// <summary>
  81. /// Gets or sets the audio boost applied when downmixing audio.
  82. /// </summary>
  83. public double DownMixAudioBoost { get; set; }
  84. /// <summary>
  85. /// Gets or sets the algorithm used for downmixing audio to stereo.
  86. /// </summary>
  87. public DownMixStereoAlgorithms DownMixStereoAlgorithm { get; set; }
  88. /// <summary>
  89. /// Gets or sets the maximum size of the muxing queue.
  90. /// </summary>
  91. public int MaxMuxingQueueSize { get; set; }
  92. /// <summary>
  93. /// Gets or sets a value indicating whether throttling is enabled.
  94. /// </summary>
  95. public bool EnableThrottling { get; set; }
  96. /// <summary>
  97. /// Gets or sets the delay after which throttling happens.
  98. /// </summary>
  99. public int ThrottleDelaySeconds { get; set; }
  100. /// <summary>
  101. /// Gets or sets a value indicating whether segment deletion is enabled.
  102. /// </summary>
  103. public bool EnableSegmentDeletion { get; set; }
  104. /// <summary>
  105. /// Gets or sets seconds for which segments should be kept before being deleted.
  106. /// </summary>
  107. public int SegmentKeepSeconds { get; set; }
  108. /// <summary>
  109. /// Gets or sets the hardware acceleration type.
  110. /// </summary>
  111. public HardwareAccelerationType HardwareAccelerationType { get; set; }
  112. /// <summary>
  113. /// Gets or sets the FFmpeg path as set by the user via the UI.
  114. /// </summary>
  115. public string EncoderAppPath { get; set; }
  116. /// <summary>
  117. /// Gets or sets the current FFmpeg path being used by the system and displayed on the transcode page.
  118. /// </summary>
  119. public string EncoderAppPathDisplay { get; set; }
  120. /// <summary>
  121. /// Gets or sets the VA-API device.
  122. /// </summary>
  123. public string VaapiDevice { get; set; }
  124. /// <summary>
  125. /// Gets or sets the QSV device.
  126. /// </summary>
  127. public string QsvDevice { get; set; }
  128. /// <summary>
  129. /// Gets or sets a value indicating whether tonemapping is enabled.
  130. /// </summary>
  131. public bool EnableTonemapping { get; set; }
  132. /// <summary>
  133. /// Gets or sets a value indicating whether VPP tonemapping is enabled.
  134. /// </summary>
  135. public bool EnableVppTonemapping { get; set; }
  136. /// <summary>
  137. /// Gets or sets a value indicating whether videotoolbox tonemapping is enabled.
  138. /// </summary>
  139. public bool EnableVideoToolboxTonemapping { get; set; }
  140. /// <summary>
  141. /// Gets or sets the tone-mapping algorithm.
  142. /// </summary>
  143. public TonemappingAlgorithm TonemappingAlgorithm { get; set; }
  144. /// <summary>
  145. /// Gets or sets the tone-mapping mode.
  146. /// </summary>
  147. public TonemappingMode TonemappingMode { get; set; }
  148. /// <summary>
  149. /// Gets or sets the tone-mapping range.
  150. /// </summary>
  151. public TonemappingRange TonemappingRange { get; set; }
  152. /// <summary>
  153. /// Gets or sets the tone-mapping desaturation.
  154. /// </summary>
  155. public double TonemappingDesat { get; set; }
  156. /// <summary>
  157. /// Gets or sets the tone-mapping peak.
  158. /// </summary>
  159. public double TonemappingPeak { get; set; }
  160. /// <summary>
  161. /// Gets or sets the tone-mapping parameters.
  162. /// </summary>
  163. public double TonemappingParam { get; set; }
  164. /// <summary>
  165. /// Gets or sets the VPP tone-mapping brightness.
  166. /// </summary>
  167. public double VppTonemappingBrightness { get; set; }
  168. /// <summary>
  169. /// Gets or sets the VPP tone-mapping contrast.
  170. /// </summary>
  171. public double VppTonemappingContrast { get; set; }
  172. /// <summary>
  173. /// Gets or sets the H264 CRF.
  174. /// </summary>
  175. public int H264Crf { get; set; }
  176. /// <summary>
  177. /// Gets or sets the H265 CRF.
  178. /// </summary>
  179. public int H265Crf { get; set; }
  180. /// <summary>
  181. /// Gets or sets the encoder preset.
  182. /// </summary>
  183. public EncoderPreset? EncoderPreset { get; set; }
  184. /// <summary>
  185. /// Gets or sets a value indicating whether the framerate is doubled when deinterlacing.
  186. /// </summary>
  187. public bool DeinterlaceDoubleRate { get; set; }
  188. /// <summary>
  189. /// Gets or sets the deinterlace method.
  190. /// </summary>
  191. public DeinterlaceMethod DeinterlaceMethod { get; set; }
  192. /// <summary>
  193. /// Gets or sets a value indicating whether 10bit HEVC decoding is enabled.
  194. /// </summary>
  195. public bool EnableDecodingColorDepth10Hevc { get; set; }
  196. /// <summary>
  197. /// Gets or sets a value indicating whether 10bit VP9 decoding is enabled.
  198. /// </summary>
  199. public bool EnableDecodingColorDepth10Vp9 { get; set; }
  200. /// <summary>
  201. /// Gets or sets a value indicating whether 8/10bit HEVC RExt decoding is enabled.
  202. /// </summary>
  203. public bool EnableDecodingColorDepth10HevcRext { get; set; }
  204. /// <summary>
  205. /// Gets or sets a value indicating whether 12bit HEVC RExt decoding is enabled.
  206. /// </summary>
  207. public bool EnableDecodingColorDepth12HevcRext { get; set; }
  208. /// <summary>
  209. /// Gets or sets a value indicating whether the enhanced NVDEC is enabled.
  210. /// </summary>
  211. public bool EnableEnhancedNvdecDecoder { get; set; }
  212. /// <summary>
  213. /// Gets or sets a value indicating whether the system native hardware decoder should be used.
  214. /// </summary>
  215. public bool PreferSystemNativeHwDecoder { get; set; }
  216. /// <summary>
  217. /// Gets or sets a value indicating whether the Intel H264 low-power hardware encoder should be used.
  218. /// </summary>
  219. public bool EnableIntelLowPowerH264HwEncoder { get; set; }
  220. /// <summary>
  221. /// Gets or sets a value indicating whether the Intel HEVC low-power hardware encoder should be used.
  222. /// </summary>
  223. public bool EnableIntelLowPowerHevcHwEncoder { get; set; }
  224. /// <summary>
  225. /// Gets or sets a value indicating whether hardware encoding is enabled.
  226. /// </summary>
  227. public bool EnableHardwareEncoding { get; set; }
  228. /// <summary>
  229. /// Gets or sets a value indicating whether HEVC encoding is enabled.
  230. /// </summary>
  231. public bool AllowHevcEncoding { get; set; }
  232. /// <summary>
  233. /// Gets or sets a value indicating whether AV1 encoding is enabled.
  234. /// </summary>
  235. public bool AllowAv1Encoding { get; set; }
  236. /// <summary>
  237. /// Gets or sets a value indicating whether subtitle extraction is enabled.
  238. /// </summary>
  239. public bool EnableSubtitleExtraction { get; set; }
  240. /// <summary>
  241. /// Gets or sets the codecs hardware encoding is used for.
  242. /// </summary>
  243. public string[] HardwareDecodingCodecs { get; set; }
  244. /// <summary>
  245. /// Gets or sets the file extensions on-demand metadata based keyframe extraction is enabled for.
  246. /// </summary>
  247. public string[] AllowOnDemandMetadataBasedKeyframeExtractionForExtensions { get; set; }
  248. }