lisamelton / other_video_transcoding

Other tools to transcode videos.
MIT License
550 stars 25 forks source link

Installed but … not #6

Closed vr8hub closed 4 years ago

vr8hub commented 4 years ago

I'm missing something really obvious. (Still OSX Mojave 10.14.6.) ;TLDR, I can't run other-transcode after installing the gem.

I installed with gem install other_video_transcoding. It successfully installed, or at least gave me messages indicating it was.

Successfully installed other_video_transcoding-0.1.1
Parsing documentation for other_video_transcoding-0.1.1
Done installing documentation for other_video_transcoding after 0 seconds

But, there is no other-transcode command. E.g., other-transcode gives a command not found. A dir *transcode* in /usr/local/bin yields only transcode-video. The gem is installed (I can see it in the gems directory), but there was no "helper" installed in /usr/local/bin like there is with transcode-video. But the help indicates that other-transcode can be run after install, so it sounds like there should be a helper, or some other easy means for running the script.

Although a regular install worked, I did a sudo install as well, just to make sure, with the same results (no command).

If this was a general problem, everyone would be complaining about it. Which brings us full circle—I'm missing something really obvious.

lisamelton commented 4 years ago

@vr8hub Long time no see, old friend! We miss you on the Slack channel, BTW.

OK, I'm guessing you're having a similar problem to what I had the first time I installed the other_video_transcoding Gem. And it happened to me right after I uploaded the Gem to the server for everyone else. Irony.

So my guess is that you have a horked Ruby configuration, a horked Gem configuration or both. And more than likely, the location of where the Gem is installed is not listed in your $PATH variable. Which was my problem.

On my machine, the location was:

/usr/local/lib/ruby/gems/2.6.0/bin

...because that's where the version of RubyGems in the Ruby that I installed with Homebrew put them.

Can you check if that's where your other-transcode binary was placed too?

If not, can you paste in the output of this command:

gem contents other_video_transcoding

Thanks.

vr8hub commented 4 years ago

Any of those are possible. I know next to nothing about ruby; you're the only reason I have brew's version installed. :)

What's definitely true is that the gem bin directory is not in the path. But it's never been in the path. And I haven't been able to find indication it should be. Ruby apparently complains if you do a --user-install and don't have that bin in the path, but I received no such complaint when installing it to the regular path (i.e. I didn't do a --user-install).

gem environment says there are three GEM paths:

GEM PATHS:
     - /usr/local/lib/ruby/gems/2.6.0
     - /Users/vrice/.gem/ruby/2.6.0
     - /usr/local/Cellar/ruby/2.6.5/lib/ruby/gems/2.6.0

The first one is where other_video_transcoding was installed. There is a gems directory underneath it, and a other_video_transcoding-0.1.1 directory underneath it, and a bin directory underneath that. The contents of that bin directory are also in /usr/local/lib/ruby/gems/2.6.0/bin.

(Spelunking in that directory also shows that I have lots of old versions of video-transcoding installed. I'll have to research how to get rid of old versions.)

(Yes, I've been a slacker. [See what I did there?] We've been out of the country visiting our kids for almost a month, and before that work and life intervened. I checked in because 1) one of the Apple sites I frequent posted when the other-transcode was released, and 2) I took Nolan's Batman trilogy with me on my iPad to watch on the plane, and noticed that the Imax sections weren't full-screen, which meant I probably used the default detect-crop before I knew any better about those particular movies. So I decided to check out other-transcode, and here we are.)

lisamelton commented 4 years ago

@vr8hub I will gladly take the blame for your Ruby dependence, sir! :) Seriously, it is an honor.

BTW, sorry I took so long to reply but I was on chauffeuring duty this morning. Spousal shopping and all. You know how it is. :/

OK, I realize that the Gem /bin directory has never been in your $PATH and everything worked fine before without that. But Homebrew itself and/or the Ruby formula (i.e. install script) changed all that.

The original behavior was to install a stub or link for each Gem executable (e.g. transcode-video) into your /usr/local/bin directory. And that directory has always been and continues to be in your $PATH. It's a default "search" location for executables on macOS (thank God). So that's why it worked.

But that behavior changed sometime during 2019, I think. I'm not sure exactly when. Now we're required to add (in our case) both:

/usr/local/lib/ruby/gems/2.6.0/bin

and

/usr/local/opt/ruby/bin

...to our $PATH.

When you do a brew install ruby now, the install script formula will actually spew instructions to do just that to the console, packed right between other geeky prose none of us ever read.

Of course, if you already had Ruby installed, then you would likely never see that message anyway. This is what is called, and I hate to be overly technical here, "being screwed." :/

Worse, Homebrew didn't remove those old stubs or links to Gem executables in /usr/local/bin that it had originally installed before. And they basically point to either nothing or the wrong version now. Even worse, the only way to get rid of them is to manually remove the damn things.

OK, let's get back to fixing your problem after I've properly frightened and annoyed you...

You need to add the following line to (or edit any existing line in) your ~/.bash_profile configuration to include something like this:

PATH=/usr/local/lib/ruby/gems/2.6.0/bin:/usr/local/opt/ruby/bin:$PATH

This will prepend the Gem and Ruby search paths to your existing $PATH variable defined elsewhere.

Since you're on Catalina now, the default shell is (I think) Zsh instead of Bash. So your configuration file may have a different name. But it will still be something starting with . in your home directory. I'm not on Catalina yet so I have no idea.

Oh, you can remove old Gems using this command:

gem cleanup

And, BTW, slacking (yes, I got the joke :) ) is allowed. Especially when family is involved. As are work and life interruptions.

Just out of curiosity, was that Apple site you mentioned sixcolors.com?

You're not the only person that has been bitten by cropping out portions of Nolan's Batman trilogy. That's one reason I made the --crop auto behavior of other-transcode less aggressive. It doesn't have that problem. But these days I don't recommend cropping at all because hardware encoders aren't prone to the quality and performance problems that still plague the x264 software encoder when video isn't cropped.

Also, please come back and visit us on Slack! You're one of the reasons that other-transcode exists. Seriously, I might never have gone down that path if not for that issue you filed on transcode-video about defaulting to hardware encoders. Remember that? :)

vr8hub commented 4 years ago

You didn't frighten or annoy me, but brew has done plenty of the latter lately. I really don't like the path they've gone down the last couple of years. But I like MacPorts even less. What's a person to do? (First-world problems.)

All right, I'll add them to the path and delete the "helpers" in /usr/local/bin for the old transcode package. I actively web searched for indications on what the path should be for ruby and/or gems, but couldn't find much. It's possible my searches weren't the best in my jet-lagged state. (I was in a +13 hours location from home.)

I'm not on Catalina—see that "(Still OSX Mojave 10.14.6.)" on the very first line of the issue? :)

Good to know about cropping. I obviously wasn't going to crop when I re-did the trilogy (although I don't think BB uses any Imax?), but in general I pretty blindly follow your recommendations in the README's, and since it had detect-crop in it, that's what I've always done.

Yes, I'll try to check in on Slack more often. I bought a big HD and have ripped all of my Blu-Rays and TV series; DVD's to go. At some point I may get a Mac mini and put Plex up so it can serve the ripped files instead of me having to put the discs in my player. (Again, first-world problems.)

Oh, and after going and looking, yes, it was sixcolors where I saw the note. I have a lot of Apple sites on my RSS feed, so I didn't remember who it was.

vr8hub commented 4 years ago

Because I'm a masochist, I uninstalled brew's ruby and re-installed it, so I could see what happened and what messages were generated. I then added /usr/local/opt/ruby/bin to my path in .bashrc. I then did a gem install other_video_transcoding, during which I got this error:

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /usr/local/lib/ruby/gems/2.6.0/gems/other_video_transcoding-0.1.1/CHANGELOG.md

But all of the files (including CHANGELOG.md) seem to be in the appropriate place, i.e. a dir of dir /usr/local/lib/ruby/gems/2.6.0/gems/other_video_transcoding-0.1.1 shows all the appropriate files and/or directory.

I went ahead and added /usr/local/lib/ruby/gems/2.6.0/gems/bin to my path.

But, trying a other-transcode --help gives this error:

Traceback (most recent call last):
    2: from /usr/local/lib/ruby/gems/2.6.0/bin/other-transcode:23:in `<main>'
    1: from /usr/local/Cellar/ruby/2.6.5/lib/ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
/usr/local/Cellar/ruby/2.6.5/lib/ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': can't find gem other_video_transcoding (>= 0.a) with executable other-transcode (Gem::GemNotFoundException)

And, belatedly, a gem list doesn't show other_video_transcoding.

So, something appears to have not worked in the installation. I realize you're not ruby support :), but you do seem to have encountered these issues before, so I'm hoping you know what's wrong here, too.

UPDATE: (not really, but I just noticed it as I was about to hit Send). Unlike the rest of the directories in the …/gems directory, the one created by the gem install other_video_transcoding is owned by root:admin, rather than <my user name>:admin. That's undoubtedly what's wrong, but I'm not sure what would have caused it.

So, I manually deleted the other_video_transcoding-* directory in the gems directory and re-did the gem install other_video_transcoding, and this time it worked.

I love technology. (Note: I do not love technology.)

There is now nothing for you to respond to, but I'm leaving this note for any others who might follow in my insanity.

lisamelton commented 4 years ago

@vr8hub I am so glad you were able to fix that! I suspect the reason you had ownership by root:admin is that you used sudo for that one gem install. Anyway, my apologies for being confused that you were on Catalina. It happens a lot. I'm old. :)

vr8hub commented 4 years ago

Doh! Right, except it was the install two tries before, and I had deleted/reinstalled ruby in the meantime. Which means that brew uninstall ruby didn't clean up that directory or tell me that it couldn't. (Have I mentioned I don't like where brew has been going?) So when ruby was re-installed, that gem directory was already there, but the gem wasn't "installed" (and so didn't show up on the list). The above install didn't actually install it, it couldn't because the previous root install was still there. But when I looked (and didn't pay attention to the ownership), it looked it had installed it, because in my head everything went away with the uninstall ruby. (Lots of things happen in my head that don't happen out here in the real world.)

That makes total sense now. And that's why we pay you the big bucks. Or should, probably. :)

lisamelton commented 4 years ago

@vr8hub If it's any consolation, I also don't like several of the decisions the Homebrew folks have made recently either. :/