Satalink / ffhevc

Complete MKV media management automation in PHP
1 stars 1 forks source link

Specified channel layout '7.1' is not supported - Conversion failed #1

Open domenicdistefano opened 1 year ago

domenicdistefano commented 1 year ago

Hi!

I have been using your script for several years now since you first write the blog post. Its totally awesome. Over the years I update it as you make changes.

Couple issues;

First as the title indicates I get this with MKVs that have 7.1 tracks. The script aborts instead of skipping. What makes this worse is the second problem.

Originally (years ago) the script would be smart enough to skip a title that it had previously processed. Now it just tries to do it again so if you add this to the first problem each time I need to start over it goes through the entire library again....

Love your script!

Thanks for any help in advance.

Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_nvenc)) Stream #0:1 -> #0:1 (dts (dca) -> eac3 (native)) Stream #0:2 -> #0:2 (copy) Press [q] to stop, [?] for help -async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0. [eac3 @ 000001e7fc6eb300] Specified channel layout '7.1' is not supported Error initializing output stream 0:1 -- Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height Conversion failed!

Satalink commented 7 months ago

Sorry for the delay. I've been working on restructuring the script into a more manageable application. I'll pull some 7.1 examples and try to reproduce the issue you're having. I didn't realize anyone was actually using my script (big happy face!).

domenicdistefano commented 7 months ago

lol myself and several of my friends have been using your script for YEARS!!!!

Sent from my iPhone

On Jan 27, 2024, at 7:45 AM, Neal Garrett @.***> wrote:



Sorry for the delay. I've been working on restructuring the script into a more manageable application. I'll pull some 7.1 examples and try to reproduce the issue you're having. I didn't realize anyone was actually using my script (big happy face!).

— Reply to this email directly, view it on GitHubhttps://github.com/Satalink/ffhevc/issues/1#issuecomment-1913146739, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABVXMGTEZBCKZU7QFRADACLYQTZGFAVCNFSM6AAAAAA3RTQS2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJTGE2DMNZTHE. You are receiving this because you authored the thread.Message ID: @.***>

Satalink commented 7 months ago

TrueHD 7.1 track worked for me. Can you update to the latest version of FFhevc and check again?

image

Satalink commented 7 months ago

NOTE: the latest updates are completely restructured. You might want to save the version you are using as a backup (with the old external_keys.ini file (or whatever it was called). That's been reworked a bit.

domenicdistefano commented 7 months ago

Am I downloaded the code wrong / from the wrong place? The current version of ffhevc.php contains only 61 lines of code but the old one was 1,335!

Satalink commented 7 months ago

It's been restructured so that all functions are in the inc directories. Easier to manage. It's all there.

Satalink commented 7 months ago

use git clone

domenicdistefano commented 7 months ago

Sorry for being a complete dummy but its been a while since working with your script. Up until now using the old script versions I would edit my paths (example below) like this and execute the command python ffhevc.php movies to run the script.

With your new version I made my own media_paths_keys.php file and edited this part (see below) which i believe is correct for my mappings.

But when I run the script this is what I get;

Administrator@Newencoder /cygdrive/c/videotools/ffhevc
$ python ffhevc.php movies
  File "C:\videotools\ffhevc\ffhevc.php", line 2
    <?php
    ^
SyntaxError: invalid syntax

OLD SCRIPT

# directory config format is:
#"key" => "/path/to/video/library|audioChannels|audioK|vmin|vmax|quality_factor|scale|fps|contrast|brightness|saturation|gamma/optional/destination/path"
    $options['locations'] = array(
      "tv" => "/cygdrive/y|6|384k|1|38|0.75|720|25|1|0|1|1|/optional/desitnation/path",
      "movie" => "/cygdrive/z|8|640k|1|33|0.9|2160|30|1|0|1|1|/optional/desitnation/path"
    );
  }

NEW SCRIPT

// CONFIGURE TO YOUR MEDIA DIRECTORY NEEDS - Use above array for reference of value lables
$location_config = array(
  "gopro" => "/cygdrive/i/Videos/GoPro|2|128k|10|32|1.29|720|30|1.07|0.02|1.02|0.95|/cygdrive/i/Videos/Archive",
  "dashcam" => "/cygdrive/i/Videos/Dashcam|2|192k|7|37|1.0|1080|25|1|0|1|1",
  "archive" => "/cygdrive/i/Videos/Archive|6|96k|10|38|0.9|720|25|1|0|1|1",
  "tv" => "/cygdrive/y/TV_Shows|2|256k|1|36|1.29|1080|25|1|0|1|1",
  "atv" => "/cygdrive/i/TV_Shows|2|192k|1|36|1.11|1080|25|1|0|1|1",
  "temp" => "/cygdrive/f/Temp/30day|6|640k|1|33|1.33|2160|30|1|0|1|1",
  "mov" =>  "/cygdrive/x/Movies|6|640k|1|33|1.33|2160|30|1|0|1|1",
  "amov" => "/cygdrive/g/Movies|2|256k|1|33|1.29|1080|30|1|0|1|1",
  "xmas" => "/cygdrive/g/Christmas_Movies|2|256k|1|33|1.33|2160|30|1|0|1|1",
  );
Satalink commented 7 months ago

I've never tried to run php with python (didn't even know that was possible!). What chat clients do you use? I feel it would be faster to help you that way.

I've got Whatsapp, Telegram.. can do IRC but that's not my first choice.

On Sat, Jan 27, 2024 at 10:17 AM domenicdistefano @.***> wrote:

Sorry for being a complete dummy but its been a while since working with your script. Up until now using the old script versions I would edit my paths (example below) like this and execute the command python ffhevc.php movies to run the script.

With your new version I made my own media_paths_keys.php file and edited this part (see below) which i believe is correct for my mappings.

But when I run the script this is what I get;

@.*** /cygdrive/c/videotools/ffhevc $ python ffhevc.php movies File "C:\videotools\ffhevc\ffhevc.php", line 2 <?php ^ SyntaxError: invalid syntax

OLD SCRIPT

directory config format is:

"key" => "/path/to/video/library|audioChannels|audioK|vmin|vmax|quality_factor|scale|fps|contrast|brightness|saturation|gamma/optional/destination/path"

$options['locations'] = array(
  "tv" => "/cygdrive/y|6|384k|1|38|0.75|720|25|1|0|1|1|/optional/desitnation/path",
  "movie" => "/cygdrive/z|8|640k|1|33|0.9|2160|30|1|0|1|1|/optional/desitnation/path"
);

}

NEW SCRIPT

// CONFIGURE TO YOUR MEDIA DIRECTORY NEEDS - Use above array for reference of value lables $location_config = array( "gopro" => "/cygdrive/i/Videos/GoPro|2|128k|10|32|1.29|720|30|1.07|0.02|1.02|0.95|/cygdrive/i/Videos/Archive", "dashcam" => "/cygdrive/i/Videos/Dashcam|2|192k|7|37|1.0|1080|25|1|0|1|1", "archive" => "/cygdrive/i/Videos/Archive|6|96k|10|38|0.9|720|25|1|0|1|1", "tv" => "/cygdrive/y/TV_Shows|2|256k|1|36|1.29|1080|25|1|0|1|1", "atv" => "/cygdrive/i/TV_Shows|2|192k|1|36|1.11|1080|25|1|0|1|1", "temp" => "/cygdrive/f/Temp/30day|6|640k|1|33|1.33|2160|30|1|0|1|1", "mov" => "/cygdrive/x/Movies|6|640k|1|33|1.33|2160|30|1|0|1|1", "amov" => "/cygdrive/g/Movies|2|256k|1|33|1.29|1080|30|1|0|1|1", "xmas" => "/cygdrive/g/Christmas_Movies|2|256k|1|33|1.33|2160|30|1|0|1|1", );

— Reply to this email directly, view it on GitHub https://github.com/Satalink/ffhevc/issues/1#issuecomment-1913184442, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOFYPRX46BRTTBMNOXW7ZDYQULBBAVCNFSM6AAAAAA3RTQS2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJTGE4DINBUGI . You are receiving this because you commented.Message ID: @.***>

Satalink commented 7 months ago

the main script ffevc.php is shell (shabanged) with #!/usr/bin/php. If you set the execution bit on that file you should be able to just execute it directly without having to call php (or python). It will load php from /usr/bin/php. If you have your php executable in another directory, you can create a symbolic link in /usr/bin ln -sn /path/to/your/php /usr/bin/php

Alternatively, you can php ffenc.php and that will work too.

domenicdistefano commented 7 months ago

Again sorry being an idiot, I had python on my brain because I was running unrelated scripts on another box….

If I simply run ls /cygdrive/x I get a complete listing of my movies directory and if I run ls /cygdrive/y I get a complete listing of my TV folder so Cygwin is seeing the paths & files correctly. Below is my current version of how I have your config file in terms of the paths.

When I run the script I get the following. I must have something wrong in my config of the paths.

Again I appreciate all the work you have done with this over the years. You have literally saved me and my friends TONS of disk space / $.


$ php ffhevc.php mov

Defined Locations: Array ( ) Unknown location: "mov" Edit $options['locations'] to add it OR create and define media_paths_file within the script. Administrator@Newencoder /cygdrive/c/videotools/ffhevc


// CONFIGURE TO YOUR MEDIA DIRECTORY NEEDS - Use above array for reference of value lables $location_config = array( "gopro" => "/cygdrive/i/Videos/GoPro|2|128k|10|32|1.29|720|30|1.07|0.02|1.02|0.95|/cygdrive/i/Videos/Archive", "dashcam" => "/cygdrive/i/Videos/Dashcam|2|192k|7|37|1.0|1080|25|1|0|1|1", "archive" => "/cygdrive/i/Videos/Archive|6|96k|10|38|0.9|720|25|1|0|1|1", "tv" => "/cygdrive/y|2|256k|1|36|1.29|1080|25|1|0|1|1", "atv" => "/cygdrive/i/TV_Shows|2|192k|1|36|1.11|1080|25|1|0|1|1", "temp" => "/cygdrive/f/Temp/30day|6|640k|1|33|1.33|2160|30|1|0|1|1", "mov" => "/cygdrive/x 6|640k|1|33|1.33|2160|30|1|0|1|1", "amov" => "/cygdrive/g/Movies|2|256k|1|33|1.29|1080|30|1|0|1|1", "xmas" => "/cygdrive/g/Christmas_Movies|2|256k|1|33|1.33|2160|30|1|0|1|1", );

Satalink commented 7 months ago

You'll find the new config file in the conf directory. You can cut and paste your config into it and it should work.

$options['locations'] = array( "tv" => "/cygdrive/y|6|384k|1|38|0.75|720|25|1|0|1|1|/optional/desitnation/path", "movie" => "/cygdrive/z|8|640k|1|33|0.9|2160|30|1|0|1|1|/optional/desitnation/path" );

Note, you should delete the /optional/destination/path from your config lines. It probably isn't "mandatory" but that's to move the re-encoded file to the destination if you are using a temporary folder for incoming files.

Satalink commented 7 months ago

I'm still working out a lot of issues with the new restructured code. It may take a few weeks for me to get them all ironed out. It's functional right now, but there are some edge cases that I need to fix. I'll create a new branch for the old script so you and your friends can use until I get everything worked out. If you're code savey, I would appreciate it if you would stick with the new one and help find issues so I can work them out.

Satalink commented 7 months ago

I added a branch old_singlefile to the repo

domenicdistefano commented 7 months ago

Not following exactly. Before changing anything this is what I have now;

New script (I doctored up this section from your example file so this is the relevant section of my newly created media_paths_keys.php)

// CONFIGURE TO YOUR MEDIA DIRECTORY NEEDS - Use above array for reference of value lables
$location_config = array(
  "gopro" => "/cygdrive/i/Videos/GoPro|2|128k|10|32|1.29|720|30|1.07|0.02|1.02|0.95|/cygdrive/i/Videos/Archive",
  "dashcam" => "/cygdrive/i/Videos/Dashcam|2|192k|7|37|1.0|1080|25|1|0|1|1",
  "archive" => "/cygdrive/i/Videos/Archive|6|96k|10|38|0.9|720|25|1|0|1|1",
  "tv" => "/cygdrive/y|2|256k|1|36|1.29|1080|25|1|0|1|1",
  "atv" => "/cygdrive/i/TV_Shows|2|192k|1|36|1.11|1080|25|1|0|1|1",
  "temp" => "/cygdrive/f/Temp/30day|6|640k|1|33|1.33|2160|30|1|0|1|1",
  "mov" =>  "/cygdrive/x 6|640k|1|33|1.33|2160|30|1|0|1|1",
  "amov" => "/cygdrive/g/Movies|2|256k|1|33|1.29|1080|30|1|0|1|1",
  "xmas" => "/cygdrive/g/Christmas_Movies|2|256k|1|33|1.33|2160|30|1|0|1|1",
  );

In your old script I had this in the directory format area:

# directory config format is:
#"key" => "/path/to/video/library|audioChannels|audioK|vmin|vmax|quality_factor|scale|fps|contrast|brightness|saturation|gamma/optional/destination/path"
    $options['locations'] = array(
      "tv" => "/cygdrive/y|6|384k|1|38|0.75|720|25|1|0|1|1|/optional/desitnation/path",
      "movie" => "/cygdrive/z|8|640k|1|33|0.9|2160|30|1|0|1|1|/optional/desitnation/path"
    );
  }

The part I am confused about is you said to copy paste the entirety of this part of my old config into the new one? That doesn;t seem right because the format of the area of code looks different in the new config file Shouldn't I just need to adjust the paths using the new config file in its entirety?

Also as I remember I have had to include /optional/desitnation/path in the old script or it would bomb out..

Writing this as you posted the additional info. I am in no rush. Please take the time to further iterate on your great code.

Satalink commented 7 months ago

as a work around to your original issue, you can use the --exclude flag followed by the filename to exclude a particular file from being processed (regardless).

ffhevc.php --exclude "media.file.name.mkv"

This will prevent the script from continuously trying to re-encode it.

Satalink commented 7 months ago

In your media_paths_keys.php file

replace "gopro" => "/cygdrive/i/Videos/GoPro|2|128k|10|32|1.29|720|30|1.07|0.02|1.02|0.95|/cygdrive/i/Videos/Archive", "dashcam" => "/cygdrive/i/Videos/Dashcam|2|192k|7|37|1.0|1080|25|1|0|1|1", "archive" => "/cygdrive/i/Videos/Archive|6|96k|10|38|0.9|720|25|1|0|1|1", "tv" => "/cygdrive/y|2|256k|1|36|1.29|1080|25|1|0|1|1", "atv" => "/cygdrive/i/TV_Shows|2|192k|1|36|1.11|1080|25|1|0|1|1", "temp" => "/cygdrive/f/Temp/30day|6|640k|1|33|1.33|2160|30|1|0|1|1", "mov" => "/cygdrive/x 6|640k|1|33|1.33|2160|30|1|0|1|1", "amov" => "/cygdrive/g/Movies|2|256k|1|33|1.29|1080|30|1|0|1|1", "xmas" => "/cygdrive/g/Christmas_Movies|2|256k|1|33|1.33|2160|30|1|0|1|1", with "tv" => "/cygdrive/y|6|384k|1|38|0.75|720|25|1|0|1|1", "movie" => "/cygdrive/z|8|640k|1|33|0.9|2160|30|1|0|1|1|"

I removed the /optional/destination/folder since you're not using it obviously

Satalink commented 7 months ago

Thanks for all your feedback. I appreciate it. Very stoked that someone is using it. I've spent years developing and adding functionality to it.

domenicdistefano commented 7 months ago

Still getting the location error but no worries - focus on your upcoming rework overall and just drop an update here when you want further testing.

BTW - I have two boxes with NVidia cards and would routinely run your script for weeks and even MONTHS continuously as I have a huge collection....

Satalink commented 7 months ago

I went back looking at your config...

"mov" => "/cygdrive/x 6|640k|1|33|1.33|2160|30|1|0|1|1",

It looks like you're missing a "|" pipe between /cygdrive/x and 6|640k|1|33|1.33|2160|30|1|0|1|1

Satalink commented 7 months ago

@domenicdistefano Media Path Keys (locations) has been fixed.

I'm not able to reproduce the TrueHD 7.1 issue that this issue describes. Try updating your version of ffmpeg with the latest and let me know if that resolves it for you.

domenicdistefano commented 7 months ago

I went back looking at your config...

"mov" => "/cygdrive/x 6|640k|1|33|1.33|2160|30|1|0|1|1",

It looks like you're missing a "|" pipe between /cygdrive/x and 6|640k|1|33|1.33|2160|30|1|0|1|1

I think what I pasted there was when I was first playing around trying to transplant my old config by hand.

Just looked in my current script that was working a while back. Below is what had been working for years. Still haven't got it working in your "v2,0" code but like I said I am just happy to have made contact with you. Look forward on you iterating / maturing the new code base and will give it a try again down the road.

Regarding the 7.1 issue I actually at the time went so far to compile my on version of the latest ffmpeg but no luck.

  **"tv" => "/cygdrive/y|6|384k|1|38|0.75|720|25|1|0|1|1|/optional/desitnation/path",
  "movie" => "/cygdrive/z|8|640k|1|33|0.9|2160|30|1|0|1|1|/optional/destination/path"**
Satalink commented 6 months ago

I think v2 is stable enough to test. Unfortunately, I'm unable to reproduce the 7.1 issue you are having. Send me an nzb or something to a specific file you are having issues with and I'll try it out using the same media source.

domenicdistefano commented 6 months ago

Your docs specify php 7.4+ but even a fresh install of cygwin only has 7.3 available to install as best I can tell.

$ php -v
which ffprobe
which mkvmerge
which php
which ffmpeg
PHP 7.3.7 (cli) (built: Jul 21 2020 18:15:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies
/cygdrive/c/videotools/ffprobe
/cygdrive/c/videotools/mkvmerge
/usr/bin/php
/cygdrive/c/videotools/ffmpeg

$location_config = array( "gopro" => "/cygdrive/i/Videos/GoPro|2|128k|1|33|1.29|720|30|1.07|0.02|1.02|0.95|/cygdrive/i/Videos/Archive", "dashcam" => "/cygdrive/i/Videos/Dashcam|2|192k|1|33|1.0|1080|25|1|0|1|1", "archive" => "/cygdrive/i/Videos/Archive|6|96k|1|33|0.9|720|25|1|0|1|1", "tv" => "/cygdrive/y|2|256k|1|33|1.29|1080|25|1|0|1|1", "atv" => "/cygdrive/i/TV_Shows|2|192k|1|33|1.11|1080|25|1|0|1|1", "temp" => "/cygdrive/f/Temp/30day|6|640k|1|33|1.29|2160|30|1|0|1|1", "mov" => "/cygdrive/x|6|640k|1|33|1.33|2160|30|1|0|1|1", "amov" => "/cygdrive/g/Movies|2|256k|1|33|1.29|1080|30|1|0|1|1", "xmas" => "/cygdrive/g/Christmas_Movies|2|256k|1|33|1.33|2160|30|1|0|1|1", );

Administrator@Encoder /cygdrive/c/videotools/ffhevc
$ php ffhevc.php mov

#################################################################################
##########################   f   f   H   E   V   C    ###########################
#################################################################################

PHP Fatal error:  Uncaught Error: Call to undefined function simplexml_load_file() in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php:32
Stack trace:
#0 /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php(97): ffprobe(Array, Array)
#1 /cygdrive/c/videotools/ffhevc/inc/requires/processRecurssive.php(38): processItem('/cygdrive/x/10 ...', '10 Things I Hat...', Array, Array, Array)
#2 /cygdrive/c/videotools/ffhevc/inc/requires/processRecurssive.php(34): processRecursive('/cygdrive/x/10 ...', Array, Array, Array)
#3 /cygdrive/c/videotools/ffhevc/ffhevc.php(32): processRecursive('/cygdrive/x', Array, Array, Array)
#4 {main}
  thrown in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php on line 32

Administrator@Encoder /cygdrive/c/videotools/ffhevc
Satalink commented 6 months ago

To be honest, I don't use the key method except for crons (which I have disabled at the moment). Usually I cd into the media directory and run it directly from there. I'll look into it this morning.

I have my php upgraded.. but you're right. Cygwin php is still 7.3.7. I'll switch mine over, test it, and update the README.

Great feedback! Thank you.

Satalink commented 6 months ago

I did find an issue but it was only cosmetic. It wouldn't account for the issue you reported with not being able to find executables or includes. Try installing ffhevc using git clone:

$> cd /cygdrive/c/videotools $> mv ffhevc ffhevc.old // make a backup of your existing ffhevc dir $> git clone https://github.com/Satalink/ffhevc.git ffhevc // this will clone the project into a directory called ffhevc (it creates it)

Satalink commented 6 months ago

Ah! I think you need to install php-simplexml .. I should add required php modules to the requirements.

image and image

domenicdistefano commented 6 months ago
Administrator@Encoder /cygdrive/c/videotools/ffhevc
$ php -i | grep -i simplexml
Additional .ini files parsed => /etc/php.d/simplexml.ini
SimpleXML
SimpleXML support => enabled
$ php ffhevc.php mov

#################################################################################
##########################   f   f   H   E   V   C    ###########################
#################################################################################

Stale xml detected.  Initiating new probe...
PHP Fatal error:  Uncaught Error: Call to undefined function ctype_upper() in /cygdrive/c/videotools/ffhevc/inc/_rename.php:71
Stack trace:
#0 /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php(170): rename_PlexStandards(Array, Array)
#1 /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php(39): ffprobe(Array, Array)
#2 /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php(97): ffprobe(Array, Array)
#3 /cygdrive/c/videotools/ffhevc/inc/requires/processRecurssive.php(38): processItem('/cygdrive/x/10 ...', '10 Things I Hat...', Array, Array, Array)
#4 /cygdrive/c/videotools/ffhevc/inc/requires/processRecurssive.php(34): processRecursive('/cygdrive/x/10 ...', Array, Array, Array)
#5 /cygdrive/c/videotools/ffhevc/ffhevc.php(32): processRecursive('/cygdrive/x', Array, Array, Array)
#6 {main}
  thrown in /cygdrive/c/videotools/ffhevc/inc/_rename.php on line 71
Satalink commented 6 months ago

Okay.. it looks like your SimpleXML issue is resolved. I'll replace the ctype dependence with a preg_match pattern.. I was being lazy and there's no need to required the ctype module for everyone for a single line.

Good stuff! Thanks

Satalink commented 6 months ago

ctype reference removed. :)

Satalink commented 6 months ago

I moved settings.php to settings.php_example with renaming set to false initially. Renaming may not be a welcomed feature to everyone. If you already have settings.php, it will keep it but you may want to run your tests against a copy of some media or turn off renaming in settings.php before hand.. just a thought.

domenicdistefano commented 6 months ago

So far so good! I am doing some small scale testing now on a couple of movies now and will then unleash it on my entire library. I currently have 4,670 movies and 79,916 TV episodes so its going to take a while.... I actually have two boxes with nvidia cards both on a 10G segment. Did I read correctly in the config you can run multiple instances at one now? Thinking two boxes with 2x instances running at once. Should get the entire process down to only six months :),

Satalink commented 6 months ago

I would hold off on unleashing it just yet. I still have some kinks to work out and I'd hate it if some unexpected bug destroyed your library. The big "new" thing is with file renaming. Please make sure you go through it if you have rename set to true. I'd rather be safe than sorry.

Satalink commented 6 months ago

The multiple instance is a setting now. You can configure it to have as many as your system can handle. That being said, it's one of the bugs I'm still trying to work out. It doesn't exit correctly if you go over the instance limit. PHP exit() within nested functions do not work as you would expect them to...

Satalink commented 6 months ago

Also, unless you change the encoding configs, it should NOT re-encode all of your media. It should detect if they are already within your configured limits and skip them.

domenicdistefano commented 6 months ago

I have great confidence in your tool. I just pointed it at my TV shows. 1 instance 1 box. Will monitor closely. This could possibly take weeks / months.

Satalink commented 6 months ago

If it's any comfort, I'm running it against my library. That being said, I still find issues here and there. Nothing catastrophic.. but I have things to work on still.

domenicdistefano commented 6 months ago

Seems to be working well. A While back I deleted all of the legacy XML files for each mkv.

See below - notice since at one point your old script already re-encoded these there is no [diff] 0 B ) in file size. Is the reason its not skipping before processing due to the fact it has no way to know ahead of time it's not worth it? It would be great if the ffprobe examination before hand could preemptively skip the file - would save 90% of the time to go through the library.

HEVC Encoding: 12 MONKEYS.S01E07.THE.KEYS.mkv, runtime=00:43:07
frame=62021 fps=660 q=15.0 Lsize=  913152kB time=00:43:06.81 bitrate=2891.8kbits/s speed=27.5x
SIZE-STAT: 12 MONKEYS.S01E07.THE.KEYS.mkv ( [orig] 594.62 MB - [new] 595.06 MB = [diff] 0 B )
#################################################################################

PROBED: 12 MONKEYS.S01E08.YESTERDAY.mkv (audio:eac3, CH.6, 384 KBPS)
Video Inspection ->hevc:hevc,yuv420p~=yuv420p,720<=1080,0<=2600000,1.29,
Audio Inspection ->eac3:eac3,384000<=256000,6ch<=2ch
mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit
'12 MONKEYS.S01E08.YESTERDAY.mkv': Using the demultiplexer for the format 'Matroska'.
'12 MONKEYS.S01E08.YESTERDAY.mkv' track 0: Using the output module for the format 'HEVC/H.265'.
'12 MONKEYS.S01E08.YESTERDAY.mkv' track 1: Using the output module for the format 'AC-3'.
The file '12 MONKEYS.S01E08.YESTERDAY.mkv.merge' has been opened for writing.
The cue entries (the index) are being written...
Multiplexing took 5 seconds.
Video Inspection ->hevc:hevc,yuv420p~=yuv420p,720<=1080,0<=2600000,1.29,
Audio Inspection ->eac3:eac3,384000<=256000,6ch<=2ch
HEVC Encoding: 12 MONKEYS.S01E08.YESTERDAY.mkv, runtime=00:42:04
frame=60510 fps=664 q=16.0 Lsize=  891521kB time=00:42:03.77 bitrate=2893.8kbits/s speed=27.7x
PHP Warning:  rename(12 MONKEYS.S01E08.YESTERDAY.mkv,12 MONKEYS.S01E08.YESTERDAY.orig.mkv): Device or resource busy in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 255
PHP Warning:  filemtime(): stat failed for 12 MONKEYS.S01E08.YESTERDAY.orig.mkv in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 274
PHP Warning:  filesize(): stat failed for 12 MONKEYS.S01E08.YESTERDAY.orig.mkv in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 306
PHP Warning:  filesize(): stat failed for 12 MONKEYS.S01E08.YESTERDAY.orig.mkv in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 308
SIZE-STAT: 12 MONKEYS.S01E08.YESTERDAY.mkv ( [orig] 0 B - [new] 582.29 MB = [diff] 0 B )
#################################################################################

PHP Warning:  filesize(): stat failed for 12 MONKEYS.S01E08.YESTERDAY.orig.mkv in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 312
PROBED: 12 MONKEYS.S01E09.TOMORROW.mkv (audio:eac3, CH.6, 384 KBPS)
Video Inspection ->hevc:hevc,yuv420p~=yuv420p,720<=1080,0<=2600000,1.29,
Audio Inspection ->eac3:eac3,384000<=256000,6ch<=2ch
mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit
'12 MONKEYS.S01E09.TOMORROW.mkv': Using the demultiplexer for the format 'Matroska'.
'12 MONKEYS.S01E09.TOMORROW.mkv' track 0: Using the output module for the format 'HEVC/H.265'.
'12 MONKEYS.S01E09.TOMORROW.mkv' track 1: Using the output module for the format 'AC-3'.
The file '12 MONKEYS.S01E09.TOMORROW.mkv.merge' has been opened for writing.
The cue entries (the index) are being written...
Multiplexing took 6 seconds.
Video Inspection ->hevc:hevc,yuv420p~=yuv420p,720<=1080,0<=2600000,1.29,
Audio Inspection ->eac3:eac3,384000<=256000,6ch<=2ch
HEVC Encoding: 12 MONKEYS.S01E09.TOMORROW.mkv, runtime=00:43:04
frame=61951 fps=637 q=15.0 Lsize=  911341kB time=00:43:03.89 bitrate=2889.3kbits/s speed=26.6x
SIZE-STAT: 12 MONKEYS.S01E09.TOMORROW.mkv ( [orig] 593.88 MB - [new] 594.32 MB = [diff] 0 B )
#################################################################################

PROBED: 12 MONKEYS.S01E10.DIVINE.MOVE.mkv (audio:eac3, CH.6, 384 KBPS)
Video Inspection ->hevc:hevc,yuv420p~=yuv420p,720<=1080,0<=2600000,1.29,
Audio Inspection ->eac3:eac3,384000<=256000,6ch<=2ch
mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit
'12 MONKEYS.S01E10.DIVINE.MOVE.mkv': Using the demultiplexer for the format 'Matroska'.
'12 MONKEYS.S01E10.DIVINE.MOVE.mkv' track 0: Using the output module for the format 'HEVC/H.265'.
'12 MONKEYS.S01E10.DIVINE.MOVE.mkv' track 1: Using the output module for the format 'AC-3'.
The file '12 MONKEYS.S01E10.DIVINE.MOVE.mkv.merge' has been opened for writing.
The cue entries (the index) are being written...
Multiplexing took 5 seconds.
Video Inspection ->hevc:hevc,yuv420p~=yuv420p,720<=1080,0<=2600000,1.29,
Audio Inspection ->eac3:eac3,384000<=256000,6ch<=2ch
HEVC Encoding: 12 MONKEYS.S01E10.DIVINE.MOVE.mkv, runtime=00:43:07
frame=62023 fps=650 q=15.0 Lsize=  912558kB time=00:43:06.83 bitrate=2889.9kbits/s speed=27.1x
SIZE-STAT: 12 MONKEYS.S01E10.DIVINE.MOVE.mkv ( [orig] 593.97 MB - [new] 594.41 MB = [diff] 0 B )
#################################################################################
Satalink commented 6 months ago

I have a fairly serious issue with renaming and the (before and after) comparison. Don't pull the latest update please. I don't think it's good. I'll work it out tomorrow. The failure is that it won't detect if a previous file size is smaller than the new. When this is detected it keeps the old and marks it as excluded in the xml file.

I had no idea the renaming thing was going to be this complicated. I'll get it worked out.

domenicdistefano commented 6 months ago

No worries and great work! The script ran all night so its solid. I canceled it and will wait until you get a build you are more comfortable with. I never used the renaming because my other processes take care of that.

Satalink commented 6 months ago

The renaming thing came about when I moved to adding the IMDBid, vcodec, acodec and profile to sonarr and radarr file management file naming settings. It's useful to be able to see the encoding of a file and the IMDBid is used for flawless matching in Plex (or so the theory goes).

Then came the issue with re-encoding and the codecs didn't accurately reflect the file anymore. So that's the reasoning behind the renaming function.

I'm working out a new audio boost feature that will automatically boost the audio from a user setting on 7.1/5.1 to stereo/mono. Hopefully I'll have this renaming thing nailed down this week and move to that feature next.

Satalink commented 6 months ago

I've just pushed the latest commit up.

Lots of bug fixes and a few new features

Okay.. that's all for now. Cheers

Satalink commented 6 months ago

Something with the tags is causing Plex to crash on playing the media. Don't use the latest on any of you files until I get it worked out. Plays find on my PC .. but not on Plex.

Satalink commented 6 months ago

Fixed the Plex crash issue. There's something about some of the h264 files that are smaller than the re-encoded x265 files. When MkvMerge was applied to them, it was crashing on playback. I fixed it by moving the keep original routine to before the mkvmerge.. which is more true to the form (keep original). The exclude tag is still embedded into the media file so that future scans will know to skip it even if the file is renamed or moved.

I'd like to close this issue as I'm unable to reproduce the 8ch 7.1 problem you're having and most of this discussion has moved away from that anyway. If you find any other issues, please open a new one.

Thanks!

domenicdistefano commented 6 months ago

With this version the script is running but looks like it has some issues - my output below.

Also, yes not seeing the original errors that prompted me opening this. Not sure if Github allows us to PM each other in order to exchange details of a better way to communicatie. If there is a public way to do it here that is also fine with me as others may benefit. Thank you on behalf of myself and several of my friends that have using your code faithfully for years.


#################################################################################
##########################   f   f   H   E   V   C    ###########################
#################################################################################

Stale xml detected.  Initiating new probe...
PHP Warning:  Invalid argument supplied for foreach() in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php on line 61
PROBED: 11.22.63.s01e01.the.rabbit.hole.mkv
        audio:eac3, CH.2, 256 KBPS

PHP Warning:  Invalid argument supplied for foreach() in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php on line 61
Video Inspection ->hevc:hevc,yuv420p10le~=yuv420p10le,642<=1080,0<=2500000,1.29,
Audio Inspection ->copy
mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit
Error: '' is not a valid IETF BCP 47/RFC 5646 language tag in '--language 0:'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags.
HEVC Encoding: 11.22.63.s01e01.the.rabbit.hole.mkv
                                       run time=01:20:45
frame=19440 fps=571 q=9.0 size=  237824kB time=00:13:31.20 bitrate=2401.7kbits/s speed=23.8x
Satalink commented 6 months ago

I just deployed todays fixes .. it now converts lots of formats into mkv .. sometimes I get mp4s.. but will do a full list of other formats.

I don't mind comment on bugs in public forum.. I understand the public benefit. But I also think it may be confusing until I get this thing nailed down to a stable release.

On Saturday, Feb 10, 2024, 4:57 PM, wrote:

With this version the script is running but looks like it has some issues - my output below. Also, yes not seeing the original errors that prompted me opening this. Not sure if Github allows us to PM each other in order to exchange details of a better way to communicatie. If there is a public way to do it here that is also fine with me as others may benefit. Thank you on behalf of myself and several of my friends that have using your code faithfully for years. ################################################################################# ########################## f f H E V C ########################### ################################################################################# Stale xml detected. Initiating new probe... PHP Warning: Invalid argument supplied for foreach() in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php on line 61 PROBED: 11.22.63.s01e01.the.rabbit.hole.mkv audio:eac3, CH.2, 256 KBPS PHP Warning: Invalid argument supplied for foreach() in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php on line 61 Video Inspection -&gt;hevc:hevc,yuv420p10le~=yuv420p10le,642&lt;=1080,0&lt;=2500000,1.29, Audio Inspection -&gt;copy mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit Error: '' is not a valid IETF BCP 47/RFC 5646 language tag in '--language 0:'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags. HEVC Encoding: 11.22.63.s01e01.the.rabbit.hole.mkv run time=01:20:45 frame=19440 fps=571 q=9.0 size= 237824kB time=00:13:31.20 bitrate=2401.7kbits/s speed=23.8x -- Reply to this email directly or view it on GitHub: https://github.com/Satalink/ffhevc/issues/1#issuecomment-1937231397 You are receiving this because you commented. Message ID:

Satalink commented 6 months ago

I think your 7.1 problem has to do with EAC3 and 8 channel (ffmpeg issue). Try either dropping your media_path_key channels down from 8 to 6 (which is what I have it set to), or configure your settings.php audio_codec to be something that supports 7.1

domenicdistefano commented 6 months ago

Just started to test again after another clean pull. I keeps spewing;

mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit
Error: '' is not a valid IETF BCP 47/RFC 5646 language tag in '--language 0:'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags.
PHP Notice:  Undefined variable: fileorig in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 300
PHP Notice:  Undefined variable: fileorig in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 303
Stale xml detected.  Initiating new probe...
PHP Warning:  Invalid argument supplied for foreach() in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php on line 61
PROBED: 24.s02e16.day.2-.11-00.p.m.-.12-00.a.m.mkv
        audio:eac3, CH.2, 256 KBPS
        sub: subtitle:subrip
PHP Warning:  Invalid argument supplied for foreach() in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php on line 61
Video Inspection ->hevc:,yuv420p10le~=yuv420p10le,720<=1080,0<=2600000,1.29,
Audio Inspection ->copy
mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit
Error: '' is not a valid IETF BCP 47/RFC 5646 language tag in '--language 0:'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags.
HEVC Encoding: 24.s02e16.day.2-.11-00.p.m.-.12-00.a.m.mkv
                                       run time=00:43:54
PHP Notice:  Undefined index: format in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 294
PHP Notice:  Undefined index: format in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 296
SIZE-STAT: 24.s02e16.day.2-.11-00.p.m.-.12-00.a.m.mkv ( [orig] 0 B - [new] 660.85 MB = [diff] 0 B )
#################################################################################

PHP Notice:  Undefined variable: fileorig in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 300
PHP Notice:  Undefined variable: fileorig in /cygdrive/c/videotools/ffhevc/inc/requires/processItem.php on line 303
Stale xml detected.  Initiating new probe...
PHP Warning:  Invalid argument supplied for foreach() in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php on line 61
PROBED: 24.s02e17.day.2-.12-00.a.m.-.1-00.a.m.mkv
        audio:eac3, CH.2, 256 KBPS
        sub: subtitle:subrip
PHP Warning:  Invalid argument supplied for foreach() in /cygdrive/c/videotools/ffhevc/inc/requires/ffprobe.php on line 61
Video Inspection ->hevc:,yuv420p10le~=yuv420p10le,720<=1080,0<=2600000,1.29,
Audio Inspection ->copy
mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit
Error: '' is not a valid IETF BCP 47/RFC 5646 language tag in '--language 0:'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags.
HEVC Encoding: 24.s02e17.day.2-.12-00.a.m.-.1-00.a.m.mkv
Satalink commented 6 months ago

I'll dig into that tomorrow. My email is on my github profile. You can reach out to me directly there.