Giter Site home page Giter Site logo

Comments (10)

FallingSnow avatar FallingSnow commented on July 21, 2024

Can you post an error log please. I've never owned a mac but I'm willing to try to help you debug.

from h265ize.

FallingSnow avatar FallingSnow commented on July 21, 2024

Haven't received a reply in 7 days, going to close.

from h265ize.

pfriedel avatar pfriedel commented on July 21, 2024

For what it's worth, this is / was "declare -A", i.e. bash 4 language features not available in the (dusty old) version of bash 3 that OSX ships with. Coding down to bash 3 is a significant change. If you really want to use h265ize under OSX, it's easier to start by installing bash4 from homebrew or fink, I suspect.

orbimac:~ pfriedel$ h265ize 
/usr/local/bin/h265ize: line 5: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/usr/local/bin/h265ize: line 37: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/usr/local/bin/h265ize: line 111: [: --: unary operator expected
/usr/local/bin/h265ize: line 92: [: /Users/pfriedel/h265190fasteng0encoding-in-processmkv/Users/pfriedel/h2653010HandBrakeCLIHandBrakeCLI10bit0001000020: integer expression expected
/usr/local/bin/h265ize: line 92: [: /Users/pfriedel/h265190fasteng0encoding-in-processmkv/Users/pfriedel/h2653010HandBrakeCLIHandBrakeCLI10bit0001000020: integer expression expected
/usr/local/bin/h265ize: line 92: [: /Users/pfriedel/h265190fasteng0encoding-in-processmkv/Users/pfriedel/h2653010HandBrakeCLIHandBrakeCLI10bit0001000020: integer expression expected
[h265ize]: Output destination "/Users/pfriedel/h265190fasteng0encoding-in-processmkv/Users/pfriedel/h2653010HandBrakeCLIHandBrakeCLI10bit0001000020" does not exist. Would you like to create it? [y/N]: 

from h265ize.

pfriedel avatar pfriedel commented on July 21, 2024

So, having updated to bash4 with homebrew (quick! easy! guides all over the web!), this is more like it, I'll noodle with it a bit to see if I can make sense of it:

orbimac:~ pfriedel$ h265ize -v -d ./h265 -f mkv -m superfast -q 23 video.avi 
/usr/local/bin/h265ize: line 111: [: --: unary operator expected
(standard_in) 1: parse error
[h265ize]: Finding videos...
find: :d:q:m:n:t:f:g:l:x:vphaou: No such file or directory
find: :d:q:m:n:t:f:g:l:x:vphaou: No such file or directory
[h265ize]: No video files found.

Mostly because getopt is doing something unexpected there (i.e. nothing at all) and the getopt args end up somehow getting passed to find later on? yech.

from h265ize.

FallingSnow avatar FallingSnow commented on July 21, 2024

@pfriedel What's you getopt --version?

Also I will add a bash version check to inform the user if they are using an unsupported bash version.

from h265ize.

pfriedel avatar pfriedel commented on July 21, 2024

That's part of the hilarity:

orbimac:~ pfriedel$ getopt --version
 --

The related man1 and man3 manpages are from 1999 and 1995, respectively, so "old" is probably safe. I dunno if getopts the bash builtin is an option vs getopt the external command, but that might be a path forward. Figuring that I'm already in it up to my elbows, I installed the gnu-getopts from homebrew as well. Brew doesn't put that into the $PATH because it would be incompatible with stuff that expects BSD getopt, so I edited the path in h265ize and ended up here (the firstrun setup more or less worked, I guess):

orbimac:Downloads pfriedel$ h265ize video.mkv 
(standard_in) 1: parse error
[h265ize]: Finding videos...
[h265ize]: No video files found.

Editing the FILES=$() to see what it's doing, I see this, which related to #9 :

orbimac:Downloads pfriedel$ find "video.mkv" -maxdepth 2 -type f -exec file -N -i -- {} +
video.mkv: regular file

Additionally, OSX find doesn't do -N -i, it looks like it wants -I for the mime-type argument, which changes it at least to this:

orbimac:Downloads pfriedel$ find "video.mkv" -maxdepth 2 -type f -exec file -N -I -- {} +
video.mkv: application/octet-stream; charset=binary

...Which is, if nothing else, a known place.

To sum up, OSX users:

  1. install homebrew bash and gnu-getopt
  2. edit the script and change getopt to the full /usr/local/Cellar/gnu-getopt/1.1.6/bin/getopt path
  3. Fiddle with file detection to make HandBrakeCLI do the rejection instead of handing it a cleanly parsed list of valid files
  4. probably install ffmpeg and such on your own - they're in my path from before I can remember when I installed them.

Having done all that, it seems to work as well as I'm used to in Linux, barring the issues from #9 so with a bit of user hacking it seems to work moderately well? I'll give it some more testing to see what isn't actually working.

from h265ize.

pfriedel avatar pfriedel commented on July 21, 2024

Ah, there's a dependency on ffprobe as well - not having that seems like it knocks h265ize back a bit. You get the mac ffprobe binary the same place you get the ffmpeg binary: https://www.ffmpeg.org/download.html

There's an expr and a date error in the logs, but that's getting nitpicky:

orbimac:Downloads pfriedel$ h265ize -v video.mkv 
(standard_in) 1: parse error
[h265ize]: Finding videos...
[h265ize]: Found:
 - video.mkv
[h265ize]: [Verbose] Folder processing started on Nov 23 06:25:55 PM
stat: illegal option -- -
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
(standard_in) 1: parse error
[h265ize]: Processing video.mkv...
--------------------------------------------------------------------------------
expr: not a decimal number: '       3'
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
[h265ize]: [Verbose] File encoding started at 
[h265ize]: [Verbose] Duration: 124.35 Minutes (7461.246000 seconds)

from h265ize.

FallingSnow avatar FallingSnow commented on July 21, 2024

I actually laughed a few times while reading your last messages. The 1999 getopt was definitely funny. My man page is from December 2014. Unfortunately bash's builtin getopts isn't an option, I originally used it but it was missing a few features I wanted. I'm happy you got it working for the most part.

Just to be clear, in order to get h265ize running on a mac I would need to:

  • install bash, gnu-getopt, ffprobe, and ffmpeg
  • change the find command option from -i to -I

Also, if you don't mind, what version of OS X are you running?

from h265ize.

pfriedel avatar pfriedel commented on July 21, 2024

El Capitan, relatively recently installed. I'll see what's necessary in a clean install El Cap VM to see how much was just dumb luck from having been down this sort of road before versus it really being just that easy. It's probably more trouble than it's worth to try to merge the changes with OS detection wrapped around it, but a branch might be tolerable since it's only a few key lines to keep in sync. I'll sync it up after #9 closes and submit a diff - my find hack is definitely suboptimal, even if it works. The current code changes are here:

To be honest, I was surprised how well it ported once the toolchain was brought up to speed, and installing the homebrew mods is pretty straightforward these days.

A few other changes vs master here:

http://pastie.org/10577266

  • The hashbang needs to change to get bash4 instead of bash3 in /bin
  • getopt is explicitly declared to be the gnu getopt from homebrew in lines 111 and 115
  • I add an additional file matching ADDLFILE for application/* and change the file mime-type from -i to -I as BSD/OSX file requires, then bung those back into the FILES array buildup - hack answer to #9.
  • stat changes in lines 452 and 839 - BSD/OSX stat is -n -f"%z"
  • an entirely superfluous awk at the end of 496 squashes " 3 " down to "3"
  • I can't tell what the date in 517 is doing with the prefix (start time as localtime?), so I don't know how to suggest a way forward.

All of which are either noop with gnu tools (the awk won't hurt, but it doesn't need to be there, for example) or not unreasonable additions to the defaults array for interested parties to change to. Then OSX compatibility is "install necessary tools, change defaults header, let 'er rip".

from h265ize.

FallingSnow avatar FallingSnow commented on July 21, 2024

Cool, adding some OS detection, which is actually rather straight forward, and asking the user to change the hashbang plus install dependencies should be all it takes.

BTW, the date at L518 is just converting tempVars[startDate] to a more human friendly format. As for the -d prefix, it's just reading in a date.

-d, --date=String         Display time described by String, instead of 'now'
                            this can be in almost any common format.  
                            It can contain month names, timezones, 'am' and 'pm',
                            'yesterday', 'ago', 'next', etc.

Thanks for all your work so far pfriedel.

from h265ize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.