Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Installing two configurations of one formula side-by-side #48902

Closed
RickyRomero opened this issue Feb 6, 2016 · 7 comments
Closed

Installing two configurations of one formula side-by-side #48902

RickyRomero opened this issue Feb 6, 2016 · 7 comments

Comments

@RickyRomero
Copy link

ffmpeg will not encode 10-bit video unless x264 is compiled with 10-bit support. But, it doesn't encode 8-bit video with 10-bit x264. I don't want to lose the ability to encode 8-bit video.

This means that I need to have two copies of x264 installed, and switch between them using ffmpeg's LD_LIBRARY_PATH variable.

Ideally, what I'd like to do is have the vanilla 8-bit x264 be the canonical version (using brew install x264), but then have another version (brew install x264 --with-10-bit) with some unique name (like x264-10bit). brew would ideally know about both versions and would update both whenever I run brew upgrade.

I don't know how to accomplish this today, unless I missed something in the manual.

@tdsmith
Copy link
Contributor

tdsmith commented Feb 6, 2016

This isn't easy but one way to do this is to make a copy of the x264 formula with a different name; it might be easiest to set up a local tap, which is just a directory which is a git repository that contains a checked-in x264-10bit.rb. You can tap it like brew tap myname/secondx264 ~/homebrew/my_x264_tap and install your package like brew install x264-10bit.

@RickyRomero
Copy link
Author

@tdsmith Thanks for the advice, I'll give that a try.

@retokromer
Copy link

If ffmpeg is linked to libx264 dynamically rather than statically, then it will adapt automatically to the bit depth supported by the run-time libx264, regardless of the version used at build time. This way it’s possible to work either 8-bit or 10-bit in each ffmpeg command. However you cannot combine 8-bit and 10-bit in the same command, you need two distinct commands.

@RickyRomero
Copy link
Author

@retokromer Yep, I'm trying to do that right now. (following this advice on Stack Exchange under "Second Way")

@RickyRomero
Copy link
Author

My solution to this problem is rather primitive, but it's easier to manage than a local tap.

#!/bin/bash

echo "----------------------------------------------------"
echo "----------------------------------------------------"
echo "-- Updating and upgrading brew... ------------------"
echo "----------------------------------------------------"
echo "----------------------------------------------------"
brew update
brew upgrade

echo "----------------------------------------------------"
echo "----------------------------------------------------"
echo "-- Installing x264 10-bit... -----------------------"
echo "----------------------------------------------------"
echo "----------------------------------------------------"
brew reinstall x264 --with-10-bit
X264_PATH=`brew ls --verbose x264 | sed -n 1p | grep -o "/usr/local/Cellar/x264/[^/]*/"`
cp -R $X264_PATH* /usr/local/lib/x264-10-bit

echo "----------------------------------------------------"
echo "----------------------------------------------------"
echo "-- Reinstalling vanilla x264... --------------------"
echo "----------------------------------------------------"
echo "----------------------------------------------------"
brew uninstall x264
brew install x264

echo "----------------------------------------------------"
echo "----------------------------------------------------"
echo "-- Installing x265 16-bit... -----------------------"
echo "----------------------------------------------------"
echo "----------------------------------------------------"
brew reinstall x265 --with-16-bit
X265_PATH=`brew ls --verbose x265 | sed -n 1p | grep -o "/usr/local/Cellar/x265/[^/]*/"`
cp -R $X265_PATH* /usr/local/lib/x265-16-bit

echo "----------------------------------------------------"
echo "----------------------------------------------------"
echo "-- Reinstalling vanilla x265... --------------------"
echo "----------------------------------------------------"
echo "----------------------------------------------------"
brew uninstall x265
brew install x265

@DomT4
Copy link
Member

DomT4 commented Feb 13, 2016

Let us know if there's anything we can practically do to help further here, Thanks! 😃

@DomT4 DomT4 closed this as completed Feb 13, 2016
@ReaddyEddy
Copy link

The script above fails.

@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants