Anime4000 / IFME

Powerful x265 GUI Encoder
https://x265.github.io/
GNU General Public License v2.0
241 stars 54 forks source link

error: [8.3.1 SVT-AV1] Value of '35' is not valid for 'Value'. #237

Open longwu9t opened 2 days ago

longwu9t commented 2 days ago

When an encoding error occurs, exit the program actively, start the program again, and add the source file to the queue 2024-07-03_133118

longwu9t commented 2 days ago

Maybe it's a problem with the source files? But this cat.mkv has always been the file I use for testing, and it has always been normal.

longwu9t commented 2 days ago

2024-07-03_134411 maybe ... The Magic Number 35

longwu9t commented 2 days ago

I randomly changed the 35 in the svt-av1 configuration file to 36 34 33 32, and it still reported the same error, 3130..., and the error disappeared ^_!

Anime4000 commented 2 days ago

that SVT-AV1 is your own install? because I can't replicate the error

longwu9t commented 2 days ago

https://github.com/Anime4000/IFME/assets/9213316/087d84c3-3e86-4bbb-8f8a-0b4c2d62adec

Svt[info]: ------------------------------------------- Svt[info]: SVT [version]: SVT-AV1 Encoder Lib v2.1.2-15-gb8d2f2b4 Svt[info]: SVT [build] : GCC 14.1.0 64 bit Svt[info]: LIB Build date: Jul 2 2024 19:07:59 Svt[info]: ------------------------------------------- Error instance 1: Invalid Input File Error in configuration, could not begin encoding! ... Run SvtAv1EncApp.exe --help for a list of options

sha1: b7b49750fb8ee57f46609b04dc88f417dbfbdae0 SvtAv1EncApp.exe

longwu9t commented 2 days ago

I have found the cause of the error. The configuration file of svt-av1 must be placed in the subdirectory under Plugins, not in the Plugins directory. This may mean that the source program uses a relative path instead of an absolute path.

longwu9t commented 2 days ago

For the robustness and configurability of the program, can consider not using relative paths to hard-code into the source program files, such as the paths of mp4box and ffmpeg in the same situation. The Plugins directory can be written in the source program, and the configuration items in the json under the Plugins directory should use absolute paths as much as possible.

Anime4000 commented 2 days ago

configuration items in the json under the Plugins directory should use absolute paths as much as possible.

This will break "Portable"

However, it always check encoder path is Full (Rooted) or no as this line check: https://github.com/Anime4000/IFME/blob/master/IFME/Plugins/PluginsLoad.cs#L43 https://github.com/Anime4000/IFME/blob/master/IFME/Plugins/PluginsLoad.cs#L139

the Path.IsPathRooted(); check path is full and absolute, for example: Windows: C:\foo\bar Linux: /foo/bar when condition above, means true, Plugins Loader will use full path

Windows: ..\ffmpeg64\ffmpeg Linux: /ffmpeg64/ffmpeg when condition above, mean false, so Plugins Loader will concat:-

  1. D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins\ffmpeg.audio\_plugin.audio-ffmpeg32_aac-free.json
  2. D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins\ffmpeg.audio
  3. D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins\ffmpeg.audio + ..\ffmpeg64\ffmpeg
  4. .. is in the path, up one folder
  5. D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins
  6. D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins\ffmpeg64\ffmpeg

Also Plugins Loader will scan _plugin.audio and _plugin.video prefix recursively, you can put many deep sub folder inside Plugins

so far I tested

  1. D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins\aac\free\_plugin.audio-ffmpeg32_aac-free.json
  2. D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins\aac\free\_plugin.audio-ffmpeg64_aac-free.json
  3. D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins\acc\fdk\_plugin.audio-ffmpeg32_aac-fdk.json
  4. D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins\acc\fdk\_plugin.audio-ffmpeg64_aac-fdk.json

the path will be ..\..\ffmpeg64\ffmpeg

longwu9t commented 2 days ago

In my machine, since the encoders are all public, I write the absolute path of most executable files in the json configuration file. This cannot be done. Currently, I use the mklink command to create soft links.

Anime4000 commented 1 day ago

since the encoders are all public

Do you mean your encoder is in PATH environment ?

longwu9t commented 1 day ago

yes Added to the system PATH

Anime4000 commented 1 day ago

let me try, if this can be automated

longwu9t commented 1 day ago

Mainly because FFmpeg MP4BOX X264 and other encoders are not small in size, and are repeatedly used by multiple applications. If do not do this, it is a waste of disk space, not conducive to APP packaging backup, not conducive to the uniform version of the encoder.

Anime4000 commented 1 day ago

testing for encoder:

[DEBG] Command Line: "D:\Users\Anime4000\Documents\GitHub\IFME\IFME\bin\Debug\Plugins\ffmpeg64\ffmpeg" -hide_banner -v error -i "Z:\Videos\GalGame\sppl_01_op.avi" -map 0:0 -pix_fmt yuv420p -vf scale=800:448:flags=lanczos,fps=24 -strict -1 -f yuv4mpegpipe - | "SvtAv1EncApp.exe" -i stdin -n 2999 --input-depth 8 --preset 2 --profile 0 --crf 35 --progress 2 -b video0000_jpn.ivf
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:   SVT-AV1 Encoder Lib v2.1.2-15-gb8d2f2b4
Svt[info]: SVT [build]  :   GCC 14.1.0   64 bit
Svt[info]: LIB Build date: Jul  2 2024 19:07:59
Svt[info]: -------------------------------------------
Svt[info]: Number of logical cores available: 32
Svt[info]: Number of PPCS 173
Svt[info]: [asm level on system : up to avx2]
Svt[info]: [asm level selected : up to avx2]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile   tier (auto) level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator       : 800 / 448 / 24 / 1
Svt[info]: SVT [config]: bit-depth / color format                   : 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct                    : 2 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type          : 161 / 32 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor                     : CRF / 35 
Svt[info]: SVT [config]: AQ mode / variance boost                   : 2 / 0
Svt[info]: -------------------------------------------

I do the same with FFmpeg next. if FFmpeg found in the PATH it will use PATH by default.

Anime4000 commented 1 day ago

I also have done for FFmpeg, now use PATH by default.

[DEBG] Command Line: "ffmpeg" -hide_banner -v error -i "Z:\Videos\GalGame\sppl_01_op.avi" -map 0:0 -pix_fmt yuv420p -vf scale=800:448:flags=lanczos,fps=24 -strict -1 -f yuv4mpegpipe - | "SvtAv1EncApp.exe" -i stdin -n 2999 --input-depth 8 --preset 2 --profile 0 --crf 35 --progress 2 -b video0000_und.ivf
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:   SVT-AV1 Encoder Lib v2.1.2-15-gb8d2f2b4
Svt[info]: SVT [build]  :   GCC 14.1.0   64 bit
Svt[info]: LIB Build date: Jul  2 2024 19:07:59
Svt[info]: -------------------------------------------
Svt[info]: Number of logical cores available: 32
Svt[info]: Number of PPCS 173
Svt[info]: [asm level on system : up to avx2]
Svt[info]: [asm level selected : up to avx2]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile   tier (auto) level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator       : 800 / 448 / 24 / 1
Svt[info]: SVT [config]: bit-depth / color format                   : 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct                    : 2 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type          : 161 / 32 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor                     : CRF / 35 
Svt[info]: SVT [config]: AQ mode / variance boost                   : 2 / 0
Svt[info]: -------------------------------------------

make sure the JSON file just encoder.exe, no ..

longwu9t commented 1 day ago

All other encoders(ffmpeg mp4box x264 x265 uvg266 qaac fdkaac hmp3 ...) in the system PATH work as expected except SVT-AV1, which still reports the same error.

longwu9t commented 1 day ago

(Format)mkv + (encoder)svt-av1 If this combination becomes the default combination, it may go wrong Just my guess Attached is my current configuration folder, all encoders are in PATH Plugins.zip

2024-07-04_183656 2024-07-04_183712

Anime4000 commented 1 day ago

I change the code, try again if still have issue

longwu9t commented 1 day ago

I change the code, try again if still have issue

this time no error thanks!!!

Anime4000 commented 1 day ago

Nice, time to release to public

longwu9t commented 1 day ago

Another good news: with this fix, the "MultiChannelSupport": false option can now generate mp2 mp3 mono files normally.

Anime4000 commented 1 day ago

nice, next I going to change JSON to support libtwolame, the way to map channel is different most standard, so JSON is going to change:

    "Channels": {
      "-1": "auto",
      "0": "stereo",
      "1": "joint stereo",
      "2": "dual_channel",
      "3": "mono"
    },
    "ChannelArgs": "--mode",

the top array is always as auto

longwu9t commented 1 day ago

"0": "stereo", "1": "joint stereo", "2": "dual_channel", Most users are not sensitive to the distinction between these three

For AAC, if fhgaacenc is used, compatibility is very good, whether it is multi-channel mono or sampling rate. "MultiChannelSupport": false, "MonoSupport": false, The above two parameters are not required for fhgaacenc

_plugin audio_aac

longwu9t commented 1 day ago

fhgaacenc.zip General encoding options --cbr : encode in CBR mode, bitrate=8..576 --vbr : encode in VBR mode, preset=1..6 [default, preset 4] 1: HE-AAC v2 (~32 kbps) 2: HE-AAC (~64 kbps) 3: AAC LC (~96 kbps) 4: AAC LC (~128 kbps) 5: AAC LC (~192 kbps) 6: AAC LC (~256 kbps) --profile <auto|lc|he|hev2> : choose AAC profile (only for CBR mode) auto : automatically choose the optimum profile according to the bitrate [default] lc : force use LC-AAC profile he : force use HE-AAC (AAC+SBR) profile hev2 : force use HE-AAC v2 (AAC+SBR+PS) profile --adts : use ADTS container instead of MPEG-4 Other options --ignorelength : ignore the size of data chunk when encoding from pipe --quiet : don't print the progress

Anime4000 commented 1 day ago

the ChannelArgs is use when specific for that lib is required, by default will use FFmpeg -ac (if JSON not mention it)

Anime4000 commented 1 day ago

I have updated the JSON, all audio plugin json must be updated, changes, replace Channel

        "Channels": {
            "-1": "Auto",
            "0": "Stereo",
            "1": "Joint Stereo",
            "2": "Dual Channel",
            "3": "Mono"
        },
        "ChannelArgs": "-mode",

LibTwoLame

{
    "GUID": "deadbeef-2002-d002-d002-d002d002d002",
    "Name": "MPEG Audio Layer-2 (TwoLAME)",
    "Version": null,
    "X64": true,
    "Format": [
        "avi",
        "mp2",
        "mp4",
        "mkv"
    ],
    "Author": {
        "Developer": "Mike Cheng",
        "URL": "https://en.wikipedia.org/wiki/TooLAME"
    },
    "Update": {
        "VersionURL": null,
        "DownloadURL": null
    },
    "Audio": {
        "Extension": "mp2",
        "Encoder": "../ffmpeg64/ffmpeg",
        "SampleRate": [
            16000,
            22050,
            24000,
            32000,
            44100,
            48000
        ],
        "SampleRateDefault": 44100,
        "Channels": {
            "-1": "Auto",
            "0": "Stereo",
            "1": "Joint Stereo",
            "2": "Dual Channel",
            "3": "Mono"
        },
        "ChannelArgs": "-mode",
        "ChannelDefault": 2,
        "Args": {
            "Pipe": false,
            "Input": "-hide_banner -v quiet -stats -i",
            "Codec": "-vn -sn -dn -c:a libtwolame",
            "Output": "-y",
            "Command": null
        },
        "Mode": [
            {
                "Name": "Bitrate",
                "Args": "-b:a",
                "MultiChannelSupport": false,
                "QualityPrefix": "",
                "QualityPostfix": "k",
                "Quality": [
                    128,
                    160,
                    192,
                    224,
                    256,
                    320,
                    480,
                    512
                ],
                "Default": 192
            }
        ]
    }
}
longwu9t commented 1 day ago

[robust audio command] ffmpeg libopus error:

1 2 3 4

In addition, the mp2 bit rate: 5

longwu9t commented 1 day ago
{
    "GUID": "deadface-f00d-f00d-f00d-f00df00df00d",
    "Name": "opus",
    "Version": null,
    "X64": true,
    "Format": [
        "opus",
        "mkv",
        "webm"
    ],
    "Author": {
        "Developer": "Xiph.Org Foundation, Marc Valin, IETF",
        "URL": "http://opus-codec.org/"
    },
    "Update": {
        "VersionURL": null,
        "DownloadURL": null
    },
    "Audio": {
        "Extension": "opus",
        "Encoder": "opusenc.exe",
        "SampleRate": [
            0
        ],
        "SampleRateDefault": 0,
        "Channels": {
            "-1": "Auto"
        },
        "ChannelArgs": "-mode",
        "ChannelDefault": -1,
        "Args": {
            "Pipe": true,
            "Input": "--ignorelength --quiet -",
            "Output": "",
            "Command": null
        },
        "Mode": [
            {
                "Name": "Bitrate",
                "Args": "--bitrate",
                "QualityPrefix": "",
                "QualityPostfix": "",
                "Quality": [
                    64,
                    128,
                    160,
                    256,
                    320,
                    512
                ],
                "Default": 256
            }
        ]
    }
}

can choose a separate command line version of opusenc encoding

Anime4000 commented 23 hours ago

This only special for some encoder like libtwolame, so, need use typical FFmpeg, since this will use at FFmpeg side

        "Channels": {
            "0": "Auto"
        },
        "ChannelArgs": "-ac",
        "ChannelDefault": 0,

example using ffmpeg libtwolame

C:\Users\Anime4000>ffmpeg -h encoder=libtwolame

Encoder libtwolame [libtwolame MP2 (MPEG audio layer 2)]:
    General capabilities: dr1 delay
    Threading capabilities: none
    Supported sample rates: 16000 22050 24000 32000 44100 48000
    Supported sample formats: flt fltp s16 s16p
    Supported channel layouts: mono stereo
libtwolame encoder AVOptions:
  -mode              <int>        E...A...... Mpeg Mode (from -1 to 3) (default auto)
     auto            -1           E...A......
     stereo          0            E...A......
     joint_stereo    1            E...A......
     dual_channel    2            E...A......
     mono            3            E...A......
  -psymodel          <int>        E...A...... Psychoacoustic Model (from -1 to 4) (default 3)
  -energy_levels     <int>        E...A...... enable energy levels (from 0 to 1) (default 0)
  -error_protection  <int>        E...A...... enable CRC error protection (from 0 to 1) (default 0)
  -copyright         <int>        E...A...... set MPEG Audio Copyright flag (from 0 to 1) (default 0)
  -original          <int>        E...A...... set MPEG Audio Original flag (from 0 to 1) (default 0)
  -verbosity         <int>        E...A...... set library optput level (0-10) (from 0 to 10) (default 0)
longwu9t commented 23 hours ago

"ChannelArgs": "-ac", This new option caught my eye

longwu9t commented 23 hours ago
{
    "GUID": "deadbeef-0aac-0aac-0aac-0aac0aac0aac",
    "Name": "fhgaacenc",
    "Free": false,
    "Version": null,
    "X64": true,
    "Format": [
        "mp4",
        "m4a",
        "mkv",
        "ts",
    ],
    "Author": {
        "Developer": "tmkk",
        "URL": null
    },
    "Update": {
        "VersionURL": null,
        "DownloadURL": null
    },
    "Audio": {
        "Extension": "m4a",
        "Encoder": "fhgaacenc.exe",
        "SampleRate": [
            0,
            8000,
            12000,
            16000,
            22050,
            24000,
            32000,
            44100,
            48000,
            88200,
            96000
        ],
        "SampleRateDefault": 0,
        "Channels": {
            "0": "Auto",
            "1": "Mono",
            "2": "Stereo",
            "6": "5.1 surround sound",
            "8": "7.1 surround sound"
        },
        "ChannelArgs": "-ac",
        "ChannelDefault": 0,
        "Args": {
            "Pipe": true,
            "Input": "-",
            "Output": "",
            "Command": null
        },
        "Mode": [
            {
                "Name": "VBR",
                "Args": "--ignorelength --quiet --vbr",
                "QualityPrefix": "",
                "QualityPostfix": "",
                "Quality": [
                    1,
                    2,
                    3,
                    4,
                    5,
                    6
                ],
                "Default": 2
            },
            {
                "Name": "CBR",
                "Args": "--ignorelength --quiet --profile auto --cbr",
                "QualityPrefix": "",
                "QualityPostfix": "",
                "Quality": [
                    8,
                    16,
                    32,
                    64,
                    96,
                    128,
                    192,
                    256,
                    320,
                    440,
                    576
                ],
                "Default": 256
            }
        ]
    }
}
Anime4000 commented 17 hours ago

"ChannelArgs": "-ac", This new option caught my eye

you can ignore or remove ChannelArgs, by default it use -ac: https://github.com/Anime4000/IFME/blob/master/IFME/Plugins/PluginsAudio.cs#L22

longwu9t commented 17 hours ago

When you have some free time, maybe you should write a help txt of configuration file ^_^