wsegatto

Tdarr Closed Captions Will v2

Nov 13th, 2021 (edited)
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. function details() {
  2. return {
  3. id: "Tdarr_Plugin_WS_Remove_Closed_Captions",
  4. Stage: "Pre-processing",
  5. Name: "Remove burned closed captions",
  6. Type: "Video",
  7. Operation: "Remux",
  8. Description:
  9. "[Contains built-in filter] If detected, closed captions (XDS,608,708) will be removed. Derived from x7ac Closed Captions plugin.",
  10. Version: "1.00",
  11. Link:
  12. "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/",
  13. Tags: "pre-processing,ffmpeg,subtitle only",
  14. };
  15. }
  16.  
  17. function plugin(file) {
  18. const response = {
  19. processFile: false,
  20. preset: ',-map 0 -codec copy -bsf:v "filter_units=remove_types=6"',
  21. container: "." + file.container,
  22. handBrakeMode: false,
  23. FFmpegMode: true,
  24. reQueueAfter: true,
  25. infoLog: "",
  26. };
  27.  
  28. if (file.fileMedium !== "video") {
  29. response.infoLog += "☒File is not video \n";
  30. return response;
  31. }
  32.  
  33. //Check if Closed Captions are set at file level
  34. if (file.hasClosedCaptions) {
  35. response.processFile = true;
  36. response.infoLog += '☒This file has closed captions \n';
  37. return response;
  38. }
  39. //If not, check for Closed Captions in the streams
  40. for (const stream in file.ffProbeData.streams) {
  41. if (stream.closed_captions) {
  42. response.processFile = true;
  43. }
  44. }
  45.  
  46. response.infoLog +=
  47. response.processFile ? '☒This file has burnt closed captions \n'
  48. : '☑Closed captions have not been detected on this file \n';
  49.  
  50. return response;
  51. }
  52.  
  53. module.exports.details = details;
  54. module.exports.plugin = plugin;
  55.  
Add Comment
Please, Sign In to add comment