diff --git a/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js b/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js index 122134b..0c5a59f 100644 --- a/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js @@ -1,5 +1,4 @@ module.exports.dependencies = ['import-fresh']; -// tdarrSkipTest const details = () => ({ id: 'Tdarr_Plugin_Greg_MP3_FFMPEG_CPU', Stage: 'Pre-processing', diff --git a/tests/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js b/tests/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js new file mode 100644 index 0000000..ef5221c --- /dev/null +++ b/tests/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js @@ -0,0 +1,59 @@ +/* eslint max-len: 0 */ +const _ = require('lodash'); +const run = require('../helpers/run'); + +const tests = [ + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')), + librarySettings: {}, + inputs: {}, + otherArguments: {}, + }, + output: { + preset: ', -map_metadata 0 -id3v2_version 3 -b:a 320k', + container: '.mp3', + handbrakeMode: false, + ffmpegMode: true, + processFile: false, + reQueueAfter: true, + infoLog: 'undefined☒Codec excluded \n ☑Codec not excluded \n', + }, + }, + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleAAC_1.json')), + librarySettings: {}, + inputs: {}, + otherArguments: {}, + }, + output: { + preset: ', -map_metadata 0 -id3v2_version 3 -b:a 320k', + container: '.mp3', + handbrakeMode: false, + ffmpegMode: true, + processFile: false, + reQueueAfter: true, + infoLog: 'undefined☒Codec excluded \n ☑Codec not excluded \n', + }, + }, + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleMP3_1.json')), + librarySettings: {}, + inputs: {}, + otherArguments: {}, + }, + output: { + preset: ', -map_metadata 0 -id3v2_version 3 -b:a 320k', + container: '.mp3', + handbrakeMode: false, + ffmpegMode: true, + processFile: false, + reQueueAfter: true, + infoLog: 'undefined☒Codec excluded \n ☒Codec excluded \n', + }, + }, +]; + +run(tests); diff --git a/tests/sampleData/media/sampleAAC_1.json b/tests/sampleData/media/sampleAAC_1.json new file mode 100644 index 0000000..81d53e6 --- /dev/null +++ b/tests/sampleData/media/sampleAAC_1.json @@ -0,0 +1,334 @@ +{ + "_id": "C:/Transcode/Source Folder/qsv_h265.mkv", + "file": "C:/Transcode/Source Folder/qsv_h265.mkv", + "DB": "2MY5YD7P8", + "footprintId": "xkZP3IPR6g", + "hasClosedCaptions": false, + "container": "mkv", + "scannerReads": { + "ffProbeRead": "success", + "exiftoolRead": "success", + "mediaInfoRead": "success", + "closedCaptionRead": "\"Unable to run CCExtractor\"" + }, + "ffProbeData": { + "streams": [ + { + "index": 0, + "codec_name": "hevc", + "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)", + "profile": "Main", + "codec_type": "video", + "codec_tag_string": "[0][0][0][0]", + "codec_tag": "0x0000", + "width": 1920, + "height": 1080, + "coded_width": 1920, + "coded_height": 1088, + "closed_captions": 0, + "has_b_frames": 1, + "sample_aspect_ratio": "1:1", + "display_aspect_ratio": "16:9", + "pix_fmt": "yuv420p", + "level": 150, + "color_range": "tv", + "color_space": "bt709", + "color_transfer": "bt709", + "color_primaries": "bt709", + "chroma_location": "left", + "refs": 1, + "r_frame_rate": "25/1", + "avg_frame_rate": "25/1", + "time_base": "1/1000", + "start_pts": 21, + "start_time": "0.021000", + "disposition": { + "default": 1, + "dub": 0, + "original": 0, + "comment": 0, + "lyrics": 0, + "karaoke": 0, + "forced": 0, + "hearing_impaired": 0, + "visual_impaired": 0, + "clean_effects": 0, + "attached_pic": 0, + "timed_thumbnails": 0, + "captions": 0, + "descriptions": 0, + "metadata": 0, + "dependent": 0, + "still_image": 0 + }, + "tags": { + "DURATION": "00:00:21.341000000" + } + }, + { + "index": 1, + "codec_name": "aac", + "codec_long_name": "AAC (Advanced Audio Coding)", + "profile": "LC", + "codec_type": "audio", + "codec_tag_string": "[0][0][0][0]", + "codec_tag": "0x0000", + "sample_fmt": "fltp", + "sample_rate": "48000", + "channels": 2, + "channel_layout": "stereo", + "bits_per_sample": 0, + "r_frame_rate": "0/0", + "avg_frame_rate": "0/0", + "time_base": "1/1000", + "start_pts": 0, + "start_time": "0.000000", + "disposition": { + "default": 1, + "dub": 0, + "original": 0, + "comment": 0, + "lyrics": 0, + "karaoke": 0, + "forced": 0, + "hearing_impaired": 0, + "visual_impaired": 0, + "clean_effects": 0, + "attached_pic": 0, + "timed_thumbnails": 0, + "captions": 0, + "descriptions": 0, + "metadata": 0, + "dependent": 0, + "still_image": 0 + }, + "tags": { + "title": "Stereo", + "DURATION": "00:00:21.375000000" + } + } + ], + "format": { + "filename": "C:/Transcode/Source Folder/qsv_h265.mkv", + "nb_streams": 2, + "nb_programs": 0, + "format_name": "matroska,webm", + "format_long_name": "Matroska / WebM", + "start_time": "0.000000", + "duration": "21.375000", + "size": "8569883", + "bit_rate": "3207441", + "probe_score": 100, + "tags": { + "creation_time": "2019-09-13T16:46:14.000000Z", + "ENCODER": "Lavf58.20.100" + } + } + }, + "file_size": 8.172877311706543, + "video_resolution": "1080p", + "fileMedium": "video", + "video_codec_name": "hevc", + "audio_codec_name": "", + "lastPluginDetails": "none", + "createdAt": 1653029410394, + "bit_rate": 3207441, + "duration": 21, + "statSync": { + "dev": 3832468976, + "mode": 33060, + "nlink": 1, + "uid": 0, + "gid": 0, + "rdev": 0, + "blksize": 4096, + "ino": 1970324841360027, + "size": 8569883, + "blocks": 16744, + "atimeMs": 1653029410381.1382, + "mtimeMs": 1568393195000, + "ctimeMs": 1650864287188.087, + "birthtimeMs": 1650864302270.2063, + "atime": "2022-05-20T06:50:10.381Z", + "mtime": "2019-09-13T16:46:35.000Z", + "ctime": "2022-04-25T05:24:47.188Z", + "birthtime": "2022-04-25T05:25:02.270Z" + }, + "HealthCheck": "", + "TranscodeDecisionMaker": "", + "lastHealthCheckDate": 0, + "holdUntil": 0, + "lastTranscodeDate": 0, + "bumped": false, + "history": "", + "oldSize": 0, + "newSize": 0, + "videoStreamIndex": 0, + "lastUpdate": 1653027918258, + "meta": { + "SourceFile": "C:/Transcode/Source Folder/qsv_h265.mkv", + "errors": [], + "Duration": 21.375, + "ExifToolVersion": 12.4, + "FileName": "qsv_h265.mkv", + "Directory": "C:/Transcode/Source Folder", + "FileSize": "8.2 MiB", + "FileModifyDate": { + "year": 2019, + "month": 9, + "day": 13, + "hour": 17, + "minute": 46, + "second": 35, + "millisecond": 0, + "tzoffsetMinutes": 60, + "rawValue": "2019:09:13 17:46:35+01:00" + }, + "FileAccessDate": { + "year": 2022, + "month": 5, + "day": 20, + "hour": 7, + "minute": 50, + "second": 9, + "millisecond": 0, + "tzoffsetMinutes": 60, + "rawValue": "2022:05:20 07:50:09+01:00" + }, + "FileCreateDate": { + "year": 2022, + "month": 4, + "day": 25, + "hour": 6, + "minute": 25, + "second": 2, + "millisecond": 0, + "tzoffsetMinutes": 60, + "rawValue": "2022:04:25 06:25:02+01:00" + }, + "FilePermissions": "-r--r--r--", + "FileType": "MKV", + "FileTypeExtension": "mkv", + "MIMEType": "video/x-matroska", + "EBMLVersion": 1, + "EBMLReadVersion": 1, + "DocType": "matroska", + "DocTypeVersion": 4, + "DocTypeReadVersion": 2, + "TimecodeScale": "1 ms", + "MuxingApp": "Lavf58.20.100", + "WritingApp": "HandBrake 1.2.2 2019022300", + "DateTimeOriginal": { + "year": 2019, + "month": 9, + "day": 13, + "hour": 16, + "minute": 46, + "second": 14, + "millisecond": 0, + "tzoffsetMinutes": 0, + "rawValue": "2019:09:13 16:46:14Z" + }, + "VideoFrameRate": 25, + "ImageWidth": 1920, + "ImageHeight": 1080, + "TrackNumber": 2, + "TrackName": "Stereo", + "TrackLanguage": "und", + "CodecID": "A_AAC", + "TrackType": "Audio", + "AudioChannels": 2, + "AudioSampleRate": 48000, + "TagName": "DURATION", + "TagString": "00:00:21.375000000", + "ImageSize": "1920x1080", + "Megapixels": 2.1 + }, + "mediaInfo": { + "@ref": "", + "track": [ + { + "@type": "General", + "UniqueID": "112612991515236890937117095733641799622", + "VideoCount": "1", + "AudioCount": "1", + "Format": "Matroska", + "Format_Version": "4", + "FileSize": "8569883", + "Duration": "21.375", + "OverallBitRate": "3207442", + "FrameRate": "25.000", + "FrameCount": "533", + "IsStreamable": "Yes", + "Encoded_Date": "UTC 2019-09-13 16:46:14", + "Encoded_Application": "HandBrake 1.2.2 2019022300", + "Encoded_Library": "Lavf58.20.100", + "extra": { + "ErrorDetectionType": "Per level 1" + } + }, + { + "@type": "Video", + "StreamOrder": "0", + "ID": "1", + "UniqueID": "1", + "Format": "HEVC", + "Format_Profile": "Main", + "Format_Level": "5", + "Format_Tier": "Main", + "CodecID": "V_MPEGH/ISO/HEVC", + "Duration": "21.320000000", + "Width": "1920", + "Height": "1080", + "Stored_Height": "1088", + "Sampled_Width": "1920", + "Sampled_Height": "1080", + "PixelAspectRatio": "1.000", + "DisplayAspectRatio": "1.778", + "FrameRate_Mode": "CFR", + "FrameRate": "25.000", + "FrameCount": "533", + "ColorSpace": "YUV", + "ChromaSubsampling": "4:2:0", + "BitDepth": "8", + "Delay": "0.021", + "Default": "Yes", + "Forced": "No", + "colour_description_present": "Yes", + "colour_description_present_Source": "Stream", + "colour_range": "Limited", + "colour_range_Source": "Stream", + "colour_primaries": "BT.709", + "colour_primaries_Source": "Stream", + "transfer_characteristics": "BT.709", + "transfer_characteristics_Source": "Stream", + "matrix_coefficients": "BT.709", + "matrix_coefficients_Source": "Stream" + }, + { + "@type": "Audio", + "StreamOrder": "1", + "ID": "2", + "UniqueID": "2", + "Format": "AAC", + "Format_Settings_SBR": "No (Explicit)", + "Format_AdditionalFeatures": "LC", + "CodecID": "A_AAC-2", + "Duration": "21.375000000", + "Channels": "2", + "ChannelPositions": "Front: L R", + "ChannelLayout": "L R", + "SamplesPerFrame": "1024", + "SamplingRate": "48000", + "SamplingCount": "1026000", + "FrameRate": "46.875", + "Compression_Mode": "Lossy", + "Delay": "0.000", + "Delay_Source": "Container", + "Title": "Stereo", + "Default": "Yes", + "Forced": "No" + } + ] + } + } \ No newline at end of file diff --git a/tests/sampleData/media/sampleMP3_1.json b/tests/sampleData/media/sampleMP3_1.json new file mode 100644 index 0000000..6c7dd81 --- /dev/null +++ b/tests/sampleData/media/sampleMP3_1.json @@ -0,0 +1,314 @@ +{ + "_id": "C:/Transcode/Source Folder/sample__-__-__libmp3lame__30s__audio.mkv", + "file": "C:/Transcode/Source Folder/sample__-__-__libmp3lame__30s__audio.mkv", + "DB": "2MY5YD7P8", + "footprintId": "xpsr-dmmd", + "hasClosedCaptions": false, + "container": "mkv", + "scannerReads": { + "ffProbeRead": "success", + "exiftoolRead": "success", + "mediaInfoRead": "success", + "closedCaptionRead": "\"Unable to run CCExtractor\"" + }, + "ffProbeData": { + "streams": [ + { + "index": 0, + "codec_name": "mp3", + "codec_long_name": "MP3 (MPEG audio layer 3)", + "codec_type": "audio", + "codec_tag_string": "[0][0][0][0]", + "codec_tag": "0x0000", + "sample_fmt": "fltp", + "sample_rate": "48000", + "channels": 2, + "channel_layout": "stereo", + "bits_per_sample": 0, + "r_frame_rate": "0/0", + "avg_frame_rate": "0/0", + "time_base": "1/1000", + "start_pts": 0, + "start_time": "0.000000", + "bit_rate": "128000", + "disposition": { + "default": 1, + "dub": 0, + "original": 0, + "comment": 0, + "lyrics": 0, + "karaoke": 0, + "forced": 0, + "hearing_impaired": 0, + "visual_impaired": 0, + "clean_effects": 0, + "attached_pic": 0, + "timed_thumbnails": 0, + "captions": 0, + "descriptions": 0, + "metadata": 0, + "dependent": 0, + "still_image": 0 + }, + "tags": { + "HANDLER_NAME": "GPAC ISO Audio Handler", + "ENCODER": "Lavc57.107.100 libmp3lame", + "DURATION": "00:00:30.023000000" + } + }, + { + "index": 1, + "codec_name": "mp3", + "codec_long_name": "MP3 (MPEG audio layer 3)", + "codec_type": "audio", + "codec_tag_string": "[0][0][0][0]", + "codec_tag": "0x0000", + "sample_fmt": "fltp", + "sample_rate": "48000", + "channels": 2, + "channel_layout": "stereo", + "bits_per_sample": 0, + "r_frame_rate": "0/0", + "avg_frame_rate": "0/0", + "time_base": "1/1000", + "start_pts": 0, + "start_time": "0.000000", + "bit_rate": "128000", + "disposition": { + "default": 1, + "dub": 0, + "original": 0, + "comment": 0, + "lyrics": 0, + "karaoke": 0, + "forced": 0, + "hearing_impaired": 0, + "visual_impaired": 0, + "clean_effects": 0, + "attached_pic": 0, + "timed_thumbnails": 0, + "captions": 0, + "descriptions": 0, + "metadata": 0, + "dependent": 0, + "still_image": 0 + }, + "tags": { + "HANDLER_NAME": "GPAC ISO Audio Handler", + "ENCODER": "Lavc57.107.100 libmp3lame", + "DURATION": "00:00:30.023000000" + } + } + ], + "format": { + "filename": "C:/Transcode/Source Folder/sample__-__-__libmp3lame__30s__audio.mkv", + "nb_streams": 2, + "nb_programs": 0, + "format_name": "matroska,webm", + "format_long_name": "Matroska / WebM", + "start_time": "0.000000", + "duration": "30.023000", + "size": "979815", + "bit_rate": "261083", + "probe_score": 100, + "tags": { + "title": "Big Buck Bunny, Sunflower version", + "GENRE": "Animation", + "MAJOR_BRAND": "isom", + "MINOR_VERSION": "1", + "COMPATIBLE_BRANDS": "isomavc1", + "COMPOSER": "Sacha Goedegebure", + "ARTIST": "Blender Foundation 2008, Janus Bager Kristensen 2013", + "COMMENT": "Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net", + "ENCODER": "Lavf57.83.100" + } + } + }, + "file_size": 0.9344244003295898, + "video_resolution": "", + "fileMedium": "audio", + "video_codec_name": "", + "audio_codec_name": "mp3", + "lastPluginDetails": "none", + "createdAt": 1653224430511, + "bit_rate": 261083, + "duration": 30, + "statSync": { + "dev": 3832468976, + "mode": 33206, + "nlink": 1, + "uid": 0, + "gid": 0, + "rdev": 0, + "blksize": 4096, + "ino": 10133099162447292, + "size": 979815, + "blocks": 1920, + "atimeMs": 1653224430487.7, + "mtimeMs": 1653224386734.2915, + "ctimeMs": 1653224395573.211, + "birthtimeMs": 1653224386247.453, + "atime": "2022-05-22T13:00:30.488Z", + "mtime": "2022-05-22T12:59:46.734Z", + "ctime": "2022-05-22T12:59:55.573Z", + "birthtime": "2022-05-22T12:59:46.247Z" + }, + "HealthCheck": "", + "TranscodeDecisionMaker": "", + "lastHealthCheckDate": 0, + "holdUntil": 0, + "lastTranscodeDate": 0, + "bumped": false, + "history": "", + "oldSize": 0, + "newSize": 0, + "videoStreamIndex": -1, + "meta": { + "SourceFile": "C:/Transcode/Source Folder/sample__-__-__libmp3lame__30s__audio.mkv", + "errors": [], + "Duration": 30.023, + "ExifToolVersion": 12.4, + "FileName": "sample__-__-__libmp3lame__30s__audio.mkv", + "Directory": "C:/Transcode/Source Folder", + "FileSize": "957 KiB", + "ZoneIdentifier": "Exists", + "FileModifyDate": { + "year": 2022, + "month": 5, + "day": 22, + "hour": 13, + "minute": 59, + "second": 46, + "millisecond": 0, + "tzoffsetMinutes": 60, + "rawValue": "2022:05:22 13:59:46+01:00" + }, + "FileAccessDate": { + "year": 2022, + "month": 5, + "day": 22, + "hour": 14, + "minute": 0, + "second": 29, + "millisecond": 0, + "tzoffsetMinutes": 60, + "rawValue": "2022:05:22 14:00:29+01:00" + }, + "FileCreateDate": { + "year": 2022, + "month": 5, + "day": 22, + "hour": 13, + "minute": 59, + "second": 46, + "millisecond": 0, + "tzoffsetMinutes": 60, + "rawValue": "2022:05:22 13:59:46+01:00" + }, + "FilePermissions": "-rw-rw-rw-", + "FileType": "MKA", + "FileTypeExtension": "mka", + "MIMEType": "audio/x-matroska", + "EBMLVersion": 1, + "EBMLReadVersion": 1, + "DocType": "matroska", + "DocTypeVersion": 4, + "DocTypeReadVersion": 2, + "TimecodeScale": "1 ms", + "Title": "Big Buck Bunny, Sunflower version", + "MuxingApp": "Lavf57.83.100", + "WritingApp": "Lavf57.83.100", + "TrackNumber": 2, + "TrackLanguage": "und", + "CodecID": "A_MPEG/L3", + "TrackType": "Audio", + "AudioChannels": 2, + "AudioSampleRate": 48000, + "AudioBitsPerSample": 32, + "TagName": "DURATION", + "TagString": "00:00:30.023000000" + }, + "mediaInfo": { + "@ref": "", + "track": [ + { + "@type": "General", + "UniqueID": "301354878049300200919944107613778820882", + "AudioCount": "2", + "Format": "Matroska", + "Format_Version": "4", + "FileSize": "979815", + "Duration": "30.023", + "OverallBitRate_Mode": "CBR", + "OverallBitRate": "261084", + "StreamSize": "19079", + "IsStreamable": "Yes", + "Title": "Big Buck Bunny, Sunflower version", + "Track": "Big Buck Bunny, Sunflower version", + "Encoded_Application": "Lavf57.83.100", + "Encoded_Library": "Lavf57.83.100", + "Comment": "Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net", + "extra": { + "ErrorDetectionType": "Per level 1", + "ARTIST": "Blender Foundation 2008, Janus Bager Kristensen 2013", + "COMPOSER": "Sacha Goedegebure", + "GENRE": "Animation" + } + }, + { + "@type": "Audio", + "@typeorder": "1", + "StreamOrder": "0", + "ID": "1", + "UniqueID": "1", + "Format": "MPEG Audio", + "Format_Version": "1", + "Format_Profile": "Layer 3", + "Format_Settings_Mode": "Joint stereo", + "Format_Settings_ModeExtension": "MS Stereo", + "CodecID": "A_MPEG/L3", + "Duration": "30.023000000", + "BitRate_Mode": "CBR", + "BitRate": "128000", + "Channels": "2", + "SamplingRate": "48000", + "SamplingCount": "1441104", + "Compression_Mode": "Lossy", + "Delay": "0.000", + "Delay_Source": "Container", + "StreamSize": "480368", + "StreamSize_Proportion": "0.49026", + "Encoded_Library": "Lavc57.107.100 libmp3lame", + "Default": "Yes", + "Forced": "No" + }, + { + "@type": "Audio", + "@typeorder": "2", + "StreamOrder": "1", + "ID": "2", + "UniqueID": "2", + "Format": "MPEG Audio", + "Format_Version": "1", + "Format_Profile": "Layer 3", + "Format_Settings_Mode": "Joint stereo", + "Format_Settings_ModeExtension": "MS Stereo", + "CodecID": "A_MPEG/L3", + "Duration": "30.023000000", + "BitRate_Mode": "CBR", + "BitRate": "128000", + "Channels": "2", + "SamplingRate": "48000", + "SamplingCount": "1441104", + "Compression_Mode": "Lossy", + "Delay": "0.000", + "Delay_Source": "Container", + "StreamSize": "480368", + "StreamSize_Proportion": "0.49026", + "Encoded_Library": "Lavc57.107.100 libmp3lame", + "Default": "Yes", + "Forced": "No" + } + ] + } +} \ No newline at end of file